LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]plasma/src/palette_plasma.c
// Function: DrawFrame
void DrawFrame(double elapsedTimeInMs) {
    int paletteShift = (int)(elapsedTimeInMs / 32.0);

    for (int y = 0; y < height; y++) {
        for (int x = 0; x < width; x++) {
            int index = Get1DArrayIndex(x, y, width);

            pixelBuffer[index] =
                palette[(plasmaBuffer[index] + paletteShift) % PALETTE_SIZE];
        }
    }
}

// Assembly:
movl 0x28c8(%rip), %r9d      # 0x4124
testl %r9d, %r9d
jle 0x18cd
mulsd 0x7e7(%rip), %xmm0      # 0x2050
cvttsd2si %xmm0, %eax
movq 0x28ec(%rip), %rcx      # 0x4160
movq 0x28dd(%rip), %rdx      # 0x4158
xorl %esi, %esi
movl 0x289c(%rip), %r8d      # 0x4120
leaq 0x2905(%rip), %rdi      # 0x4190
testl %r8d, %r8d
jle 0x18c6
xorl %r9d, %r9d
imull %esi, %r8d
movslq %r8d, %r8
addq %r9, %r8
movl (%rcx,%r8,4), %r10d
addl %eax, %r10d
movzbl %r10b, %r10d
movl (%rdi,%r10,4), %r10d
movl %r10d, (%rdx,%r8,4)
movl 0x2869(%rip), %r8d      # 0x4120
incq %r9
cmpl %r8d, %r9d
jl 0x1893
movl 0x285e(%rip), %r9d      # 0x4124
incl %esi
cmpl %r9d, %esi
jl 0x188b
retq
// File: /workspace/github_c_makefile_star2_O3/adelciotto[P]plasma/src/palette_plasma.c
// Function: DestroySDL
void DestroySDL(void) {
    SDL_DestroyTexture(texture);
    SDL_DestroyRenderer(renderer);
    SDL_DestroyWindow(window);
    SDL_Quit();
}

// Assembly:
pushq %rax
movq 0x287a(%rip), %rdi      # 0x4150
callq 0x1100
movq 0x2866(%rip), %rdi      # 0x4148
callq 0x10c0
movq 0x2852(%rip), %rdi      # 0x4140
callq 0x1030
popq %rax
jmp 0x1070
// File: /workspace/github_c_makefile_star2_O3/OhYee[P]computer_application_programming_experiment/hash_search/bf_search/bf_search.c
// Function: bg_print
void bg_print(bit_group *bg) {
    for (int i = bg->group_number - 1; i >= 0; --i) {
        unsigned int num = *(bg->bits + i);
        int          pos = group_type_size;

        for (int j = 0; j < group_type_size; ++j) {
            buf[j] = '0';
        }
        buf[group_type_size + 1] = '\0';

        while (num) {
            buf[pos--] = (num % 2) + '0';
            num /= 2;
        }

        printf("%d(%s)", i, buf);
    }
}

// Assembly:
movl 0x8(%rdi), %eax
decl %eax
js 0x3475
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %eax, %r14d
leaq 0xfb7(%rip), %r15       # 0x43b5
leaq 0x3d9b(%rip), %r12      # 0x71a0
movq (%rbx), %rax
movl (%rax,%r14,4), %eax
movaps 0xf2d(%rip), %xmm0      # 0x4340
movaps %xmm0, 0x3d96(%rip)     # 0x71b0
movaps %xmm0, 0x3d7f(%rip)     # 0x71a0
movb $0x0, 0x3d99(%rip)      # 0x71c1
testl %eax, %eax
je 0x344e
bsrl %eax, %ecx
xorl $0x1f, %ecx
movl $0x20, %edx
movl %eax, %esi
andb $0x1, %sil
orb $0x30, %sil
movb %sil, (%rdx,%r12)
decq %rdx
shrl %eax
cmpl %edx, %ecx
jne 0x3437
movq %r15, %rdi
movl %r14d, %esi
movq %r12, %rdx
xorl %eax, %eax
callq 0x1080
leaq -0x1(%r14), %rax
testq %r14, %r14
movq %rax, %r14
jg 0x3405
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/OhYee[P]computer_application_programming_experiment/hash_search/bf_search/bf_search.c
// Function: hash
unsigned long long hash(int type, char *s, unsigned long long limit) {
    unsigned long long code = 0;
    char *             ptr = s;
    int                param = 1;
    int                p = prime[8 - type];

    while (compare_char(*ptr, '\0') != 0) {
        code = (code + (param * (*ptr)));
        param = (param * p);
        ++ptr;
    }

    code = (code ^ 9999901) % limit;

    return code;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movl $0x8, %eax
subl %edi, %eax
cltq
leaq 0xf07(%rip), %rcx       # 0x4400
movl (%rcx,%rax,4), %ebp
movsbl (%rsi), %edi
xorl %esi, %esi
callq 0x23e4
testl %eax, %eax
je 0x3544
incq %r14
movl $0x1, %r12d
xorl %r15d, %r15d
movsbq -0x1(%r14), %rax
movslq %r12d, %r12
imulq %r12, %rax
addq %rax, %r15
imull %ebp, %r12d
movsbl (%r14), %edi
xorl %esi, %esi
callq 0x23e4
incq %r14
testl %eax, %eax
jne 0x3516
xorq $0x98961d, %r15         # imm = 0x98961D
jmp 0x354a
movl $0x98961d, %r15d        # imm = 0x98961D
movq %r15, %rax
xorl %edx, %edx
divq %rbx
movq %rdx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/OhYee[P]computer_application_programming_experiment/hash_search/bf_search/bf_search.c
// Function: bf_add
void bf_add(bloom_filter *bf, char *s) {
    for (int i = 0; i < bf->hash_num; ++i) {
        int code = hash(i, s, bf->bit_length);
        // set bg code-th bit to 1
        bg_set(bf->value, code);
    }
}

// Assembly:
cmpl $0x0, 0x8(%rdi)
je 0x35a5
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
xorl %ebp, %ebp
movq 0x10(%r14), %rdx
movl %ebp, %edi
movq %rbx, %rsi
callq 0x34db
movq (%r14), %rcx
movslq %eax, %rdx
movq (%rcx), %rsi
andb $0x7, %al
movl $0x1, %edi
movl %eax, %ecx
shll %cl, %edi
shrq $0x3, %rdx
orl %edi, (%rsi,%rdx,4)
incl %ebp
cmpl 0x8(%r14), %ebp
jb 0x3570
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/OhYee[P]computer_application_programming_experiment/hash_search/bf_search/bf_search.c
// Function: bf_exist
boolean bf_exist(bloom_filter *bf, char *s) {
    boolean exist = T;
    for (int i = 0; i < bf->hash_num; ++i) {
        int code = hash(i, s, bf->bit_length);
        // set bg code-th bit to 1
        if (!bg_read_file(bf->value, code)) {
            exist = F;
            break;
        }
    }
    return exist;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0xb04(%rip), %rax       # 0x40b8
movl (%rax), %ebx
cmpl $0x0, 0x8(%rdi)
je 0x35ff
movq %rsi, %r14
movq %rdi, %r15
xorl %ebp, %ebp
movq 0x10(%r15), %rdx
movl %ebp, %edi
movq %r14, %rsi
callq 0x34db
movq (%r15), %rcx
cltq
movq (%rcx), %rcx
movq %rax, %rdx
shrq $0x3, %rdx
movl (%rcx,%rdx,4), %ecx
andl $0x7, %eax
btl %eax, %ecx
jae 0x35f6
incl %ebp
cmpl 0x8(%r15), %ebp
jb 0x35c4
jmp 0x35ff
leaq 0xabf(%rip), %rax       # 0x40bc
movl (%rax), %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/antonblanchard[P]will-it-scale/tests/mmap1.c
// Function: testcase
void testcase(unsigned long long *iterations, unsigned long nr)
{
	while (1) {
		char *c = mmap(NULL, MEMSIZE, PROT_READ|PROT_WRITE,
			       MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
		assert(c != MAP_FAILED);
		munmap(c, MEMSIZE);

		(*iterations)++;
	}
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl $0x8000000, %esi        # imm = 0x8000000
xorl %edi, %edi
movl $0x3, %edx
movl $0x22, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
callq 0x20e0
cmpq $-0x1, %rax
je 0x2caf
movl $0x8000000, %esi        # imm = 0x8000000
movq %rax, %rdi
callq 0x21d0
incq (%rbx)
jmp 0x2c78
leaq 0x618(%rip), %rdi       # 0x32ce
leaq 0x621(%rip), %rsi       # 0x32de
leaq 0x628(%rip), %rcx       # 0x32ec
movl $0xf, %edx
callq 0x2120
// File: /workspace/github_c_makefile_star2_O3/jwang11[P]intel_avx_perf/matrix_int16.c
// Function: calc_avx512
void calc_avx512(void) {
  #define VLEN (512/8/sizeof(int16_t))
  const int col_aligned = col - col % VLEN;
  int16_t dst_arr[VLEN];

  __m512i op0, op1, tmp_vec;
  volatile __m512i  tgt;

  for (int i = 0; i < row; i++) {
    int sum = 0;

    tgt = _mm512_setzero_si512();
    for (int j = 0; j < col_aligned; j += VLEN) {
      op0 = _mm512_load_si512(&mutiplier[j]);
      op1 = _mm512_load_si512(&mat[i][j]);
      tmp_vec = _mm512_mullo_epi16(op0, op1);
      tgt = _mm512_add_epi16(tmp_vec, tgt);
    }

    _mm512_store_epi64(dst_arr, tgt);
    for (int k = 0; k < VLEN; k++)
      sum += dst_arr[k];

    for (int l = col_aligned; l < col; l++)
      sum += mat[i][l] * mutiplier[l];

    result[i] = sum;
  }
  #undef VLEN
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
andq $-0x40, %rsp
subq $0x80, %rsp
leaq 0x2d20(%rip), %rax      # 0x4070
xorl %ecx, %ecx
vxorps %xmm0, %xmm0, %xmm0
leaq 0x82d13(%rip), %rdx     # 0x84070
leaq 0x84d0c(%rip), %rsi     # 0x86070
vmovaps %zmm0, (%rsp)
movq $-0x20, %rdi
movq %rdx, %r8
vmovdqa64 0x40(%rax,%rdi,2), %zmm1
vpmullw (%r8), %zmm1, %zmm1
vpaddw (%rsp), %zmm1, %zmm1
vmovdqa64 %zmm1, (%rsp)
addq $0x20, %rdi
addq $0x40, %r8
cmpq $0xfe0, %rdi            # imm = 0xFE0
jb 0x1375
vmovdqa64 (%rsp), %zmm1
vextracti64x4 $0x1, %zmm1, %ymm2
vpaddw %zmm2, %zmm1, %zmm1
vextracti128 $0x1, %ymm1, %xmm2
vpaddw %xmm2, %xmm1, %xmm1
vpshufd $0xee, %xmm1, %xmm2     # xmm2 = xmm1[2,3,2,3]
vpaddw %xmm2, %xmm1, %xmm1
vpshufd $0x55, %xmm1, %xmm2     # xmm2 = xmm1[1,1,1,1]
vpaddw %xmm2, %xmm1, %xmm1
vpsrld $0x10, %xmm1, %xmm2
vpaddw %xmm2, %xmm1, %xmm1
vpextrw $0x0, %xmm1, (%rsi,%rcx,2)
incq %rcx
addq $0x2000, %rax           # imm = 0x2000
cmpq $0x40, %rcx
jne 0x1364
movq %rbp, %rsp
popq %rbp
vzeroupper
retq
// File: /workspace/github_c_makefile_star2_O3/kkanellis[P]matvec-sparse/mmio.c
// Function: mm_typecode_to_str
char  *mm_typecode_to_str(MM_typecode matcode)
{
    char buffer[MM_MAX_LINE_LENGTH];
    char *types[4];
	char *mm_strdup(const char *);

    /* check for MTX type */
    if (mm_is_matrix(matcode)) 
        types[0] = MM_MTX_STR;
    else
        return NULL;

    /* check for CRD or ARR matrix */
    if (mm_is_sparse(matcode))
        types[1] = MM_SPARSE_STR;
    else
    if (mm_is_dense(matcode))
        types[1] = MM_DENSE_STR;
    else
        return NULL;

    /* check for element data type */
    if (mm_is_real(matcode))
        types[2] = MM_REAL_STR;
    else
    if (mm_is_complex(matcode))
        types[2] = MM_COMPLEX_STR;
    else
    if (mm_is_pattern(matcode))
        types[2] = MM_PATTERN_STR;
    else
    if (mm_is_integer(matcode))
        types[2] = MM_INT_STR;
    else
        return NULL;


    /* check for symmetry type */
    if (mm_is_general(matcode))
        types[3] = MM_GENERAL_STR;
    else
    if (mm_is_symmetric(matcode))
        types[3] = MM_SYMM_STR;
    else 
    if (mm_is_hermitian(matcode))
        types[3] = MM_HERM_STR;
    else 
    if (mm_is_skew(matcode))
        types[3] = MM_SKEW_STR;
    else
        return NULL;

    sprintf(buffer,"%s %s %s %s", types[0], types[1], types[2], types[3]);
    return mm_strdup(buffer);

}

// Assembly:
cmpb $0x4d, (%rdi)
jne 0x1831
movzbl 0x1(%rdi), %eax
cmpl $0x43, %eax
je 0x1834
cmpl $0x41, %eax
jne 0x1831
leaq 0x18d8(%rip), %rcx      # 0x3107
jmp 0x183b
xorl %eax, %eax
retq
leaq 0x18c1(%rip), %rcx      # 0x30fc
movzbl 0x2(%rdi), %edx
xorl %eax, %eax
cmpl $0x4f, %edx
jg 0x185d
cmpl $0x43, %edx
je 0x1874
cmpl $0x49, %edx
jne 0x18f8
leaq 0x18c7(%rip), %r8       # 0x3122
jmp 0x1884
cmpl $0x50, %edx
je 0x187d
cmpl $0x52, %edx
jne 0x18f8
leaq 0x189b(%rip), %r8       # 0x310d
jmp 0x1884
leaq 0x1897(%rip), %r8       # 0x3112
jmp 0x1884
leaq 0x1896(%rip), %r8       # 0x311a
movzbl 0x3(%rdi), %edx
xorl %eax, %eax
cmpl $0x4a, %edx
jg 0x18a2
cmpl $0x47, %edx
je 0x18b5
cmpl $0x48, %edx
jne 0x18f8
leaq 0x1892(%rip), %r9       # 0x3132
jmp 0x18c5
cmpl $0x4b, %edx
je 0x18be
cmpl $0x53, %edx
jne 0x18f8
leaq 0x188e(%rip), %r9       # 0x3141
jmp 0x18c5
leaq 0x186e(%rip), %r9       # 0x312a
jmp 0x18c5
leaq 0x1877(%rip), %r9       # 0x313c
pushq %rbx
subq $0x410, %rsp            # imm = 0x410
leaq 0x1806(%rip), %rsi      # 0x30da
leaq 0x181a(%rip), %rdx      # 0x30f5
movq %rsp, %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1130
movq %rbx, %rdi
callq 0x1ff1
addq $0x410, %rsp            # imm = 0x410
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/kkanellis[P]matvec-sparse/mmio.c
// Function: mm_read_mtx_crd_size
int mm_read_mtx_crd_size(FILE *f, int *M, int *N, int *nz )
{
    char line[MM_MAX_LINE_LENGTH];
    int num_items_read;

    /* set return null parameter values, in case we exit with errors */
    *M = *N = *nz = 0;

    /* now continue scanning until you reach the end-of-comments */
    do 
    {
        if (fgets(line,MM_MAX_LINE_LENGTH,f) == NULL) 
            return MM_PREMATURE_EOF;
    }while (line[0] == '%');

    /* line[] is either blank or has M,N, nz */
    if (sscanf(line, "%d %d %d", M, N, nz) == 3)
        return 0;
        
    else
    do
    { 
        num_items_read = fscanf(f, "%d %d %d", M, N, nz); 
        if (num_items_read == EOF) return MM_PREMATURE_EOF;
    }
    while (num_items_read != 3);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
xorl %eax, %eax
movl %eax, (%rcx)
movl %eax, (%rdx)
movl %eax, (%rsi)
movq %rsp, %r13
movl $0xc, %ebp
movq %r13, %rdi
movl $0x401, %esi            # imm = 0x401
movq %r12, %rdx
callq 0x10c0
testq %rax, %rax
je 0x1992
cmpb $0x25, (%rsp)
je 0x1926
leaq 0x180d(%rip), %rsi      # 0x3155
xorl %ebp, %ebp
movq %rsp, %rdi
movq %r15, %rdx
movq %r14, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1110
cmpl $0x3, %eax
je 0x1992
leaq 0x17ec(%rip), %r13      # 0x3155
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r14, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x1050
cmpl $0x3, %eax
je 0x1990
cmpl $-0x1, %eax
jne 0x1969
movl $0xc, %ebp
jmp 0x1992
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/kkanellis[P]matvec-sparse/mmio.c
// Function: mm_is_valid
int mm_is_valid(MM_typecode matcode)
{
    if (!mm_is_matrix(matcode)) return 0;
    if (mm_is_dense(matcode) && mm_is_pattern(matcode)) return 0;
    if (mm_is_real(matcode) && mm_is_hermitian(matcode)) return 0;
    if (mm_is_pattern(matcode) && (mm_is_hermitian(matcode) || 
                mm_is_skew(matcode))) return 0;
    return 1;
}

// Assembly:
cmpb $0x4d, (%rdi)
jne 0x19bd
movb 0x1(%rdi), %cl
movb 0x2(%rdi), %al
xorb $0x41, %cl
movl %eax, %edx
xorb $0x50, %dl
orb %cl, %dl
jne 0x19c3
xorl %eax, %eax
movzbl %al, %eax
retq
movzbl %al, %ecx
cmpl $0x50, %ecx
je 0x19db
movb $0x1, %al
cmpl $0x52, %ecx
jne 0x19bf
cmpb $0x48, 0x3(%rdi)
setne %al
jmp 0x19bf
movb 0x3(%rdi), %al
cmpb $0x48, %al
setne %cl
cmpb $0x4b, %al
setne %al
andb %cl, %al
jmp 0x19bf
// File: /workspace/github_c_makefile_star2_O3/kkanellis[P]matvec-sparse/mmio.c
// Function: mm_read_mtx_array_size
int mm_read_mtx_array_size(FILE *f, int *M, int *N)
{
    char line[MM_MAX_LINE_LENGTH];
    int num_items_read;
    /* set return null parameter values, in case we exit with errors */
    *M = *N = 0;
	
    /* now continue scanning until you reach the end-of-comments */
    do 
    {
        if (fgets(line,MM_MAX_LINE_LENGTH,f) == NULL) 
            return MM_PREMATURE_EOF;
    }while (line[0] == '%');

    /* line[] is either blank or has M,N, nz */
    if (sscanf(line, "%d %d", M, N) == 2)
        return 0;
        
    else /* we have a blank line */
    do
    { 
        num_items_read = fscanf(f, "%d %d", M, N); 
        if (num_items_read == EOF) return MM_PREMATURE_EOF;
    }
    while (num_items_read != 2);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x410, %rsp            # imm = 0x410
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
xorl %eax, %eax
movl %eax, (%rdx)
movl %eax, (%rsi)
movq %rsp, %r12
movl $0xc, %ebp
movq %r12, %rdi
movl $0x401, %esi            # imm = 0x401
movq %r15, %rdx
callq 0x10c0
testq %rax, %rax
je 0x1a9d
cmpb $0x25, (%rsp)
je 0x1a37
leaq 0x16ff(%rip), %rsi      # 0x3158
xorl %ebp, %ebp
movq %rsp, %rdi
movq %r14, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1110
cmpl $0x2, %eax
je 0x1a9d
leaq 0x16e1(%rip), %r12      # 0x3158
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
cmpl $0x2, %eax
je 0x1a9b
cmpl $-0x1, %eax
jne 0x1a77
movl $0xc, %ebp
jmp 0x1a9d
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x410, %rsp            # imm = 0x410
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/kkanellis[P]matvec-sparse/mmio.c
// Function: mm_read_mtx_crd_data
int mm_read_mtx_crd_data(FILE *f, int M, int N, int nz, int I[], int J[],
        double val[], MM_typecode matcode)
{
    int i;
    if (mm_is_complex(matcode))
    {
        for (i=0; i<nz; i++)
            if (fscanf(f, "%d %d %lg %lg", &I[i], &J[i], &val[2*i], &val[2*i+1])
                != 4) return MM_PREMATURE_EOF;
    }
    else if (mm_is_real(matcode))
    {
        for (i=0; i<nz; i++)
        {
            if (fscanf(f, "%d %d %lg\n", &I[i], &J[i], &val[i])
                != 3) return MM_PREMATURE_EOF;

        }
    }

    else if (mm_is_pattern(matcode))
    {
        for (i=0; i<nz; i++)
            if (fscanf(f, "%d %d", &I[i], &J[i])
                != 2) return MM_PREMATURE_EOF;
    }
    else
        return MM_UNSUPPORTED_TYPE;

    return 0;
        
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movq %r8, %r14
movq %rdi, %r15
movq 0x40(%rsp), %r12
movq 0x48(%rsp), %rax
movzbl 0x2(%rax), %edx
cmpl $0x43, %edx
je 0x1b87
cmpl $0x52, %edx
je 0x1b4c
movl $0xf, %eax
cmpl $0x50, %edx
jne 0x1bce
testl %ecx, %ecx
jle 0x1bc5
movl %ecx, %r13d
leaq 0x1637(%rip), %r12      # 0x3158
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1050
cmpl $0x2, %eax
jne 0x1bc9
addq $0x4, %rbx
addq $0x4, %r14
decq %r13
jne 0x1b21
jmp 0x1bc5
testl %ecx, %ecx
jle 0x1bc5
movl %ecx, %ebp
leaq 0x1573(%rip), %r13      # 0x30cc
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %rbx, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x1050
cmpl $0x3, %eax
jne 0x1bc9
addq $0x8, %r12
addq $0x4, %rbx
addq $0x4, %r14
decq %rbp
jne 0x1b59
jmp 0x1bc5
testl %ecx, %ecx
jle 0x1bc5
movl %ecx, %ebp
leaq 0x15ca(%rip), %r13      # 0x315e
leaq 0x8(%r12), %r9
movq %r15, %rdi
movq %r13, %rsi
movq %r14, %rdx
movq %rbx, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x1050
cmpl $0x4, %eax
jne 0x1bc9
addq $0x4, %rbx
addq $0x4, %r14
addq $0x10, %r12
decq %rbp
jne 0x1b94
xorl %eax, %eax
jmp 0x1bce
movl $0xc, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/kkanellis[P]matvec-sparse/mmio.c
// Function: mm_read_mtx_crd_entry
int mm_read_mtx_crd_entry(FILE *f, int *I, int *J,
        double *real, double *imag, MM_typecode matcode)
{
    if (mm_is_complex(matcode))
    {
            if (fscanf(f, "%d %d %lg %lg", I, J, real, imag)
                != 4) return MM_PREMATURE_EOF;
    }
    else if (mm_is_real(matcode))
    {
            if (fscanf(f, "%d %d %lg\n", I, J, real)
                != 3) return MM_PREMATURE_EOF;

    }

    else if (mm_is_pattern(matcode))
    {
            if (fscanf(f, "%d %d", I, J) != 2) return MM_PREMATURE_EOF;
    }
    else
        return MM_UNSUPPORTED_TYPE;

    return 0;
        
}

// Assembly:
pushq %rax
movq %r8, %r10
movq %rcx, %r8
movq %rdx, %rcx
movq %rsi, %rdx
movzbl 0x2(%r9), %esi
cmpl $0x52, %esi
je 0x1c40
cmpl $0x50, %esi
je 0x1c22
movl $0xf, %eax
cmpl $0x43, %esi
jne 0x1c3e
leaq 0x1554(%rip), %rsi      # 0x315e
movq %r10, %r9
xorl %eax, %eax
callq 0x1050
movl %eax, %ecx
movl $0xc, %eax
cmpl $0x4, %ecx
je 0x1c3c
jmp 0x1c3e
leaq 0x152f(%rip), %rsi      # 0x3158
xorl %eax, %eax
callq 0x1050
movl %eax, %ecx
movl $0xc, %eax
cmpl $0x2, %ecx
jne 0x1c3e
xorl %eax, %eax
popq %rcx
retq
leaq 0x1485(%rip), %rsi      # 0x30cc
xorl %eax, %eax
callq 0x1050
movl %eax, %ecx
movl $0xc, %eax
cmpl $0x3, %ecx
je 0x1c3c
jmp 0x1c3e
// File: /workspace/github_c_makefile_star2_O3/kkanellis[P]matvec-sparse/mmio.c
// Function: mm_write_banner
int mm_write_banner(FILE *f, MM_typecode matcode)
{
    char *str = mm_typecode_to_str(matcode);
    int ret_code;

    ret_code = fprintf(f, "%s %s\n", MatrixMarketBanner, str);
    free(str);
    if (ret_code !=2 )
        return MM_COULD_NOT_WRITE_FILE;
    else
        return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x1815
movq %rax, %r14
leaq 0x135a(%rip), %rsi      # 0x3172
leaq 0x12c7(%rip), %rdx      # 0x30e6
xorl %ebp, %ebp
movq %rbx, %rdi
movq %rax, %rcx
xorl %eax, %eax
callq 0x10f0
movl %eax, %ebx
movq %r14, %rdi
callq 0x1030
cmpl $0x2, %ebx
movl $0x11, %eax
cmovel %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/kkanellis[P]matvec-sparse/mmio-wrapper.c
// Function: write_matrix
int write_matrix (const char *filename, const int *i_idx, const int *j_idx, const double *values, int N, int NZ)
{
    FILE* f;
    MM_typecode matcode;

    /* open the file */
    if ( (f = fopen(filename, "w")) == NULL ) {
        fprintf(stderr, "Cannot open '%s'\n", filename);
        return 1;
    }

    /* init and set proper flags for matrix */
    mm_initialize_typecode(&matcode);
    mm_set_matrix(&matcode);
    mm_set_real(&matcode);
    mm_set_sparse(&matcode);

    /* write banner and matrix size info */
    mm_write_banner(f, matcode);
    mm_write_mtx_crd_size(f, N, N, NZ);

    /* write matrix elements */
    for (int i = 0; i < NZ; i++) {
        fprintf(f, "%d %d %.9lf\n", i_idx[i] + 1, j_idx[i] + 1, values[i]);
    }

    /* close the file */
    if ( fclose(f) != 0 ) {
        fprintf(stderr, "Cannot close file (fil:'%s')\n", filename);
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, %ebp
movl %r8d, %ebx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
leaq 0xf31(%rip), %rsi       # 0x3180
movq %rdi, 0x8(%rsp)
callq 0x1120
testq %rax, %rax
je 0x22d4
movq %rax, %r13
leaq 0x14(%rsp), %rsi
movl $0x4752434d, (%rsi)     # imm = 0x4752434D
movq %rax, %rdi
callq 0x1dff
movq %r13, %rdi
movl %ebx, %esi
movl %ebx, %edx
movl %ebp, %ecx
callq 0x19ec
testl %ebp, %ebp
jle 0x22b5
movl %ebp, %ebx
xorl %ebp, %ebp
movl (%r12,%rbp,4), %edx
incl %edx
movl (%r15,%rbp,4), %ecx
incl %ecx
movsd (%r14,%rbp,8), %xmm0
movq %r13, %rdi
leaq 0xff1(%rip), %rsi       # 0x3297
movb $0x1, %al
callq 0x10f0
incq %rbp
cmpq %rbp, %rbx
jne 0x228a
movq %r13, %rdi
callq 0x1080
xorl %ebx, %ebx
testl %eax, %eax
jne 0x22f8
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2d1d(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0xec7(%rip), %rsi       # 0x31ac
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x10f0
movl $0x1, %ebx
jmp 0x22c3
movq 0x2cf9(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0xf70(%rip), %rsi       # 0x3279
xorl %ebx, %ebx
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x10f0
jmp 0x22c3
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/kkanellis[P]matvec-sparse/partition.c
// Function: partition_equal_rows
void partition_equal_rows(proc_info_t *proc_info, int nprocs, const int *row_idx)
{
    /* rows for each process */
    double row_chunk = ((double)proc_info[0].N) / nprocs; 

    int last_row, i = 0;
    for (int k = 0; k < nprocs; k++) {
        proc_info[k].nz_count = 0;
        proc_info[k].nz_start_idx = i;

        last_row = (int)((k + 1) * row_chunk - 1);

        proc_info[k].row_start_idx = (int)(k * row_chunk);
        proc_info[k].row_count = last_row - proc_info[k].row_start_idx + 1;

        while (i < proc_info[0].NZ && row_idx[i] <= last_row) {
            proc_info[k].nz_count++; 
            i++;
        }

        debug("Processor %d takes rows %3d till %3d [%3d] (entries %6d till %6d) [%6d]\n", 
                        k, 
                        proc_info[k].row_start_idx, 
                        proc_info[k].row_start_idx + proc_info[k].row_count - 1,
                        proc_info[k].row_count,
                        proc_info[k].nz_start_idx, 
                        proc_info[k].nz_start_idx + proc_info[k].nz_count - 1,
                        proc_info[k].nz_count
        );
    }
    /* add remaining elements (if any) to last task */
    proc_info[nprocs - 1].nz_count += proc_info[0].NZ - i;  
}

// Assembly:
movl 0x4(%rdi), %eax
testl %esi, %esi
jle 0x23e2
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
cvtsi2sdl (%rdi), %xmm0
cvtsi2sd %esi, %xmm1
divsd %xmm1, %xmm0
movslq %eax, %rcx
movl %esi, %r8d
xorl %r10d, %r10d
movsd 0xf5c(%rip), %xmm1      # 0x32a8
xorl %r9d, %r9d
movq %r10, %rbx
xorps %xmm2, %xmm2
cvtsi2sd %ebx, %xmm2
incq %r10
xorps %xmm3, %xmm3
cvtsi2sd %r10d, %xmm3
mulsd %xmm0, %xmm3
addsd %xmm1, %xmm3
cvttsd2si %xmm3, %r11d
leaq (%rbx,%rbx,2), %rbx
movl $0x0, 0x8(%rdi,%rbx,8)
movl %r9d, 0xc(%rdi,%rbx,8)
mulsd %xmm0, %xmm2
cvttsd2si %xmm2, %ebp
movl %ebp, 0x14(%rdi,%rbx,8)
movl %r11d, %r14d
subl %ebp, %r14d
incl %r14d
movl %r14d, 0x10(%rdi,%rbx,8)
cmpl %eax, %r9d
jge 0x23cf
leaq (%rdi,%rbx,8), %rbx
movslq %r9d, %r15
leaq (%rdx,%r15,4), %r14
movq %rcx, %r12
subq %r15, %r12
xorl %r15d, %r15d
cmpl %r11d, (%r14,%r15,4)
jg 0x23cc
incq %r15
movl %r15d, 0x8(%rbx)
cmpq %r15, %r12
jne 0x23b5
movl %eax, %r9d
jmp 0x23cf
addl %r15d, %r9d
cmpq %r8, %r10
jne 0x234f
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x23e5
xorl %r9d, %r9d
subl %r9d, %eax
movslq %esi, %rcx
leaq (%rcx,%rcx,2), %rcx
addl %eax, -0x10(%rdi,%rcx,8)
retq
// File: /workspace/github_c_makefile_star2_O3/kkanellis[P]matvec-sparse/util.c
// Function: random_vec
void random_vec (double *v, int N, int limit)
{
    /* fill v with random doubles */
    limit--;
    srand( 410 );
    for (int i = 0; i < N; i++) {
        v[i] = ((double)rand()) / (((double)RAND_MAX) / limit) + \
               ((double)rand()) / ((double)RAND_MAX);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %rbx
movl $0x19a, %edi            # imm = 0x19A
callq 0x10b0
testl %ebp, %ebp
jle 0x2577
decl %r14d
cvtsi2sd %r14d, %xmm0
movsd 0xd8c(%rip), %xmm1      # 0x32b0
divsd %xmm0, %xmm1
movl %ebp, %r14d
shufpd $0x2, 0xd8c(%rip), %xmm1 # xmm1 = xmm1[0],mem[1]
movapd %xmm1, (%rsp)
xorl %r15d, %r15d
callq 0x1160
movl %eax, %ebp
callq 0x1160
movd %ebp, %xmm0
movd %eax, %xmm1
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
cvtdq2pd %xmm0, %xmm0
divpd (%rsp), %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd %xmm1, (%rbx,%r15,8)
incq %r15
cmpq %r15, %r14
jne 0x253c
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/kkanellis[P]matvec-sparse/util.c
// Function: malloc_or_exit
void * malloc_or_exit(size_t size) {
    void * ptr = malloc( size );
    if ( !ptr ) {
        fprintf(stderr, "malloc: failed to allocate memory\n");
        exit(EXIT_FAILURE);
    }
    return ptr;
}

// Assembly:
pushq %rax
callq 0x1100
testq %rax, %rax
je 0x258f
popq %rcx
retq
callq 0x1221
// File: /workspace/github_c_makefile_star2_O3/kkanellis[P]matvec-sparse/util.c
// Function: calloc_or_exit
void * calloc_or_exit(size_t nmemb, size_t size) {
    void * ptr = calloc(nmemb, size);
    if ( !ptr ) {
        fprintf(stderr, "calloc: failed to allocate memory\n");
        exit(EXIT_FAILURE);
    }
    return ptr;
}

// Assembly:
pushq %rax
callq 0x10d0
testq %rax, %rax
je 0x25a1
popq %rcx
retq
callq 0x1246
// File: /workspace/github_c_makefile_star2_O3/kkanellis[P]matvec-sparse/stopwatch.c
// Function: _sw_stop
void __sw_stop(const int id, double * value) {
    clock_gettime(CLOCK_MONOTONIC_RAW, sw + N_STOPWATCHES);
    *value += (
        (double) ((sw[N_STOPWATCHES].tv_nsec - sw[id].tv_nsec) / 1000000.0 )+
        (double) ((sw[N_STOPWATCHES].tv_sec - sw[id].tv_sec) * 1000.0)
    );
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x2b4e(%rip), %rsi      # 0x5130
movl $0x4, %edi
callq 0x1070
leaq 0x2aed(%rip), %rax      # 0x50e0
movq 0x2b3e(%rip), %rcx      # 0x5138
movslq %ebp, %rdx
shlq $0x4, %rdx
subq 0x8(%rdx,%rax), %rcx
cvtsi2sd %rcx, %xmm0
divsd 0xd05(%rip), %xmm0      # 0x3318
movq 0x2b16(%rip), %rcx      # 0x5130
subq (%rdx,%rax), %rcx
cvtsi2sd %rcx, %xmm1
mulsd 0xcf5(%rip), %xmm1      # 0x3320
addsd %xmm0, %xmm1
addsd (%rbx), %xmm1
movsd %xmm1, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_3/exercise_3_05/itob.c
// Function: itob
void itob(int n, char s[], int b)
{
  int i = 0, sign = n;

  do
  {
    s[i++] = itoc(abs(n) % b);
    n /= b;
  } while (n);

  switch (b)
  {
  case 2:
    s[i++] = 'b';
    s[i++] = '0';
    break;

  case 16:
    s[i++] = 'x';
    s[i++] = '0';
    break;
  }

  if (sign < 0)
  {
    s[i++] = '-';
  }

  s[i] = '\0';

  int s_len = strlen(s);
  str_reverse(s, 0, s_len - 1);
}

// Assembly:
pushq %rbx
movl %edx, %ecx
movq %rsi, %rbx
xorl %r8d, %r8d
movl $0x30, %r9d
movl %edi, %esi
movl %esi, %eax
negl %eax
cmovsl %esi, %eax
cltd
idivl %ecx
cmpl $0xa, %edx
movl $0x57, %eax
cmovbl %r9d, %eax
addb %dl, %al
movb %al, (%rbx,%r8)
incq %r8
movl %esi, %eax
cltd
idivl %ecx
movl %eax, %esi
testl %eax, %eax
jne 0x1190
cmpl $0x2, %ecx
je 0x11c8
cmpl $0x10, %ecx
jne 0x11dc
movb $0x78, %al
jmp 0x11ca
movb $0x62, %al
movl %r8d, %ecx
movb %al, (%rbx,%rcx)
leal 0x2(%r8), %eax
movb $0x30, 0x1(%rbx,%r8)
jmp 0x11df
movl %r8d, %eax
testl %edi, %edi
jns 0x11ec
movslq %eax, %rcx
incl %eax
movb $0x2d, (%rbx,%rcx)
cltq
movb $0x0, (%rbx,%rax)
movq %rbx, %rdi
callq 0x1030
leal -0x1(%rax), %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
decl %ecx
sarl %ecx
movslq %eax, %rdx
movslq %ecx, %rax
incq %rax
leaq (%rdx,%rbx), %rcx
decq %rcx
xorl %edx, %edx
movb (%rbx,%rdx), %sil
movb (%rcx), %dil
movb %dil, (%rbx,%rdx)
movb %sil, (%rcx)
incq %rdx
decq %rcx
cmpq %rdx, %rax
jne 0x1218
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/ughman[P]c2c/src/main.c
// Function: main
int main(int argc,char **argv)
{
	if (SDL_Init(0) < 0)
	{
		// no logging available because init failed
		fprintf(stderr,"SDL_Init failed: %s\n",SDL_GetError());
		SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,APP_TITLE,SDL_GetError(),NULL);
		return EXIT_FAILURE;
	}
#ifdef NDEBUG
	SDL_LogSetAllPriority(SDL_LOG_PRIORITY_INFO);
#else
	SDL_LogSetAllPriority(SDL_LOG_PRIORITY_DEBUG);
#endif
	EMU_Init();
	CORE_Start();
	SDL_Quit();
	return EXIT_SUCCESS;
}

// Assembly:
pushq %rbx
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x10b0
testl %eax, %eax
js 0x1343
movl $0x2, %edi
callq 0x1040
callq 0x172019
callq 0x174ab1
callq 0x1030
movl %ebx, %eax
popq %rbx
retq
callq 0x1120
movl $0x1, %ebx
jmp 0x133f
nop
// File: /workspace/github_c_makefile_star2_O3/ughman[P]c2c/src/bios.c
// Function: BIOS_StrCat
uint32_t BIOS_StrCat(uint32_t dest,uint32_t src)
{
	uint32_t len;
	uint32_t i = 0;
	uint8_t c = 1;
	for (len = 0;EMU_ReadU8(dest + len);len++);
	while (c)
	{
		EMU_Write8(dest + len + i,c = EMU_ReadU8(src + i));
		i++;
	}
	return dest;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movl %edi, %ebx
movl %edi, %r14d
movl %r14d, %edi
callq 0x1720a7
incl %r14d
testb %al, %al
jne 0x171379
decl %r14d
movl %ebp, %edi
callq 0x1720a7
movzbl %al, %r15d
movl %r14d, %edi
movl %r15d, %esi
callq 0x172582
incl %r14d
incl %ebp
testb %r15b, %r15b
jne 0x17138b
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ughman[P]c2c/src/bios.c
// Function: BIOS_StrCmp
int32_t BIOS_StrCmp(uint32_t str1,uint32_t str2)
{
	uint32_t i = 0;
	while (1)
	{
		int8_t c1 = EMU_ReadS8(str1 + i);
		int8_t c2 = EMU_ReadS8(str2 + i);
		if (c1 != c2)
			return c1 - c2;
		else if (c1 == 0)
			return 0;
		i++;
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movl %edi, %r14d
callq 0x17209f
movl %eax, %ebp
movl %ebx, %edi
callq 0x17209f
cmpb %al, %bpl
jne 0x1713f9
incl %r14d
incl %ebx
testb %bpl, %bpl
je 0x171404
movl %r14d, %edi
callq 0x17209f
movl %eax, %ebp
movl %ebx, %edi
callq 0x17209f
incl %r14d
incl %ebx
cmpb %al, %bpl
je 0x1713d9
movsbl %bpl, %ecx
movsbl %al, %eax
subl %eax, %ecx
jmp 0x171406
xorl %ecx, %ecx
movl %ecx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ughman[P]c2c/src/bios.c
// Function: BIOS_StrNCmp
int32_t BIOS_StrNCmp(uint32_t str1,uint32_t str2,uint32_t maxlen)
{
	uint32_t i = 0;
	while (i < maxlen)
	{
		int8_t c1 = EMU_ReadS8(str1 + i);
		int8_t c2 = EMU_ReadS8(str2 + i);
		if (c1 != c2)
			return c1 - c2;
		else if (c1 == 0)
			return 0;
		i++;
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
xorl %ebx, %ebx
testl %edx, %edx
je 0x17145d
movl %edx, %ebp
movl %esi, %r14d
movl %edi, %r15d
decl %ebp
movl %r15d, %edi
callq 0x17209f
movl %eax, %r12d
movl %r14d, %edi
callq 0x17209f
cmpb %al, %r12b
jne 0x171454
subl $0x1, %ebp
setb %al
testb %r12b, %r12b
je 0x17145d
incl %r14d
incl %r15d
testb %al, %al
je 0x171425
jmp 0x17145d
movsbl %r12b, %ebx
movsbl %al, %eax
subl %eax, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ughman[P]c2c/src/bios.c
// Function: BIOS_DeliverEvent
void BIOS_DeliverEvent(uint32_t evclass,uint32_t spec)
{
	for (int i = 0;i < BIOS_MAXEVENTS;i++)
	{
		struct biosevent *event = &events[i];
		if (!event->enabled)
			continue;
		if (event->evclass != evclass)
			continue;
		if (event->spec != spec)
			continue;
		if (event->mode == 0x1000)
			EMU_Invoke(event->func,0);
		else
			event->busy = 0;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %ebp
movl $0x18, %r14d
leaq 0x9a97(%rip), %r15      # 0x17b0b0
cmpl $0x0, -0x14(%r14,%r15)
je 0x171652
cmpl %ebp, -0xc(%r14,%r15)
jne 0x171652
cmpl %ebx, -0x8(%r14,%r15)
jne 0x171652
cmpl $0x1000, -0x4(%r14,%r15) # imm = 0x1000
jne 0x171649
movl (%r14,%r15), %edi
xorl %esi, %esi
xorl %eax, %eax
callq 0x172f17
jmp 0x171652
movl $0x0, -0x10(%r14,%r15)
addq $0x1c, %r14
cmpq $0x1d8, %r14            # imm = 0x1D8
jne 0x171619
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ughman[P]c2c/src/bios.c
// Function: BIOS_OpenEvent
uint32_t BIOS_OpenEvent(uint32_t evclass,uint32_t spec,uint32_t mode,uint32_t func)
{
	for (int i = 0;i < BIOS_MAXEVENTS;i++)
	{
		struct biosevent *event = &events[i];
		if (!event->allocated)
		{
			event->allocated = 1;
			event->busy = 1;
			event->evclass = evclass;
			event->spec = spec;
			event->mode = mode;
			event->func = func;
			return i;
		}
	}
	abort();
}

// Assembly:
pushq %rax
leaq 0x9a3e(%rip), %r8       # 0x17b0b0
xorl %eax, %eax
cmpl $0x0, (%r8)
je 0x17168c
incq %rax
addq $0x1c, %r8
cmpq $0x10, %rax
jne 0x171674
callq 0x1070
movl $0x1, %r9d
movl %r9d, (%r8)
movl %r9d, 0x8(%r8)
movl %edi, 0xc(%r8)
movl %esi, 0x10(%r8)
movl %edx, 0x14(%r8)
movl %ecx, 0x18(%r8)
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/ughman[P]c2c/src/bios.c
// Function: BIOS_TestEvent
int BIOS_TestEvent(uint32_t event)
{
	if (event >= BIOS_MAXEVENTS)
		abort();
	if (!events[event].enabled)
		return 0;
	if (events[event].busy)
		return 0;
	events[event].busy = 1;
	return 1;
}

// Assembly:
cmpl $0x10, %edi
jae 0x1716e4
movl %edi, %eax
leaq (%rax,%rax,8), %rcx
leaq (%rcx,%rcx,2), %rdx
addq %rax, %rdx
leaq 0x99ec(%rip), %rcx      # 0x17b0b0
xorl %eax, %eax
cmpl $0x0, 0x4(%rcx,%rdx)
je 0x1716d6
addq %rdx, %rcx
cmpl $0x0, 0x8(%rcx)
je 0x1716d7
retq
movl $0x1, 0x8(%rcx)
movl $0x1, %eax
retq
pushq %rax
callq 0x1070
// File: /workspace/github_c_makefile_star2_O3/ughman[P]c2c/src/bios.c
// Function: BIOS_EnableEvent
int BIOS_EnableEvent(uint32_t event)
{
	if (event >= BIOS_MAXEVENTS)
		abort();
	events[event].enabled = 1;
	return 1;
}

// Assembly:
cmpl $0x10, %edi
jae 0x171711
movl %edi, %eax
leaq (%rax,%rax,8), %rcx
leaq (%rcx,%rcx,2), %rcx
addq %rax, %rcx
leaq 0x99ad(%rip), %rax      # 0x17b0b0
movl $0x1, 0x4(%rax,%rcx)
movl $0x1, %eax
retq
pushq %rax
callq 0x1070
// File: /workspace/github_c_makefile_star2_O3/ughman[P]c2c/src/emu.c
// Function: EMU_Init
void EMU_Init(void)
{
	extern void ZZ_Init(void);
	PCSX_Init();
	EMU_codemap[0x28] = BIOS_Execute;
	EMU_codemap[0x2C] = BIOS_Execute;
	EMU_codemap[0x30] = BIOS_Execute;
	EMU_codemap[0x221] = EMU_DummyMethod;
	for (int i = 0;i < EMU_RAMWORDS;i++)
	{
		if (!EMU_codemap[i])
			EMU_codemap[i] = EMU_ExecuteUnrecognizedCode;
	}
	ZZ_Init();
}

// Assembly:
pushq %rax
callq 0x171ad4
leaq -0x90f(%rip), %rax      # 0x171717
movq %rax, 0x9473(%rip)      # 0x17b4a0
movq %rax, 0x948c(%rip)      # 0x17b4c0
movq %rax, 0x94a5(%rip)      # 0x17b4e0
leaq -0x34(%rip), %rax       # 0x17200e
movq %rax, 0xa41f(%rip)      # 0x17c468
xorl %eax, %eax
leaq 0x930e(%rip), %rcx      # 0x17b360
pxor %xmm0, %xmm0
leaq -0x85(%rip), %rdx       # 0x171fd8
movdqa (%rcx,%rax,8), %xmm2
pcmpeqd %xmm0, %xmm2
pshufd $0xb1, %xmm2, %xmm1     # xmm1 = xmm2[1,0,3,2]
pand %xmm2, %xmm1
movd %xmm1, %esi
testb $0x1, %sil
je 0x17207d
movq %rdx, (%rcx,%rax,8)
pextrw $0x4, %xmm1, %esi
testb $0x1, %sil
je 0x17208d
movq %rdx, 0x8(%rcx,%rax,8)
addq $0x2, %rax
cmpq $0x80000, %rax          # imm = 0x80000
jne 0x17205d
popq %rax
jmp 0x1350
// File: /workspace/github_c_makefile_star2_O3/ughman[P]c2c/src/emu.c
// Function: EMU_ReadU8
uint8_t EMU_ReadU8(uint32_t address)
{
	if (address >= 0x80000000 && address <= 0x801FFFFF)
	{
normal:
		{
			uint32_t (*codehandler)(uint32_t) = EMU_codemap[(address & 0x1FFFFF) >> 2];
			if (codehandler != EMU_ExecuteUnrecognizedCode)
			{
				SDL_LogError(LOG_EMU,"Reading code as data");
			}
		}
		return EMU_ram[(address & 0x1FFFFF) >> 2] >> (address & 3) * 8;
	}
	else if (address >= 0x0 && address <= 0x1FFFFF)
	{
		goto normal;
	}
	else if (address >= 0xA0000000 && address <= 0xA01FFFFF)
	{
		goto normal;
	}
	else if (address >= 0x1F800000 && address <= 0x1F8003FF)
	{
		return EMU_scratch[(address & 0x3FF) >> 2] >> (address & 3) * 8;
	}
	else switch (address)
	{
	case 0x1F801040:
		return PAD_Read();
	case 0x1F801800:
		return CDR_GetStatus();
	case 0x1F801801:
		return CDR_ReadResponse();
	case 0x1F801802:
		return CDR_Read();
	case 0x1F801803:
		return CDR_Read3();
	default:
		SDL_LogError(LOG_EMU,"Unrecognized 8-bit read address %.8X",address);
		return PCSX_Read8(address);
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
testl $0x7fe00000, %edi       # imm = 0x7FE00000
setne %al
movl %edi, %ecx
andl $0xffe00000, %ecx       # imm = 0xFFE00000
cmpl $0xa0000000, %ecx       # imm = 0xA0000000
setne %cl
testb %cl, %al
jne 0x17210d
movl %ebx, %r14d
shrl $0x2, %r14d
andl $0x7ffff, %r14d         # imm = 0x7FFFF
leaq 0x9280(%rip), %rax      # 0x17b360
leaq -0x10f(%rip), %rcx      # 0x171fd8
cmpq %rcx, (%rax,%r14,8)
je 0x172100
leaq 0x52aa(%rip), %rsi      # 0x17739e
movl $0x13, %edi
xorl %eax, %eax
callq 0x10d0
movq 0x409259(%rip), %rax    # 0x57b360
movl (%rax,%r14,4), %eax
jmp 0x17212d
movl %ebx, %eax
andl $0xfffffc00, %eax       # imm = 0xFFFFFC00
cmpl $0x1f800000, %eax       # imm = 0x1F800000
jne 0x17213c
movq 0x409246(%rip), %rax    # 0x57b368
movl %ebx, %ecx
andl $0x3fc, %ecx            # imm = 0x3FC
movl (%rax,%rcx), %eax
shll $0x3, %ebx
movl %ebx, %ecx
shrl %cl, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leal -0x1f801800(%rbx), %eax
cmpl $0x3, %eax
ja 0x172163
leaq 0x405e(%rip), %rcx      # 0x1761ac
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1290
cmpl $0x1f801040, %ebx       # imm = 0x1F801040
jne 0x172177
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x124c
leaq 0x5235(%rip), %rsi      # 0x1773b3
movl $0x13, %edi
movl %ebx, %edx
xorl %eax, %eax
callq 0x10d0
leaq 0x90ed(%rip), %rax      # 0x17b280
movl %ebx, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
jmpq *(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x12b3
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x12cf
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x12c1
// File: /workspace/github_c_makefile_star2_O3/ughman[P]c2c/src/emu.c
// Function: EMU_ReadLeft
void EMU_ReadLeft(uint32_t address,uint32_t *valueref)
{
	static uint32_t mask[4] = {0xFFFFFF,0xFFFF,0xFF,0};
	static int shift[4] = {24,16,8,0};
	uint32_t value = EMU_ReadU32(address & ~3);
	*valueref &= mask[address & 3];
	*valueref |= value << shift[address & 3];
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %r14d
andl $-0x4, %edi
callq 0x17240a
andl $0x3, %r14d
shll $0x2, %r14d
leaq 0x47bb(%rip), %rdx      # 0x177530
leaq 0x47d4(%rip), %rcx      # 0x177550
movb (%r14,%rcx), %cl
movl (%rbx), %esi
shll %cl, %eax
andl (%r14,%rdx), %esi
orl %esi, %eax
movl %eax, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/ughman[P]c2c/src/emu.c
// Function: EMU_ReadRight
void EMU_ReadRight(uint32_t address,uint32_t *valueref)
{
	static uint32_t mask[4] = {0,0xFF000000,0xFFFF0000,0xFFFFFF00};
	static int shift[4] = {0,8,16,24};
	uint32_t value = EMU_ReadU32(address & ~3);
	*valueref &= mask[address & 3];
	*valueref |= value >> shift[address & 3];
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %r14d
andl $-0x4, %edi
callq 0x17240a
andl $0x3, %r14d
shll $0x2, %r14d
leaq 0x47ab(%rip), %rdx      # 0x177560
leaq 0x47c4(%rip), %rcx      # 0x177580
movb (%r14,%rcx), %cl
movl (%rbx), %esi
shrl %cl, %eax
andl (%r14,%rdx), %esi
orl %esi, %eax
movl %eax, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/ughman[P]c2c/src/emu.c
// Function: EMU_WriteLeft
void EMU_WriteLeft(uint32_t address,uint32_t value)
{
	static uint32_t mask[4] = {0xFFFFFF00,0xFFFF0000,0xFF000000,0};
	static int shift[4] = {24,16,8,0};
	uint32_t memvalue = EMU_ReadU32(address & ~3);
	memvalue &= mask[address & 3];
	memvalue |= value >> shift[address & 3];
	EMU_Write32(address & ~3,memvalue);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movl %edi, %r14d
movl %edi, %ebp
andl $-0x4, %ebp
movl %ebp, %edi
callq 0x17240a
andl $0x3, %r14d
shll $0x2, %r14d
leaq 0x4748(%rip), %rcx      # 0x177540
andl (%r14,%rcx), %eax
leaq 0x474d(%rip), %rcx      # 0x177550
movb (%r14,%rcx), %cl
shrl %cl, %ebx
orl %eax, %ebx
movl %ebp, %edi
movl %ebx, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x172aa1
// File: /workspace/github_c_makefile_star2_O3/ughman[P]c2c/src/emu.c
// Function: EMU_WriteRight
void EMU_WriteRight(uint32_t address,uint32_t value)
{
	static uint32_t mask[4] = {0,0xFF,0xFFFF,0xFFFFFF};
	static int shift[4] = {0,8,16,24};
	uint32_t memvalue = EMU_ReadU32(address & ~3);
	memvalue &= mask[address & 3];
	memvalue |= value << shift[address & 3];
	EMU_Write32(address & ~3,memvalue);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movl %edi, %r14d
movl %edi, %ebp
andl $-0x4, %ebp
movl %ebp, %edi
callq 0x17240a
andl $0x3, %r14d
shll $0x2, %r14d
leaq 0x4734(%rip), %rcx      # 0x177570
andl (%r14,%rcx), %eax
leaq 0x4739(%rip), %rcx      # 0x177580
movb (%r14,%rcx), %cl
shll %cl, %ebx
orl %eax, %ebx
movl %ebp, %edi
movl %ebx, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x172aa1
// File: /workspace/github_c_makefile_star2_O3/ughman[P]c2c/src/emu.c
// Function: EMU_SDivide
void EMU_SDivide(int32_t a,int32_t b)
{
	if (b)
	{
		LO = a / b;
		HI = a % b;
	}
	else
	{
		LO = 0xFFFFFFFF;
		HI = a;
	}
}

// Assembly:
testl %esi, %esi
je 0x172ecc
movq 0x8493(%rip), %rcx      # 0x17b350
movl %edi, %eax
cltd
idivl %esi
movl %eax, 0x80(%rcx)
movl %edx, %edi
jmp 0x172edd
movq 0x847d(%rip), %rcx      # 0x17b350
movl $0xffffffff, 0x80(%rcx) # imm = 0xFFFFFFFF
movl %edi, 0x84(%rcx)
retq
// File: /workspace/github_c_makefile_star2_O3/ughman[P]c2c/src/emu.c
// Function: EMU_UDivide
void EMU_UDivide(uint32_t a,uint32_t b)
{
	if (b)
	{
		LO = a / b;
		HI = a % b;
	}
	else
	{
		LO = 0xFFFFFFFF;
		HI = a;
	}
}

// Assembly:
testl %esi, %esi
je 0x172eff
movq 0x8461(%rip), %rcx      # 0x17b350
movl %edi, %eax
xorl %edx, %edx
divl %esi
movl %eax, 0x80(%rcx)
movl %edx, %edi
jmp 0x172f10
movq 0x844a(%rip), %rcx      # 0x17b350
movl $0xffffffff, 0x80(%rcx) # imm = 0xFFFFFFFF
movl %edi, 0x84(%rcx)
retq
// File: /workspace/github_c_makefile_star2_O3/ughman[P]c2c/src/emu.c
// Function: EMU_RunInterrupts
void EMU_RunInterrupts(void)
{
	uint32_t pc = PCSX_RunInterrupts(0xDEADBEEF);
	while (pc != 0xDEADBEEF)
	{
		if (pc & 3)
			SDL_LogError(LOG_EMU,"Program counter is unaligned");
		pc = EMU_codemap[(pc & 0x1FFFFF) >> 2](pc);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
leaq 0x80d4(%rip), %rax      # 0x17b2e8
movl $0xdeadbeef, %edi       # imm = 0xDEADBEEF
callq *(%rax)
cmpl $0xdeadbeef, %eax       # imm = 0xDEADBEEF
je 0x17325c
movl %eax, %ebx
leaq 0x8135(%rip), %r15      # 0x17b360
leaq 0x42d2(%rip), %r14      # 0x177504
testb $0x3, %bl
je 0x173246
movl $0x13, %edi
movq %r14, %rsi
xorl %eax, %eax
callq 0x10d0
movl %ebx, %eax
andl $0x1ffffc, %eax         # imm = 0x1FFFFC
movl %ebx, %edi
callq *(%r15,%rax,2)
movl %eax, %ebx
cmpl $0xdeadbeef, %eax       # imm = 0xDEADBEEF
jne 0x173232
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/ughman[P]c2c/src/gool_mips.cc
// Function: GOOL_MIPS_ExecuteFromZZ
void GOOL_MIPS_ExecuteFromZZ(uint32_t pc)
{
	struct goolenv env;
	env.pc = pc;
	env.pcfar = pc + 4;
	env.language = env.languagefar = GOOL_LANGUAGE_MIPS;
	RA = 0xDEADBEEF;
	while (env.pc != 0xDEADBEEF)
	{
		uint32_t instruction = EMU_ReadU32(env.pc);
		env.oldpc = env.pc;
		env.pc = env.pcfar;
		env.pcfar = env.pcfar + 4;
		env.language = env.languagefar;
		GOOL_MIPS_ExecuteOnce(&env,instruction);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %edi, 0x10(%rsp)
leal 0x4(%rdi), %eax
movl %eax, 0x14(%rsp)
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x18(%rsp)
leaq 0x7cc7(%rip), %rax      # 0x17b350
movq (%rax), %rax
movl $0xdeadbeef, %ecx       # imm = 0xDEADBEEF
movl %ecx, 0x7c(%rax)
cmpl %ecx, %edi
je 0x1736f2
leaq 0x7101(%rip), %r14      # 0x17a7a0
leaq -0x6e(%rip), %r15       # 0x173638
leaq 0xc(%rsp), %rbx
callq 0x17240a
movl 0x10(%rsp), %ecx
movl 0x14(%rsp), %edx
movl %ecx, 0xc(%rsp)
movl %edx, 0x10(%rsp)
addl $0x4, %edx
movl %edx, 0x14(%rsp)
movl 0x1c(%rsp), %ecx
movl %ecx, 0x18(%rsp)
movl %eax, %ecx
shrl $0x1a, %ecx
movq (%r14,%rcx,8), %rcx
testq %rcx, %rcx
cmoveq %r15, %rcx
movq %rbx, %rdi
movl %eax, %esi
callq *%rcx
movl 0x10(%rsp), %edi
cmpl $0xdeadbeef, %edi       # imm = 0xDEADBEEF
jne 0x1736ab
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/ughman[P]c2c/src/ns.cc
// Function: NS_1254C
int32_t NS_1254C(emuptr<struct nspage> nspage)
{
	if (nspage->type == 0x1)
	{
		return -255;
	}
	if (nspage->magic != 0x1234)
	{
		return -18;
	}
	for (int32_t i = nspage->entrycount - 1;i >= 0;i--)
	{
		*(uint32_t *)&nspage->entries[i] += (uint32_t)nspage;
		for (int32_t ii = nspage->entries[i]->itemcount;ii >= 0;ii--)
		{
			*(uint32_t *)&nspage->entries[i]->items[ii] += (uint32_t)nspage->entries[i];
		}
	}
	*(uint32_t *)&nspage->entries[nspage->entrycount] += (uint32_t)nspage;
	return -255;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edi, %ebx
callq 0x172e5c
movq %rax, %rcx
movl $0xffffff01, %eax       # imm = 0xFFFFFF01
cmpw $0x1, 0x2(%rcx)
je 0x173da9
movl %ebx, %edi
callq 0x172e5c
movq %rax, %rcx
movl $0xffffffee, %eax       # imm = 0xFFFFFFEE
cmpw $0x1234, (%rcx)         # imm = 0x1234
jne 0x173da9
movl %ebx, %edi
callq 0x172e5c
movslq 0x8(%rax), %r14
testq %r14, %r14
jle 0x173d8a
movq %r14, %r15
decq %r14
movl %ebx, %edi
callq 0x172e5c
addl %ebx, 0xc(%rax,%r15,4)
movl %ebx, %edi
callq 0x172e5c
movl 0xc(%rax,%r15,4), %edi
callq 0x172e5c
movslq 0xc(%rax), %r12
testq %r12, %r12
js 0x173d84
movl %ebx, %edi
callq 0x172e5c
movl 0x10(%rax,%r14,4), %ebp
movl %ebx, %edi
callq 0x172e5c
movl 0x10(%rax,%r14,4), %edi
callq 0x172e5c
addl %ebp, 0x10(%rax,%r12,4)
addq $-0x1, %r12
jb 0x173d5c
cmpq $0x1, %r15
jg 0x173d30
movl %ebx, %edi
callq 0x172e5c
movq %rax, %r14
movl %ebx, %edi
callq 0x172e5c
movslq 0x8(%rax), %rax
addl %ebx, 0x10(%r14,%rax,4)
movl $0xffffff01, %eax       # imm = 0xFFFFFF01
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ughman[P]c2c/src/core.cc
// Function: CORE_Main
int CORE_Main(void)
{
	EMU_Invoke(0x80049E6C,0);
	EMU_Write32(0x8005F43C,1);
	EMU_Invoke(0x80015738,0);
	CORE_Loop(0x3C);
	EMU_Invoke(0x800158C4,0);
	return 0;
}

// Assembly:
pushq %rax
movl $0x80049e6c, %edi       # imm = 0x80049E6C
xorl %esi, %esi
xorl %eax, %eax
callq 0x172f17
movl $0x8005f43c, %edi       # imm = 0x8005F43C
movl $0x1, %esi
callq 0x172aa1
movl $0x80015738, %edi       # imm = 0x80015738
xorl %esi, %esi
xorl %eax, %eax
callq 0x172f17
movl $0x3c, %edi
callq 0x1740d8
movl $0x800158c4, %edi       # imm = 0x800158C4
xorl %esi, %esi
xorl %eax, %eax
callq 0x172f17
xorl %eax, %eax
popq %rcx
retq