diff options
-rw-r--r-- | src/library.js | 2 | ||||
-rw-r--r-- | src/library_browser.js | 8 | ||||
-rw-r--r-- | src/library_fs.js | 8 | ||||
-rw-r--r-- | src/library_gl.js | 44 | ||||
-rw-r--r-- | src/library_memfs.js | 5 | ||||
-rw-r--r-- | src/library_sockfs.js | 2 | ||||
-rw-r--r-- | src/postamble.js | 12 | ||||
-rw-r--r-- | src/preamble.js | 248 | ||||
-rw-r--r-- | tests/cases/ptrtoint_blockaddr.ll | 14 | ||||
-rw-r--r-- | tests/fuzz/18.cpp | 1125 | ||||
-rw-r--r-- | tests/fuzz/18.cpp.txt | 1 | ||||
-rwxr-xr-x | tests/fuzz/test.sh | 3 | ||||
-rwxr-xr-x | tests/fuzz/testpp.sh | 51 | ||||
-rw-r--r-- | tests/printf/output.txt | 1 | ||||
-rw-r--r-- | tests/printf/test.c | 1 | ||||
-rw-r--r-- | tests/test_browser.py | 2 | ||||
-rw-r--r-- | tests/test_core.py | 12 | ||||
-rw-r--r-- | tests/test_sanity.py | 2 |
18 files changed, 1357 insertions, 184 deletions
diff --git a/src/library.js b/src/library.js index c1eb2219..57023795 100644 --- a/src/library.js +++ b/src/library.js @@ -1970,7 +1970,7 @@ LibraryManager.library = { } next = {{{ makeGetValue(0, 'textIndex+1', 'i8') }}}; } - if (precision === -1) { + if (precision < 0) { precision = 6; // Standard default. precisionSet = false; } diff --git a/src/library_browser.js b/src/library_browser.js index 46082281..b800292c 100644 --- a/src/library_browser.js +++ b/src/library_browser.js @@ -234,6 +234,10 @@ mergeInto(LibraryManager.library, { } #endif var ctx; + var errorInfo = '?'; + function onContextCreationError(event) { + errorInfo = event.statusMessage || errorInfo; + } try { if (useWebGL) { var contextAttributes = { @@ -251,10 +255,6 @@ mergeInto(LibraryManager.library, { contextAttributes.preserveDrawingBuffer = true; #endif - var errorInfo = '?'; - function onContextCreationError(event) { - errorInfo = event.statusMessage || errorInfo; - } canvas.addEventListener('webglcontextcreationerror', onContextCreationError, false); try { ['experimental-webgl', 'webgl'].some(function(webglId) { diff --git a/src/library_fs.js b/src/library_fs.js index e97ba588..1428f041 100644 --- a/src/library_fs.js +++ b/src/library_fs.js @@ -616,13 +616,13 @@ mergeInto(LibraryManager.library, { }, // helpers to create specific types of nodes create: function(path, mode) { - mode = mode !== undefined ? mode : 0666; + mode = mode !== undefined ? mode : 438 /* 0666 */; mode &= {{{ cDefine('S_IALLUGO') }}}; mode |= {{{ cDefine('S_IFREG') }}}; return FS.mknod(path, mode, 0); }, mkdir: function(path, mode) { - mode = mode !== undefined ? mode : 0777; + mode = mode !== undefined ? mode : 511 /* 0777 */; mode &= {{{ cDefine('S_IRWXUGO') }}} | {{{ cDefine('S_ISVTX') }}}; mode |= {{{ cDefine('S_IFDIR') }}}; return FS.mknod(path, mode, 0); @@ -630,7 +630,7 @@ mergeInto(LibraryManager.library, { mkdev: function(path, mode, dev) { if (typeof(dev) === 'undefined') { dev = mode; - mode = 0666; + mode = 438 /* 0666 */; } mode |= {{{ cDefine('S_IFCHR') }}}; return FS.mknod(path, mode, dev); @@ -895,7 +895,7 @@ mergeInto(LibraryManager.library, { }, open: function(path, flags, mode, fd_start, fd_end) { flags = typeof flags === 'string' ? FS.modeStringToFlags(flags) : flags; - mode = typeof mode === 'undefined' ? 0666 : mode; + mode = typeof mode === 'undefined' ? 438 /* 0666 */ : mode; if ((flags & {{{ cDefine('O_CREAT') }}})) { mode = (mode & {{{ cDefine('S_IALLUGO') }}}) | {{{ cDefine('S_IFREG') }}}; } else { diff --git a/src/library_gl.js b/src/library_gl.js index 10c8cec9..7e4c5a97 100644 --- a/src/library_gl.js +++ b/src/library_gl.js @@ -1806,14 +1806,10 @@ var LibraryGL = { glGenVertexArrays__sig: 'vii', glGenVertexArrays: function (n, arrays) { #if LEGACY_GL_EMULATION - if (GL.vaoExt == null) { - _emulGlGenVertexArrays(n, arrays); - return; - } -#else -#if GL_ASSERTIONS + _emulGlGenVertexArrays(n, arrays); +#else +#if GL_ASSERTIONS assert(GL.vaoExt, 'Must have OES_vertex_array_object to use vao'); -#endif #endif for(var i = 0; i < n; i++) { @@ -1823,6 +1819,7 @@ var LibraryGL = { GL.vaos[id] = vao; {{{ makeSetValue('arrays', 'i*4', 'id', 'i32') }}}; } +#endif }, #if LEGACY_GL_EMULATION @@ -1831,21 +1828,17 @@ var LibraryGL = { glDeleteVertexArrays__sig: 'vii', glDeleteVertexArrays: function(n, vaos) { #if LEGACY_GL_EMULATION - if (GL.vaoExt == null) { - _emulGlDeleteVertexArrays(n, vaos); - return; - } -#else -#if GL_ASSERTIONS + _emulGlDeleteVertexArrays(n, vaos); +#else +#if GL_ASSERTIONS assert(GL.vaoExt, 'Must have OES_vertex_array_object to use vao'); -#endif #endif - for(var i = 0; i < n; i++) { var id = {{{ makeGetValue('vaos', 'i*4', 'i32') }}}; GL.vaoExt.deleteVertexArrayOES(GL.vaos[id]); GL.vaos[id] = null; } +#endif }, #if LEGACY_GL_EMULATION @@ -1854,17 +1847,14 @@ var LibraryGL = { glBindVertexArray__sig: 'vi', glBindVertexArray: function(vao) { #if LEGACY_GL_EMULATION - if (GL.vaoExt == null) { - _emulGlBindVertexArray(vao); - return; - } -#else + _emulGlBindVertexArray(vao); +#else #if GL_ASSERTIONS - assert(GL.vaoExt, 'Must have OES_vertex_array_object to use vao'); -#endif + assert(GL.vaoExt, 'Must have OES_vertex_array_object to use vao'); #endif GL.vaoExt.bindVertexArrayOES(GL.vaos[vao]); +#endif }, #if LEGACY_GL_EMULATION @@ -1873,18 +1863,16 @@ var LibraryGL = { glIsVertexArray__sig: 'ii', glIsVertexArray: function(array) { #if LEGACY_GL_EMULATION - if (GL.vaoExt == null) { - return _emulGlIsVertexArray(array); - } -#else + return _emulGlIsVertexArray(array); +#else #if GL_ASSERTIONS - assert(GL.vaoExt, 'Must have OES_vertex_array_object to use vao'); + assert(GL.vaoExt, 'Must have OES_vertex_array_object to use vao'); #endif -#endif var vao = GL.vaos[array]; if (!vao) return 0; return GL.vaoExt.isVertexArrayOES(vao); +#endif }, #if LEGACY_GL_EMULATION diff --git a/src/library_memfs.js b/src/library_memfs.js index d3148d8b..95c3ae65 100644 --- a/src/library_memfs.js +++ b/src/library_memfs.js @@ -8,7 +8,7 @@ mergeInto(LibraryManager.library, { CONTENT_FLEXIBLE: 2, // has been modified or never set to anything, and is a flexible js array that can grow/shrink CONTENT_FIXED: 3, // contains some fixed-size content written into it, in a typed array mount: function(mount) { - return MEMFS.createNode(null, '/', {{{ cDefine('S_IFDIR') }}} | 0777, 0); + return MEMFS.createNode(null, '/', {{{ cDefine('S_IFDIR') }}} | 511 /* 0777 */, 0); }, createNode: function(parent, name, mode, dev) { if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { @@ -23,7 +23,6 @@ mergeInto(LibraryManager.library, { setattr: MEMFS.node_ops.setattr, lookup: MEMFS.node_ops.lookup, mknod: MEMFS.node_ops.mknod, - mknod: MEMFS.node_ops.mknod, rename: MEMFS.node_ops.rename, unlink: MEMFS.node_ops.unlink, rmdir: MEMFS.node_ops.rmdir, @@ -185,7 +184,7 @@ mergeInto(LibraryManager.library, { return entries; }, symlink: function(parent, newname, oldpath) { - var node = MEMFS.createNode(parent, newname, 0777 | {{{ cDefine('S_IFLNK') }}}, 0); + var node = MEMFS.createNode(parent, newname, 511 /* 0777 */ | {{{ cDefine('S_IFLNK') }}}, 0); node.link = oldpath; return node; }, diff --git a/src/library_sockfs.js b/src/library_sockfs.js index 2028d841..22fd8761 100644 --- a/src/library_sockfs.js +++ b/src/library_sockfs.js @@ -3,7 +3,7 @@ mergeInto(LibraryManager.library, { $SOCKFS__deps: ['$FS', 'mkport'], $SOCKFS: { mount: function(mount) { - return FS.createNode(null, '/', {{{ cDefine('S_IFDIR') }}} | 0777, 0); + return FS.createNode(null, '/', {{{ cDefine('S_IFDIR') }}} | 511 /* 0777 */, 0); }, createSocket: function(family, type, protocol) { var streaming = type == {{{ cDefine('SOCK_STREAM') }}}; diff --git a/src/postamble.js b/src/postamble.js index 382d3117..bb1e334c 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -2,19 +2,21 @@ // === Auto-generated postamble setup entry stuff === if (memoryInitializer) { - function applyData(data) { + if (ENVIRONMENT_IS_NODE || ENVIRONMENT_IS_SHELL) { + var data = Module['readBinary'](memoryInitializer); #if USE_TYPED_ARRAYS == 2 HEAPU8.set(data, STATIC_BASE); #else allocate(data, 'i8', ALLOC_NONE, STATIC_BASE); #endif - } - if (ENVIRONMENT_IS_NODE || ENVIRONMENT_IS_SHELL) { - applyData(Module['readBinary'](memoryInitializer)); } else { addRunDependency('memory initializer'); Browser.asyncLoad(memoryInitializer, function(data) { - applyData(data); +#if USE_TYPED_ARRAYS == 2 + HEAPU8.set(data, STATIC_BASE); +#else + allocate(data, 'i8', ALLOC_NONE, STATIC_BASE); +#endif removeRunDependency('memory initializer'); }, function(data) { throw 'could not load memory initializer ' + memoryInitializer; diff --git a/src/preamble.js b/src/preamble.js index 1c9de066..27a98422 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -683,6 +683,130 @@ function stringToUTF32(str, outPtr) { Module['stringToUTF32'] = stringToUTF32; function demangle(func) { + var i = 3; + // params, etc. + var basicTypes = { + 'v': 'void', + 'b': 'bool', + 'c': 'char', + 's': 'short', + 'i': 'int', + 'l': 'long', + 'f': 'float', + 'd': 'double', + 'w': 'wchar_t', + 'a': 'signed char', + 'h': 'unsigned char', + 't': 'unsigned short', + 'j': 'unsigned int', + 'm': 'unsigned long', + 'x': 'long long', + 'y': 'unsigned long long', + 'z': '...' + }; + var subs = []; + var first = true; + function dump(x) { + //return; + if (x) Module.print(x); + Module.print(func); + var pre = ''; + for (var a = 0; a < i; a++) pre += ' '; + Module.print (pre + '^'); + } + function parseNested() { + i++; + if (func[i] === 'K') i++; // ignore const + var parts = []; + while (func[i] !== 'E') { + if (func[i] === 'S') { // substitution + i++; + var next = func.indexOf('_', i); + var num = func.substring(i, next) || 0; + parts.push(subs[num] || '?'); + i = next+1; + continue; + } + if (func[i] === 'C') { // constructor + parts.push(parts[parts.length-1]); + i += 2; + continue; + } + var size = parseInt(func.substr(i)); + var pre = size.toString().length; + if (!size || !pre) { i--; break; } // counter i++ below us + var curr = func.substr(i + pre, size); + parts.push(curr); + subs.push(curr); + i += pre + size; + } + i++; // skip E + return parts; + } + function parse(rawList, limit, allowVoid) { // main parser + limit = limit || Infinity; + var ret = '', list = []; + function flushList() { + return '(' + list.join(', ') + ')'; + } + var name; + if (func[i] === 'N') { + // namespaced N-E + name = parseNested().join('::'); + limit--; + if (limit === 0) return rawList ? [name] : name; + } else { + // not namespaced + if (func[i] === 'K' || (first && func[i] === 'L')) i++; // ignore const and first 'L' + var size = parseInt(func.substr(i)); + if (size) { + var pre = size.toString().length; + name = func.substr(i + pre, size); + i += pre + size; + } + } + first = false; + if (func[i] === 'I') { + i++; + var iList = parse(true); + var iRet = parse(true, 1, true); + ret += iRet[0] + ' ' + name + '<' + iList.join(', ') + '>'; + } else { + ret = name; + } + paramLoop: while (i < func.length && limit-- > 0) { + //dump('paramLoop'); + var c = func[i++]; + if (c in basicTypes) { + list.push(basicTypes[c]); + } else { + switch (c) { + case 'P': list.push(parse(true, 1, true)[0] + '*'); break; // pointer + case 'R': list.push(parse(true, 1, true)[0] + '&'); break; // reference + case 'L': { // literal + i++; // skip basic type + var end = func.indexOf('E', i); + var size = end - i; + list.push(func.substr(i, size)); + i += size + 2; // size + 'EE' + break; + } + case 'A': { // array + var size = parseInt(func.substr(i)); + i += size.toString().length; + if (func[i] !== '_') throw '?'; + i++; // skip _ + list.push(parse(true, 1, true)[0] + ' [' + size + ']'); + break; + } + case 'E': break paramLoop; + default: ret += '?' + c; break paramLoop; + } + } + } + if (!allowVoid && list.length === 1 && list[0] === 'void') list = []; // avoid (void) + return rawList ? list : ret + flushList(); + } try { // Special-case the entry point, since its name differs from other name mangling. if (func == 'Object._main' || func == '_main') { @@ -696,130 +820,6 @@ function demangle(func) { case 'n': return 'operator new()'; case 'd': return 'operator delete()'; } - var i = 3; - // params, etc. - var basicTypes = { - 'v': 'void', - 'b': 'bool', - 'c': 'char', - 's': 'short', - 'i': 'int', - 'l': 'long', - 'f': 'float', - 'd': 'double', - 'w': 'wchar_t', - 'a': 'signed char', - 'h': 'unsigned char', - 't': 'unsigned short', - 'j': 'unsigned int', - 'm': 'unsigned long', - 'x': 'long long', - 'y': 'unsigned long long', - 'z': '...' - }; - function dump(x) { - //return; - if (x) Module.print(x); - Module.print(func); - var pre = ''; - for (var a = 0; a < i; a++) pre += ' '; - Module.print (pre + '^'); - } - var subs = []; - function parseNested() { - i++; - if (func[i] === 'K') i++; // ignore const - var parts = []; - while (func[i] !== 'E') { - if (func[i] === 'S') { // substitution - i++; - var next = func.indexOf('_', i); - var num = func.substring(i, next) || 0; - parts.push(subs[num] || '?'); - i = next+1; - continue; - } - if (func[i] === 'C') { // constructor - parts.push(parts[parts.length-1]); - i += 2; - continue; - } - var size = parseInt(func.substr(i)); - var pre = size.toString().length; - if (!size || !pre) { i--; break; } // counter i++ below us - var curr = func.substr(i + pre, size); - parts.push(curr); - subs.push(curr); - i += pre + size; - } - i++; // skip E - return parts; - } - var first = true; - function parse(rawList, limit, allowVoid) { // main parser - limit = limit || Infinity; - var ret = '', list = []; - function flushList() { - return '(' + list.join(', ') + ')'; - } - var name; - if (func[i] === 'N') { - // namespaced N-E - name = parseNested().join('::'); - limit--; - if (limit === 0) return rawList ? [name] : name; - } else { - // not namespaced - if (func[i] === 'K' || (first && func[i] === 'L')) i++; // ignore const and first 'L' - var size = parseInt(func.substr(i)); - if (size) { - var pre = size.toString().length; - name = func.substr(i + pre, size); - i += pre + size; - } - } - first = false; - if (func[i] === 'I') { - i++; - var iList = parse(true); - var iRet = parse(true, 1, true); - ret += iRet[0] + ' ' + name + '<' + iList.join(', ') + '>'; - } else { - ret = name; - } - paramLoop: while (i < func.length && limit-- > 0) { - //dump('paramLoop'); - var c = func[i++]; - if (c in basicTypes) { - list.push(basicTypes[c]); - } else { - switch (c) { - case 'P': list.push(parse(true, 1, true)[0] + '*'); break; // pointer - case 'R': list.push(parse(true, 1, true)[0] + '&'); break; // reference - case 'L': { // literal - i++; // skip basic type - var end = func.indexOf('E', i); - var size = end - i; - list.push(func.substr(i, size)); - i += size + 2; // size + 'EE' - break; - } - case 'A': { // array - var size = parseInt(func.substr(i)); - i += size.toString().length; - if (func[i] !== '_') throw '?'; - i++; // skip _ - list.push(parse(true, 1, true)[0] + ' [' + size + ']'); - break; - } - case 'E': break paramLoop; - default: ret += '?' + c; break paramLoop; - } - } - } - if (!allowVoid && list.length === 1 && list[0] === 'void') list = []; // avoid (void) - return rawList ? list : ret + flushList(); - } return parse(); } catch(e) { return func; diff --git a/tests/cases/ptrtoint_blockaddr.ll b/tests/cases/ptrtoint_blockaddr.ll index 68b29300..6adc2c5b 100644 --- a/tests/cases/ptrtoint_blockaddr.ll +++ b/tests/cases/ptrtoint_blockaddr.ll @@ -1,8 +1,12 @@ +; ModuleID = 'tests/hello_world.bc' +target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32" +target triple = "le32-unknown-nacl" + @.str = private constant [15 x i8] c"hello, world!\0A\00", align 1 ; [#uses=1] -define linkonce_odr i32* @main() align 2 { - %199 = trunc i8 1 to i1 ; [#uses=1] - br i1 %199, label %label555, label %label569 +define linkonce_odr i32 @main() align 2 { + %a199 = trunc i8 1 to i1 ; [#uses=1] + br i1 %a199, label %label555, label %label569 label555: ; preds = %353 br label %label569 @@ -10,9 +14,9 @@ label555: ; preds = %353 br label %label569 label569: ; preds = %555 - %333 = call i32 @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) ; [#uses=0] + %a333 = call i32 @printf(i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0)) ; [#uses=0] ; this should compile ok - store i32 ptrtoint (i8* blockaddress(@main, %label569) to i32), i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0), align 8 + store i32 ptrtoint (i8* blockaddress(@main, %label569) to i32), i32* bitcast (i8* getelementptr inbounds ([15 x i8]* @.str, i32 0, i32 0) to i32*), align 8 ret i32 0 } diff --git a/tests/fuzz/18.cpp b/tests/fuzz/18.cpp new file mode 100644 index 00000000..b27aac1b --- /dev/null +++ b/tests/fuzz/18.cpp @@ -0,0 +1,1125 @@ +/* + * This is a RANDOMLY GENERATED PROGRAM. + * + * Generator: csmith 2.2.0 + * Git version: bf42ffd + * Options: --no-volatiles --no-packed-struct --lang-cpp + * Seed: 2604553870 + */ + +#include "csmith.h" + + +static long __undefined; + +/* --- Struct/Union Declarations --- */ +struct S0 { + unsigned f0 : 21; + uint8_t f1; + const unsigned f2 : 30; + unsigned f3 : 8; + signed f4 : 13; + unsigned f5 : 5; + unsigned f6 : 18; + unsigned f7 : 3; +}; + +struct S1 { + const int32_t f0; + unsigned f1 : 9; + unsigned f2 : 16; +}; + +struct S2 { + int32_t f0; + int64_t f1; +}; + +/* --- GLOBAL VARIABLES --- */ +static int32_t g_2 = 9L; +static int16_t g_27 = 0x03BEL; +static int16_t g_38 = 6L; +static int16_t *g_37[8][8] = {{&g_38,NULL,&g_38,&g_38,NULL,&g_38,&g_38,&g_38},{&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,NULL,&g_38},{&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38},{&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38},{&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38},{&g_38,NULL,&g_38,&g_38,NULL,&g_38,&g_38,&g_38},{&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38},{&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38,&g_38}}; +static int32_t g_62 = 0x3DA513E6L; +static int32_t *g_61 = &g_62; +static uint16_t g_68 = 0xCE71L; +static uint8_t g_78 = 0x1DL; +static uint32_t g_114 = 0x200BAF9CL; +static struct S2 g_121 = {0x5C255F5DL,-10L}; +static uint64_t g_159 = 0UL; +static uint16_t g_161 = 0x490DL; +static uint8_t g_184 = 8UL; +static uint32_t g_187 = 0x30F3DA43L; +static int32_t g_202 = 0x4816DB70L; +static uint64_t g_203 = 18446744073709551615UL; +static struct S1 g_208 = {0xB9C60537L,10,69}; +static uint32_t g_215 = 0x25330C45L; +static int32_t g_239 = 9L; +static int8_t g_240 = 3L; +static int16_t g_241[4] = {0xD26EL,0xD26EL,0xD26EL,0xD26EL}; +static int64_t g_242 = 7L; +static uint16_t g_244[3] = {65534UL,65534UL,65534UL}; +static struct S2 g_291[4][6] = {{{0L,0x2B7545660DAF5139LL},{-3L,0L},{0L,0x2B7545660DAF5139LL},{-3L,0L},{0L,0x2B7545660DAF5139LL},{-3L,0L}},{{0x468E1691L,0x9955880D6DFFD78ALL},{-3L,0L},{0x468E1691L,0x9955880D6DFFD78ALL},{-3L,0L},{0x468E1691L,0x9955880D6DFFD78ALL},{-3L,0L}},{{0L,0x2B7545660DAF5139LL},{-3L,0L},{0L,0x2B7545660DAF5139LL},{-3L,0L},{0L,0x2B7545660DAF5139LL},{-3L,0L}},{{0x468E1691L,0x9955880D6DFFD78ALL},{-3L,0L},{0x468E1691L,0x9955880D6DFFD78ALL},{-3L,0L},{0x468E1691L,0x9955880D6DFFD78ALL},{-3L,0L}}}; +static uint64_t g_323 = 1UL; +static int64_t *g_379 = &g_242; +static int64_t **g_378[4] = {&g_379,&g_379,&g_379,&g_379}; +static const int32_t *g_385 = &g_291[0][1].f0; +static int32_t g_386[4] = {0L,0L,0L,0L}; +static struct S0 g_408 = {1391,0xFDL,15322,15,20,0,166,1}; +static struct S0 * const g_414 = &g_408; +static struct S0 * const *g_413[3][5] = {{NULL,NULL,&g_414,NULL,NULL},{&g_414,NULL,&g_414,&g_414,NULL},{NULL,&g_414,&g_414,NULL,&g_414}}; +static int32_t g_467 = 0x3F4F500CL; +static uint32_t g_468 = 3UL; +static int32_t g_476 = (-7L); +static uint8_t *g_553 = &g_184; +static uint8_t **g_552[9][3] = {{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553},{&g_553,&g_553,&g_553}}; +static int64_t * const **g_561 = NULL; +static int64_t g_565 = 0L; +static uint16_t *g_569 = &g_68; +static uint16_t * const *g_568 = &g_569; +static struct S2 *g_589 = &g_291[0][1]; +static struct S0 g_605 = {1424,0xCBL,22754,10,-53,2,290,0}; +static int8_t g_706 = 8L; +static uint32_t *g_708 = &g_114; +static uint32_t **g_707 = &g_708; +static uint64_t g_721 = 0xC18F15E9DB4D38A5LL; +static uint32_t g_732[5] = {4UL,4UL,4UL,4UL,4UL}; + + +/* --- FORWARD DECLARATIONS --- */ +static uint16_t func_1(void); +static struct S1 func_11(uint64_t p_12, struct S0 p_13, int32_t p_14, int32_t p_15); +static int8_t func_18(int16_t p_19, struct S0 p_20, const struct S0 p_21, uint8_t p_22); +static struct S0 func_24(const int16_t p_25); +static const struct S0 func_32(int16_t * p_33, int16_t * p_34, int16_t * p_35, uint32_t p_36); +static int16_t * func_39(int16_t * p_40, struct S2 p_41, const int16_t p_42); +static struct S2 func_43(uint64_t p_44, int8_t p_45, int64_t p_46, const int16_t * p_47, int32_t p_48); +static uint64_t func_49(int16_t * p_50, int16_t * p_51, uint8_t p_52); +static int16_t * func_53(uint8_t p_54); +static const int32_t * func_63(uint16_t p_64, uint32_t p_65); + + +/* --- FUNCTIONS --- */ +/* ------------------------------------------ */ +/* + * reads : g_2 g_37 g_38 g_68 g_62 g_78 g_61 g_114 g_121 g_159 g_187 g_203 g_215 g_161 g_244 g_202 g_241 g_242 g_208 g_323 g_378 g_291.f0 g_386 g_385 g_184 g_413 g_379 g_240 g_569 g_408.f1 g_565 g_706 g_707 g_568 g_467 g_721 g_732 g_408.f0 g_708 g_476 g_589 g_291 + * writes: g_2 g_27 g_61 g_68 g_78 g_62 g_114 g_38 g_121.f1 g_121.f0 g_159 g_161 g_187 g_203 g_215 g_244 g_184 g_242 g_291 g_323 g_378 g_385 g_413 g_240 g_552 g_589 g_467 g_241 g_721 g_732 g_476 g_706 + */ +static uint16_t func_1(void) +{ /* block id: 0 */ + int32_t l_23 = 0x5ECCE35AL; + int16_t *l_55 = &g_38; + const int32_t l_409 = (-1L); + int8_t l_740[6]; + struct S0 l_770[6][4] = {{{194,0x1EL,26558,5,45,3,258,0},{560,246UL,5062,13,1,2,403,1},{194,0x1EL,26558,5,45,3,258,0},{194,0x1EL,26558,5,45,3,258,0}},{{560,246UL,5062,13,1,2,403,1},{560,246UL,5062,13,1,2,403,1},{426,7UL,3307,9,-84,3,210,1},{560,246UL,5062,13,1,2,403,1}},{{560,246UL,5062,13,1,2,403,1},{194,0x1EL,26558,5,45,3,258,0},{194,0x1EL,26558,5,45,3,258,0},{560,246UL,5062,13,1,2,403,1}},{{194,0x1EL,26558,5,45,3,258,0},{560,246UL,5062,13,1,2,403,1},{194,0x1EL,26558,5,45,3,258,0},{194,0x1EL,26558,5,45,3,258,0}},{{560,246UL,5062,13,1,2,403,1},{560,246UL,5062,13,1,2,403,1},{426,7UL,3307,9,-84,3,210,1},{560,246UL,5062,13,1,2,403,1}},{{560,246UL,5062,13,1,2,403,1},{194,0x1EL,26558,5,45,3,258,0},{194,0x1EL,26558,5,45,3,258,0},{560,246UL,5062,13,1,2,403,1}}}; + int i, j; + for (i = 0; i < 6; i++) + l_740[i] = 0L; + for (g_2 = 0; (g_2 >= (-27)); g_2--) + { /* block id: 3 */ + int16_t *l_26 = &g_27; + int32_t l_738[1][3]; + int32_t *l_792[9][5]; + int i, j; + for (i = 0; i < 1; i++) + { + for (j = 0; j < 3; j++) + l_738[i][j] = 0x140016D3L; + } + for (i = 0; i < 9; i++) + { + for (j = 0; j < 5; j++) + l_792[i][j] = &g_291[0][1].f0; + } + l_23 = (safe_mod_func_int32_t_s_s((safe_rshift_func_int16_t_s_s((safe_div_func_int16_t_s_s((0xFDEB7727L != (func_11((safe_mul_func_int8_t_s_s(func_18(l_23, func_24(((*l_26) = 1L)), func_32(g_37[1][3], l_26, func_39(&g_38, func_43(func_49(func_53((NULL != l_55)), &g_38, g_38), g_386[0], l_23, &g_241[2], l_23), l_409), l_738[0][1]), l_740[4]), g_386[2])), l_770[4][1], l_770[4][1].f2, l_738[0][1]) , (*g_385))), l_738[0][1])), l_738[0][0])), l_770[4][1].f0)); + } + return l_740[0]; +} + + +/* ------------------------------------------ */ +/* + * reads : g_589 g_291 g_467 g_208 + * writes: g_291 g_467 + */ +static struct S1 func_11(uint64_t p_12, struct S0 p_13, int32_t p_14, int32_t p_15) +{ /* block id: 356 */ + int32_t *l_774 = NULL; + int32_t *l_775 = &g_386[3]; + int32_t l_776 = (-4L); + int32_t *l_777 = &g_476; + int32_t *l_778 = &g_386[3]; + int32_t *l_779 = &g_291[0][1].f0; + int32_t *l_780 = &g_467; + int32_t *l_781 = &g_121.f0; + int32_t *l_782 = NULL; + int32_t *l_783 = NULL; + int32_t *l_784 = &g_121.f0; + int32_t *l_785 = &l_776; + int32_t *l_786 = &g_386[3]; + int32_t *l_787 = &g_476; + int32_t *l_788[5]; + uint32_t l_789 = 4294967295UL; + int i; + for (i = 0; i < 5; i++) + l_788[i] = &g_467; + (*g_589) = (*g_589); + for (g_467 = (-24); (g_467 >= (-17)); g_467 = safe_add_func_int16_t_s_s(g_467, 2)) + { /* block id: 360 */ + struct S2 l_773 = {7L,0L}; + (*g_589) = l_773; + } + l_789--; + return g_208; +} + + +/* ------------------------------------------ */ +/* + * reads : g_408.f0 g_708 g_114 g_467 g_476 g_408.f1 g_61 g_386 + * writes: g_476 g_240 g_706 g_62 g_61 + */ +static int8_t func_18(int16_t p_19, struct S0 p_20, const struct S0 p_21, uint8_t p_22) +{ /* block id: 344 */ + int16_t l_743[9] = {(-1L),(-1L),(-1L),(-1L),(-1L),(-1L),(-1L),(-1L),(-1L)}; + int32_t l_752 = (-4L); + int32_t *l_753 = &g_476; + struct S2 **l_758 = &g_589; + int8_t *l_759 = NULL; + int8_t *l_760 = &g_240; + int8_t *l_761 = NULL; + int8_t *l_762 = &g_706; + int32_t l_763[5][9] = {{0x84E88DC3L,0x30E877D1L,0x84E88DC3L,0x128A5967L,0x128A5967L,0x84E88DC3L,0x30E877D1L,0x84E88DC3L,0x128A5967L},{0x84E88DC3L,0x128A5967L,0x128A5967L,0x84E88DC3L,0x30E877D1L,0x84E88DC3L,0x128A5967L,0x128A5967L,0x84E88DC3L},{0x8A917A69L,0x128A5967L,0L,0x128A5967L,0x8A917A69L,0x8A917A69L,0x128A5967L,0L,0x128A5967L},{0x128A5967L,0x30E877D1L,0L,0L,0x30E877D1L,0x128A5967L,0x30E877D1L,0L,0L},{0x8A917A69L,0x8A917A69L,0x128A5967L,0L,0x128A5967L,0x8A917A69L,0x8A917A69L,0x128A5967L,0L}}; + int32_t *l_764 = &g_62; + uint32_t *l_765[3]; + uint16_t l_766 = 0xF503L; + int32_t **l_769 = &g_61; + int i, j; + for (i = 0; i < 3; i++) + l_765[i] = &g_187; + (*l_764) = (l_763[4][6] = (((safe_add_func_uint16_t_u_u(l_743[0], (!((l_743[6] > ((safe_div_func_uint64_t_u_u((safe_add_func_uint32_t_u_u(l_743[8], (((*l_762) = ((*l_760) = ((safe_lshift_func_int16_t_s_u(((p_21.f3 < (safe_mod_func_int64_t_s_s(((((*l_753) = (l_752 = p_20.f1)) <= (safe_div_func_int8_t_s_s((safe_mod_func_int16_t_s_s(0xB8ECL, (p_20.f2 | ((((g_408.f0 , ((((p_21.f2 , p_21.f0) != (*g_708)) != 0x4E7498EBL) , l_758)) == NULL) , 0L) , 0xBFE5L)))), 0x90L))) != 0xE0L), g_467))) , (*l_753)), 14)) && 65535UL))) & g_408.f1))), 1L)) < l_743[0])) ^ p_20.f2)))) ^ 0L) >= l_743[0])); + (*l_769) = &g_386[2]; + return (**l_769); +} + + +/* ------------------------------------------ */ +/* + * reads : + * writes: + */ +static struct S0 func_24(const int16_t p_25) +{ /* block id: 5 */ + uint8_t l_28 = 1UL; + struct S0 l_31 = {1310,250UL,6302,7,41,3,97,1}; + --l_28; + return l_31; +} + + +/* ------------------------------------------ */ +/* + * reads : + * writes: + */ +static const struct S0 func_32(int16_t * p_33, int16_t * p_34, int16_t * p_35, uint32_t p_36) +{ /* block id: 342 */ + const struct S0 l_739[6][2] = {{{320,0x7AL,32637,2,-27,2,378,0},{320,0x7AL,32637,2,-27,2,378,0}},{{320,0x7AL,32637,2,-27,2,378,0},{320,0x7AL,32637,2,-27,2,378,0}},{{320,0x7AL,32637,2,-27,2,378,0},{320,0x7AL,32637,2,-27,2,378,0}},{{320,0x7AL,32637,2,-27,2,378,0},{320,0x7AL,32637,2,-27,2,378,0}},{{320,0x7AL,32637,2,-27,2,378,0},{320,0x7AL,32637,2,-27,2,378,0}},{{320,0x7AL,32637,2,-27,2,378,0},{320,0x7AL,32637,2,-27,2,378,0}}}; + int i, j; + return l_739[2][1]; +} + + +/* ------------------------------------------ */ +/* + * reads : g_385 g_62 g_2 g_68 g_184 g_413 g_244 g_208.f0 g_121.f0 g_61 g_114 g_379 g_240 g_291.f0 g_569 g_242 g_121.f1 g_408.f1 g_38 g_241 g_565 g_706 g_707 g_568 g_467 g_721 g_732 + * writes: g_68 g_61 g_184 g_413 g_78 g_121.f0 g_242 g_240 g_215 g_38 g_244 g_552 g_589 g_467 g_241 g_721 g_732 + */ +static int16_t * func_39(int16_t * p_40, struct S2 p_41, const int16_t p_42) +{ /* block id: 206 */ + struct S0 *l_412 = &g_408; + struct S0 ** const l_411 = &l_412; + int32_t l_433 = 0x4FB4C694L; + struct S2 l_438 = {-10L,1L}; + int32_t l_485 = 0x47EB926BL; + int32_t l_489 = (-5L); + int32_t l_491 = (-5L); + int32_t l_497[1][2][7] = {{{1L,0x49C8437AL,0x027D64C9L,0x027D64C9L,0x49C8437AL,1L,0x49C8437AL},{0L,1L,1L,0L,0x49C8437AL,0L,1L}}}; + int16_t l_566 = (-6L); + int64_t **l_571 = &g_379; + uint8_t *l_616 = &g_78; + const struct S1 l_690 = {8L,21,198}; + struct S2 *l_701[10][4]; + uint64_t *l_704 = &g_159; + uint64_t **l_703 = &l_704; + uint32_t l_715 = 0x9F38D7D3L; + int32_t l_718 = 0x12E69001L; + int8_t l_719 = 0xD2L; + int32_t *l_724 = &g_121.f0; + int32_t *l_725 = &g_476; + int32_t *l_726[4][7] = {{&g_291[0][1].f0,&l_497[0][0][3],&l_497[0][0][3],&g_291[0][1].f0,&l_497[0][0][3],&l_497[0][0][3],&g_291[0][1].f0},{&g_476,&l_497[0][0][3],&g_476,&g_386[0],&l_491,&g_386[0],&g_476},{&g_291[0][1].f0,&g_291[0][1].f0,&l_485,&g_291[0][1].f0,&g_291[0][1].f0,&l_485,&g_291[0][1].f0},{&l_491,&g_386[0],&g_476,&l_497[0][0][3],&g_476,&g_386[0],&l_491}}; + int8_t l_727 = 0x0FL; + int32_t l_728 = 0x918BB4DCL; + int8_t l_729 = (-1L); + int64_t l_730 = 0x057B8866389C3D9ALL; + int32_t l_731 = 0x218CCC61L; + uint32_t l_735[3][8] = {{4UL,0xC3126DF4L,4294967288UL,0x0F3DCF02L,4294967295UL,0x220CCB51L,4294967295UL,0x0F3DCF02L},{0x3C85B5A0L,0x3828014FL,0x3C85B5A0L,0xAB1F2D4FL,0x0F3DCF02L,0x220CCB51L,4294967288UL,4294967288UL},{4294967288UL,0xC3126DF4L,4UL,4UL,0xC3126DF4L,4294967288UL,0x0F3DCF02L,4294967295UL}}; + int i, j, k; + for (i = 0; i < 10; i++) + { + for (j = 0; j < 4; j++) + l_701[i][j] = &g_121; + } |