LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/mmayer[P]pcal/src/writefil.c
// Function: print_db_word
char *print_db_word (char *p)
{
   char c, buf[STRSIZ];
   
   if (*p == '\0' || *(p += strspn(p, WHITESPACE)) == '\0') return NULL;
   
   while ((c = *p) && !isspace(c & CHAR_MSK)) {
      if (c == '%' && p[1] != '\0') {
         p = expand_fmt(buf, p + 1);
         PUTSTR(isprint, buf, stderr);
      } 
      else {
         PUTCHAR(isprint, c, stderr);
         p++;
      }
   }
   
   return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
cmpb $0x0, (%rdi)
je 0x147e4
movq %rdi, %rbx
leaq 0xae46(%rip), %rsi      # 0x1f57e
callq 0x51a0
movb (%rbx,%rax), %r13b
testb %r13b, %r13b
je 0x147e4
addq %rax, %rbx
callq 0x5340
movq %rax, %r14
movq 0x14894(%rip), %r12     # 0x28ff0
movq %rsp, %r15
leaq 0xecb1(%rip), %rbp      # 0x23417
movzbl %r13b, %edx
movq (%r14), %rax
movzwl (%rax,%rdx,2), %eax
btl $0xd, %eax
jb 0x147e6
cmpl $0x25, %edx
jne 0x147a4
cmpb $0x0, 0x1(%rbx)
je 0x147b2
incq %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x13e41
movq %rax, %rbx
movb (%rsp), %al
testb %al, %al
jne 0x147d4
movb (%rbx), %r13b
testb %r13b, %r13b
jne 0x14766
jmp 0x147e6
movq (%r12), %rdi
movq %rbp, %rsi
cmpl $0x20, %edx
jne 0x147b6
jmp 0x147c8
movq (%r12), %rdi
btl $0xe, %eax
movq %rbp, %rsi
leaq 0xb72c(%rip), %rax      # 0x1fef0
cmovaeq %rax, %rsi
xorl %eax, %eax
callq 0x5210
incq %rbx
jmp 0x1479a
movzbl %al, %edi
movq %r15, %rsi
movq %r14, %rdx
callq 0x56b7
jmp 0x1479a
xorl %ebx, %ebx
movq %rbx, %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mmayer[P]pcal/src/writefil.c
// Function: print_pstext
void print_pstext (char *p)
{
   char *s = p;   /* save for possible second pass */
   
   while ((p = print_word(p)) != NULL) printf(" ");

   /* repeat to generate debugging info if requested */
   if (debug_text) {
      while ((s = print_db_word(s)) != NULL) fprintf(stderr, " ");
   }

   return;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x11eb4
testq %rax, %rax
je 0x14829
movq %rax, %r14
movl $0x20, %edi
callq 0x5060
movq %r14, %rdi
callq 0x11eb4
movq %rax, %r14
testq %rax, %rax
jne 0x1480f
cmpl $0x0, 0x1b790(%rip)     # 0x2ffc0
je 0x14866
movq %rbx, %rdi
callq 0x14714
testq %rax, %rax
je 0x14866
movq %rax, %rbx
movq 0x147a7(%rip), %r14     # 0x28ff0
movq (%r14), %rsi
movl $0x20, %edi
callq 0x51c0
movq %rbx, %rdi
callq 0x14714
movq %rax, %rbx
testq %rax, %rax
jne 0x14849
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/mmayer[P]pcal/src/writefil.c
// Function: print_text
void print_text (char *p)
{
   char c, buf[STRSIZ];
   
   while ((c = *p) != '\0') {
      if (c == '%' && p[1] != '\0') {
         p = expand_fmt(buf, p + 1);
         /* AH: non-ascii for -c mode should pass clean! */
         PUTSTR_CLEAN(isprint, buf, stdout);
      } 
      else {
         PUTCHAR_CLEAN(isprint, c, stdout);
         p++;
      }
   }

   return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd0, %rsp
movq %rdi, %r14
leaq 0x1(%rsp), %r15
movq %rsp, %rbx
movq 0x14730(%rip), %r12     # 0x28fc0
movzbl (%r14), %edi
cmpl $0x25, %edi
je 0x1489f
testl %edi, %edi
jne 0x148da
jmp 0x148e8
cmpb $0x0, 0x1(%r14)
je 0x148da
incq %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x13e41
movq %rax, %r14
movb (%rsp), %al
testb %al, %al
je 0x14890
movq %r15, %r13
movq (%r12), %rsi
movzbl %al, %edi
callq 0x51c0
movb (%r13), %al
incq %r13
testb %al, %al
jne 0x148c1
jmp 0x14890
movq (%r12), %rsi
callq 0x51c0
incq %r14
jmp 0x14890
addq $0xd0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/mmayer[P]pcal/src/writefil.c
// Function: def_footstring
void def_footstring (char *p, char *str)
{
   char c, buf[STRSIZ];
   
   this_day = 1;   /* set default day in foot string */
   RESET_DATE();   /* reset working date */
   
   printf("/%s (", str);
   while ((c = *p) != '\0') {
      if (c == '%' && p[1] != '\0') {
         p = expand_fmt(buf, p + 1);
         PUTSTR(isalnum, buf, stdout);
      } 
      else {
         PUTCHAR(isalnum, c, stdout);
         p++;
      }
   }
   printf(") def\n");

   return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
movl $0x1, %eax
movl %eax, 0x1b6d0(%rip)     # 0x2ffe8
movl 0x1b6a6(%rip), %ecx     # 0x2ffc4
movl %ecx, 0x1b6c8(%rip)     # 0x2ffec
movl %eax, 0x1b6c6(%rip)     # 0x2fff0
movl 0x1b698(%rip), %eax     # 0x2ffc8
movl %eax, 0x1b6be(%rip)     # 0x2fff4
leaq 0xec1a(%rip), %rdi      # 0x23557
xorl %eax, %eax
callq 0x5130
movq 0x14675(%rip), %r13     # 0x28fc0
leaq 0xeac5(%rip), %r14      # 0x23417
movzbl (%rbx), %ebp
cmpl $0x25, %ebp
je 0x14973
testl %ebp, %ebp
je 0x14a0e
movq (%r13), %r15
movq %r14, %rsi
cmpl $0x20, %ebp
jne 0x149de
jmp 0x149fa
cmpb $0x0, 0x1(%rbx)
je 0x149da
incq %rbx
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x13e41
movq %rax, %rbx
movb (%rsp), %al
testb %al, %al
je 0x14952
leaq 0x1(%rsp), %rbp
movq (%r13), %r15
movzbl %al, %r12d
movq %r14, %rsi
cmpb $0x20, %al
je 0x149be
callq 0x5340
movq (%rax), %rax
testb $0x8, (%rax,%r12,2)
leaq 0xb537(%rip), %rsi      # 0x1fef0
je 0x149be
movq %r14, %rsi
movq %r15, %rdi
movl %r12d, %edx
xorl %eax, %eax
callq 0x5210
movb (%rbp), %al
incq %rbp
testb %al, %al
jne 0x14996
jmp 0x14952
movq (%r13), %r15
callq 0x5340
movq (%rax), %rax
movl %ebp, %ecx
testb $0x8, (%rax,%rcx,2)
movq %r14, %rsi
leaq 0xb4fa(%rip), %rax      # 0x1fef0
cmoveq %rax, %rsi
movq %r15, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x5210
incq %rbx
jmp 0x14952
leaq 0x10d00(%rip), %rdi     # 0x25715
callq 0x50b0
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mmayer[P]pcal/src/writefil.c
// Function: find_images
void find_images (int month, int year)
{
   register int day;
   year_info *py;
   month_info *pm;
   register day_info *pd;
   
   /* if no text for this year and month, return */
   
   if ((py = find_year(year, FALSE)) == NULL || (pm = py->month[month-1]) == NULL) {
      return;
   }

   /* walk array of day text pointers and linked lists of text */
   
   for (day = 1; day <= LAST_NOTE_DAY; day++) {
      for (pd = pm->day[day-1]; pd; pd = pd->next) {
         
         /* Determine if this is a 'daytext' or an 'image'... */
         if (ci_strncmp(pd->text, "image:", 6) == 0) {
            
            char temp_str[300];
            char *p;
            
            printf("%d [()] \n", day);
            
            strncpy(temp_str, pd->text, sizeof temp_str);
            p = strchr(pd->text, ' ');  /* Isolate the EPS image filename */
            strncpy(temp_str, p+1, sizeof temp_str);  /* Copy the remaining parameters */
            *p = '\0';
            printf("(%s) %s ", pd->text+6, temp_str);
            
            this_day = 1;
            RESET_DATE();   /* reset working date */
            
            printf("epsimage\n");
         }
      }
   }

   return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movl %edi, %ebx
movl %esi, %edi
xorl %esi, %esi
callq 0xc8d0
testq %rax, %rax
je 0x14d61
movslq %ebx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x14d61
movl $0x1, %ebx
leaq 0xe6ea(%rip), %r14      # 0x2336d
leaq 0x10(%rsp), %r12
movl $0x1, %r13d
movq 0x8(%rsp), %rax
movq (%rax,%rbx,8), %rbp
testq %rbp, %rbp
je 0x14d54
movq 0x8(%rbp), %rdi
movq %r14, %rsi
movl $0x6, %edx
callq 0xa340
testl %eax, %eax
jne 0x14d4b
leaq 0xe8df(%rip), %rdi      # 0x2359f
movl %ebx, %esi
xorl %eax, %eax
callq 0x5130
movq 0x8(%rbp), %rsi
movl $0x12c, %edx            # imm = 0x12C
movq %r12, %rdi
callq 0x5080
movq 0x8(%rbp), %rdi
movl $0x20, %esi
callq 0x5120
movq %rax, %r15
leaq 0x1(%rax), %rsi
movl $0x12c, %edx            # imm = 0x12C
movq %r12, %rdi
callq 0x5080
movb $0x0, (%r15)
movq 0x8(%rbp), %rsi
addq $0x6, %rsi
leaq 0xe89a(%rip), %rdi      # 0x235a9
movq %r12, %rdx
xorl %eax, %eax
callq 0x5130
movl %r13d, 0x1b2c8(%rip)    # 0x2ffe8
movl 0x1b29e(%rip), %eax     # 0x2ffc4
movl %eax, 0x1b2c0(%rip)     # 0x2ffec
movl %r13d, 0x1b2bd(%rip)    # 0x2fff0
movl 0x1b28f(%rip), %eax     # 0x2ffc8
movl %eax, 0x1b2b5(%rip)     # 0x2fff4
leaq 0x109d5(%rip), %rdi     # 0x2571b
callq 0x50b0
movq 0x10(%rbp), %rbp
jmp 0x14c97
incq %rbx
cmpq $0x2e, %rbx
jne 0x14c8e
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mmayer[P]pcal/src/writefil.c
// Function: print_colors
void print_colors (int month, int year)
{
   register int day;
   year_info *py;
   month_info *pm;
   unsigned long holidays;
   int j, len;
   short color[32];
   
   len = LENGTH_OF(month, year);
   
   /* determine each date's color from its day of the week */
   for (day = 1, j = FIRST_OF(month, year);
        day <= len;
        day++, j = (j + 1) % 7) {
      color[day] = day_color[j];
   }
   
   pm = (py = find_year(year, FALSE)) ? py->month[month-1] : NULL;
   
   /* override weekday color for holidays */
   for (holidays = pm ? pm->holidays : 0, day = 1;
        holidays;
        holidays >>= 1, day++) {
      if (holidays & 01) color[day] = holiday_color;
   }
   
   printf("/date_color [ -1");   /* dummy value for element 0 */

   for (day = 1; day <= len; day++) {
      printf("%s %d", day % 10 == 1 ? " " : "", color[day]);
   }
   printf(" ] def\n");

   return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, %ebx
movslq %edi, %r15
leaq 0x14433(%rip), %rax     # 0x291c0
movsbl -0x1(%r15,%rax), %eax
movl %r15d, %ecx
xorl $0x2, %ecx
movl %esi, %edx
andl $0x3, %edx
xorl %r14d, %r14d
orl %ecx, %edx
jne 0x14dd4
imull $0xc28f5c29, %ebx, %ecx # imm = 0xC28F5C29
addl $0x51eb850, %ecx        # imm = 0x51EB850
movl %ecx, %edx
rorl $0x2, %edx
movl $0x1, %r14d
cmpl $0x28f5c28, %edx        # imm = 0x28F5C28
ja 0x14dd4
rorl $0x4, %ecx
xorl %r14d, %r14d
cmpl $0xa3d70b, %ecx         # imm = 0xA3D70B
setb %r14b
addl %eax, %r14d
movl $0x1, %esi
movl %ebx, %edx
callq 0xab15
testl %r14d, %r14d
jle 0x14e3c
leal 0x1(%r14), %ecx
movl $0x1, %edx
leaq 0x18934(%rip), %rsi     # 0x2d72c
cltq
movsbl (%rsi,%rax), %edi
movw %di, (%rsp,%rdx,2)
incq %rdx
movl %eax, %edi
incl %edi
movslq %edi, %rdi
imulq $-0x6db6db6d, %rdi, %rdi # imm = 0x92492493
shrq $0x20, %rdi
addl %eax, %edi
incl %edi
movl %edi, %r8d
shrl $0x1f, %r8d
sarl $0x2, %edi
addl %r8d, %edi
leal (,%rdi,8), %r8d
subl %r8d, %edi
addl %edi, %eax
incl %eax
cmpq %rdx, %rcx
jne 0x14df8
movl %ebx, %edi
xorl %esi, %esi
callq 0xc8d0
testq %rax, %rax
je 0x14e84
movq (%rax,%r15,8), %rax
testq %rax, %rax
je 0x14e84
movq (%rax), %rax
testq %rax, %rax
je 0x14e84
leaq 0x188d2(%rip), %rcx     # 0x2d734
movzwl (%rcx), %ecx
leaq 0x2(%rsp), %rdx
testb $0x1, %al
je 0x14e71
movw %cx, (%rdx)
movq %rax, %rsi
shrq %rsi
addq $0x2, %rdx
cmpq $0x1, %rax
movq %rsi, %rax
ja 0x14e6a
leaq 0xe727(%rip), %rdi      # 0x235b2
xorl %eax, %eax
callq 0x5130
testl %r14d, %r14d
jle 0x14eed
incl %r14d
movl $0x1, %r15d
movl $0xcccccccd, %r12d      # imm = 0xCCCCCCCD
leaq 0x10110(%rip), %r13     # 0x24fbd
leaq 0xe70f(%rip), %rbx      # 0x235c3
xorl %ebp, %ebp
movl %r15d, %eax
imulq %r12, %rax
shrq $0x23, %rax
leal (%rax,%rax,4), %eax
addl %eax, %eax
movq %r13, %rsi
addl %ebp, %eax
je 0x14ed4
leaq 0xb8d9(%rip), %rsi      # 0x207ad
movswl (%rsp,%r15,2), %edx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x5130
incq %r15
decl %ebp
cmpq %r15, %r14
jne 0x14eb6
leaq 0x1083c(%rip), %rdi     # 0x25730
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x50b0
// File: /workspace/github_c_makefile_star2_O3/mmayer[P]pcal/src/writefil.c
// Function: find_noteboxes
void find_noteboxes (int month, int year)
{
   register int day;
   year_info *py;
   month_info *pm;
   
   /* if no text for this year and month, print empty list and return */
   
   if ((py = find_year(year, FALSE)) == NULL ||
       (pm = py->month[month-1]) == NULL) {
      printf("/noteboxes [ ] def\n");
      return;
   }
   
   printf("/noteboxes [");   /* start definition of list */
   
   /* walk array of note text pointers, converting days to box numbers */
   
   for (day = FIRST_NOTE_DAY; day <= LAST_NOTE_DAY; day++) {
      if (pm->day[day-1]) {
         printf(" %d", note_box(month, day, year));
      }
   }

   printf(" ] def\n");

   return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %ebp
movl %esi, %edi
xorl %esi, %esi
callq 0xc8d0
leaq 0x107fe(%rip), %r14     # 0x25724
testq %rax, %rax
je 0x14f82
movslq %ebp, %rcx
movq (%rax,%rcx,8), %r13
testq %r13, %r13
je 0x14f82
leaq 0xe68b(%rip), %rdi      # 0x235c9
xorl %eax, %eax
callq 0x5130
movl $0x20, %r15d
leaq 0x107de(%rip), %r14     # 0x25730
leaq 0xb390(%rip), %r12      # 0x202e9
cmpq $0x0, (%r13,%r15,8)
je 0x14f79
movl %ebp, %edi
movl %r15d, %esi
movl %ebx, %edx
callq 0xadfd
movq %r12, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x5130
incq %r15
cmpq $0x2e, %r15
jne 0x14f59
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x50b0
// File: /workspace/github_c_makefile_star2_O3/mmayer[P]pcal/src/writefil.c
// Function: print_julian_info
void print_julian_info (int month, int year)
{
   if (julian_dates != NO_JULIANS) {
      printf("/jdstart %d def\n", DAY_OF_YEAR(month, 1, year));
   }
   if (julian_dates == ALL_JULIANS) {
      printf("/yearlen %d def\n", YEAR_LEN(year));
   }
   return;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x184a0(%rip), %r14     # 0x2d6c0
cmpl $0x0, (%r14)
je 0x152e0
movl %esi, %ebx
movslq %edi, %rcx
leaq 0x13f9a(%rip), %rax     # 0x291d0
movswl -0x2(%rax,%rcx,2), %eax
cmpl $0x3, %ecx
setl %dl
testb $0x3, %bl
setne %sil
xorl %ecx, %ecx
orb %dl, %sil
jne 0x1527b
imull $0xc28f5c29, %ebx, %edx # imm = 0xC28F5C29
addl $0x51eb850, %edx        # imm = 0x51EB850
movl %edx, %esi
rorl $0x2, %esi
movl $0x1, %ecx
cmpl $0x28f5c28, %esi        # imm = 0x28F5C28
ja 0x1527b
rorl $0x4, %edx
xorl %ecx, %ecx
cmpl $0xa3d70b, %edx         # imm = 0xA3D70B
setb %cl
leal (%rax,%rcx), %esi
incl %esi
leaq 0xe3dd(%rip), %rdi      # 0x23664
xorl %eax, %eax
callq 0x5130
cmpl $0x1, (%r14)
jne 0x152e0
movl $0x16d, %esi            # imm = 0x16D
testb $0x3, %bl
jne 0x152cb
imull $0xc28f5c29, %ebx, %eax # imm = 0xC28F5C29
addl $0x51eb850, %eax        # imm = 0x51EB850
movl %eax, %ecx
rorl $0x2, %ecx
movl $0x16e, %esi            # imm = 0x16E
cmpl $0x28f5c28, %ecx        # imm = 0x28F5C28
ja 0x152cb
rorl $0x4, %eax
xorl %esi, %esi
cmpl $0xa3d70b, %eax         # imm = 0xA3D70B
adcl $0x16d, %esi            # imm = 0x16D
leaq 0xe3a3(%rip), %rdi      # 0x23675
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x5130
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/antonblanchard[P]will-it-scale/tests/open2.c
// Function: testcase
void testcase(unsigned long long *iterations, unsigned long nr)
{
	int fd;
	char tmpfile[PATH_MAX];
	sprintf(tmpfile, "%s/willitscale", tmpdirs[nr]);

	while (1) {
		fd = open(tmpfile, O_RDWR);
		assert(fd >= 0);
		close(fd);

		(*iterations)++;
	}
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movq %rdi, %rbx
leaq (%rsi,%rsi,2), %rdx
shlq $0x3, %rdx
addq 0xe3c1(%rip), %rdx      # 0x111c8
leaq 0x537(%rip), %rsi       # 0x3345
movq %rsp, %r14
movq %r14, %rdi
xorl %eax, %eax
callq 0x22b0
movq %r14, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x2230
testl %eax, %eax
js 0x2e4e
movq %rsp, %r14
movl %eax, %edi
callq 0x2150
incq (%rbx)
movq %r14, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x2230
testl %eax, %eax
jns 0x2e31
leaq 0x4ff(%rip), %rdi       # 0x3354
leaq 0x486(%rip), %rsi       # 0x32e2
leaq 0x4f9(%rip), %rcx       # 0x335c
movl $0x30, %edx
callq 0x2130
// File: /workspace/github_c_makefile_star2_O3/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_1/exercise_1_05/celsius_fahrenheit.c
// Function: main
int main(void)
{
  float celsius, fahr;
  int lower, upper, step;

  lower = 0;
  upper = 300;
  step = 20;

  printf("Celsius\tFahr\n");
  printf("---------------\n");

  for (celsius = upper; celsius >= lower; celsius = celsius - step)
  {
    fahr = (9.0 / 5.0) * celsius + 32.0f;
    printf("%3.0f\t\t%6.1f\n", celsius, fahr);
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
leaq 0xed0(%rip), %rdi       # 0x2026
callq 0x1030
leaq 0xed1(%rip), %rdi       # 0x2033
callq 0x1030
movl $0x12c, %ebp            # imm = 0x12C
leaq 0xea5(%rip), %rbx       # 0x2018
xorps %xmm0, %xmm0
cvtsi2ss %ebp, %xmm0
cvtss2sd %xmm0, %xmm0
movaps %xmm0, %xmm1
mulsd 0xe7f(%rip), %xmm1      # 0x2008
addsd 0xe7f(%rip), %xmm1      # 0x2010
cvtsd2ss %xmm1, %xmm1
cvtss2sd %xmm1, %xmm1
movq %rbx, %rdi
movb $0x2, %al
callq 0x1040
addl $-0x14, %ebp
movl %ebp, %eax
addl $0x14, %eax
jae 0x1173
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Matthias-Wandel[P]imgcomp/src/config.c
// Function: parse_switches
int parse_switches (int argc, char **argv, int last_file_arg_seen)
{
    int argn,a;
    char * arg;
    char * value;

    // Scan command line options, adjust parameters
    for (argn = 1; argn < argc;) {
        //printf("argn = %d\n",argn);
        arg = argv[argn];
        if (*arg != '-') {
            return argn;
        }
        value = NULL;
        if (argn+1 < argc) value = argv[argn+1];

        a = parse_parameter(arg+1, value);
        if (a < 0) usage();
        argn += a;
    }
    return argc;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edi, %ebx
cmpl $0x2, %edi
jl 0x4f30
movq %rsi, %r14
movl $0x1, %r15d
movslq %r15d, %rax
movq (%r14,%rax,8), %rdi
cmpb $0x2d, (%rdi)
jne 0x4f2d
leal 0x1(%r15), %eax
cmpl %ebx, %eax
jge 0x4f15
cltq
movq (%r14,%rax,8), %rsi
jmp 0x4f17
xorl %esi, %esi
incq %rdi
callq 0x4f3d
testl %eax, %eax
js 0x4f38
addl %eax, %r15d
cmpl %ebx, %r15d
jl 0x4ef9
jmp 0x4f30
movl %r15d, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
callq 0x4e88
// File: /workspace/github_c_makefile_star2_O3/Matthias-Wandel[P]imgcomp/src/config.c
// Function: keymatch
static int keymatch (const char * arg, const char * keyword, int minchars)
{
    int ca, ck, nmatched = 0;

    while ((ca = *arg++) != '\0') {
        if ((ck = *keyword++) == '\0') return 0;// arg longer than keyword, no good
        if (isupper(ca))  ca = tolower(ca);     // force arg to lcase (assume ck is already)
        if (ca != ck) return 0;                 // no good
        nmatched++;                             // count matched characters
    }
    // reached end of argument; fail if it's too short for unique abbrev 
    if (nmatched < minchars) return 0;
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movb (%rdi), %al
testb %al, %al
je 0x5a60
movq %rsi, %r15
movq %rdi, %r12
movl %edx, 0x4(%rsp)
xorl %r14d, %r14d
xorl %r13d, %r13d
movsbl (%r15,%r13), %ebx
testl %ebx, %ebx
je 0x5a6d
movsbl %al, %ebp
callq 0x3510
movq (%rax), %rax
movslq %ebp, %rcx
testb $0x1, 0x1(%rax,%rcx,2)
je 0x5a4a
movl %ebp, %edi
callq 0x3330
movl %eax, %ebp
cmpl %ebx, %ebp
jne 0x5a6d
movb 0x1(%r12,%r13), %al
incq %r13
testb %al, %al
jne 0x5a23
movl 0x4(%rsp), %edx
jmp 0x5a63
xorl %r13d, %r13d
xorl %r14d, %r14d
cmpl %edx, %r13d
setge %r14b
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Matthias-Wandel[P]imgcomp/src/config.c
// Function: ParseRegion
static int ParseRegion(Region_t * reg, const char * value)
{
    char * t;
    t = strstr(value, ",");
    if (t == NULL || t != value){
        // No comma, or comma not in first position.  Parse X parameters.
        if (sscanf(value, "%d-%d", &reg->x1, &reg->x2) != 2){
            if (sscanf(value, "%d+%d", &reg->x1, &reg->x2) != 2) return 0;
            reg->x2 += reg->x1;
        }
    }
    if (t != NULL){
        // Y parameters come after the comma.
        if (sscanf(t+1, "%d-%d", &reg->y1, &reg->y2) != 2){
            if (sscanf(t+1, "%d+%d", &reg->y1, &reg->y2) != 2) return 0;
            reg->y2 += reg->y1;
        }
    }
    if (reg->y2-reg->y1 < 16 || reg->x2-reg->x1 < 16){
        fprintf(stderr,"Detect region is too small\n");
        exit(-1);
    }
    printf("    Region is x:%d-%d, y:%d-%d\n",reg->x1, reg->x2, reg->y1, reg->y2);
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, %rdi
movl $0x2c, %esi
callq 0x3160
movq %rax, %r14
testq %rax, %rax
setne %al
cmpq %r15, %r14
sete %cl
testb %cl, %al
jne 0x5af9
leaq 0x4(%rbx), %r12
leaq 0x6987(%rip), %rsi      # 0xc43f
xorl %ebp, %ebp
movq %r15, %rdi
movq %rbx, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x3380
cmpl $0x2, %eax
je 0x5af4
leaq 0x6bc3(%rip), %rsi      # 0xc699
movq %r15, %rdi
movq %rbx, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x3380
cmpl $0x2, %eax
jne 0x5b77
movl (%rbx), %eax
addl %eax, 0x4(%rbx)
testq %r14, %r14
je 0x5b45
incq %r14
leaq 0x8(%rbx), %r15
leaq 0xc(%rbx), %r12
leaq 0x6934(%rip), %rsi      # 0xc43f
xorl %ebp, %ebp
movq %r14, %rdi
movq %r15, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x3380
cmpl $0x2, %eax
je 0x5b45
leaq 0x6b70(%rip), %rsi      # 0xc699
movq %r14, %rdi
movq %r15, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x3380
cmpl $0x2, %eax
jne 0x5b77
movl (%r15), %eax
addl %eax, (%r12)
movl 0x8(%rbx), %ecx
movl 0xc(%rbx), %r8d
movl %r8d, %eax
subl %ecx, %eax
cmpl $0x10, %eax
jl 0x5b82
movl (%rbx), %esi
movl 0x4(%rbx), %edx
movl %edx, %eax
subl %esi, %eax
cmpl $0xf, %eax
jle 0x5b82
leaq 0x6b50(%rip), %rdi      # 0xc6bb
xorl %eax, %eax
callq 0x3170
movl $0x1, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x36f3
nop
// File: /workspace/github_c_makefile_star2_O3/Matthias-Wandel[P]imgcomp/src/compare_util.c
// Function: ShowWeightMap
static void ShowWeightMap(ImgMap_t * WeightMap)
{
    int row, width, height;
    width = WeightMap->w;
    height = WeightMap->h;
    printf("Weight map (%dx%d):  '-' = ignore, '1' = normal, '#' = 2x weight\n",width, height);
	int skip = width/100;
	if (skip < 4) skip = 4;
    for (row=skip/2;row<height;row+=skip){
        int r;
        printf("  ");
        for (r=skip/2;r<width;r+=skip){
            switch (WeightMap->values[row*width+r]){
                case 0: putchar('-');break;
                case 1: putchar('1');break;
                case 2: putchar('#');break;
                default: 
				printf(" %d",WeightMap->values[row*width+r]);
				putchar('?'); break;
            }
        }
        printf("\n");
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r12
movl (%rdi), %eax
movl 0x4(%rdi), %ebx
movl %eax, 0x4(%rsp)
movslq %eax, %r14
leaq 0x5e06(%rip), %rdi      # 0xca75
movl %r14d, %esi
movl %ebx, %edx
xorl %eax, %eax
callq 0x3170
imulq $0x51eb851f, %r14, %rcx # imm = 0x51EB851F
movq %rcx, %rax
shrq $0x3f, %rax
sarq $0x25, %rcx
addl %eax, %ecx
cmpl $0x5, %ecx
movl $0x4, %eax
cmovgel %ecx, %eax
movl %eax, %r13d
shrl %r13d
movq %rbx, 0x10(%rsp)
cmpl %ebx, %r13d
jge 0x6d40
movl %eax, %r15d
leaq 0x1(%r14), %rax
imulq %r13, %rax
leaq (%r12,%rax,4), %rbp
addq $0x8, %rbp
movq %r14, %rax
imulq %r15, %rax
shlq $0x2, %rax
movq %rax, 0x8(%rsp)
movq %r13, %rbx
leaq 0x5ddc(%rip), %rdi      # 0xcab7
xorl %eax, %eax
callq 0x3170
cmpl 0x4(%rsp), %r13d
jge 0x6d27
xorl %r12d, %r12d
movl (%rbp,%r12,4), %esi
cmpq $0x3, %rsi
jae 0x6d03
leaq 0x5dd6(%rip), %rax      # 0xcad4
movl (%rax,%rsi,4), %edi
jmp 0x6d16
leaq 0x79a9(%rip), %rdi      # 0xe6b3
xorl %eax, %eax
callq 0x3170
movl $0x3f, %edi
callq 0x3050
addq %r15, %r12
leaq (%r12,%r13), %rax
cmpq %r14, %rax
jl 0x6cec
movl $0xa, %edi
callq 0x3050
addq %r15, %rbx
addq 0x8(%rsp), %rbp
cmpq 0x10(%rsp), %rbx
jb 0x6cd4
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Matthias-Wandel[P]imgcomp/src/compare_util.c
// Function: ProcessDiffMap
void ProcessDiffMap(MemImage_t * MapPic)
{
    int width, height, row, col;
    int firstrow, lastrow;
    int numred, numblue;
    width = MapPic->width;
    height = MapPic->height;

    // Allocate the detection region.
    WeightMap = malloc(offsetof(ImgMap_t, values) 
             + sizeof(WeightMap->values[0])*width*height);
    WeightMap->w = width; 
    WeightMap->h = height;

    numred = numblue = 0;
    firstrow = -1;
    lastrow = 0;

    for (row=0;row<height;row++){
        int * map;
        unsigned char * img;
        map = &WeightMap->values[width*row];
        img = &MapPic->pixels[width*3*row];
        for (col=0;col<width;col++){
            int r,g,b;
            r = img[0];
            g = img[1];
            b = img[2];
            img += 3;

            // If the map is blue, then ignore.
            // If the map is red, then wight 2x.

            if (b > 100 && b > (r+g)*2){
                // Blue.  Ignore.
                *map = 0;
                numblue += 1;
            }else{
                if (firstrow == -1) firstrow = row;
                lastrow = row;
                *map = 1;                
                if (r > 100 && r > (g+b)*2){
                    // Red.  Weigh 2x.
                    *map = 2;
                    numred += 1;
                }
            }
            map += 1;
        }
    }

    Regions.DetectReg.y1 = firstrow;
    Regions.DetectReg.y2 = lastrow;

    ShowWeightMap(WeightMap);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movslq (%rdi), %r14
movslq 0x4(%rdi), %r15
movq %r14, %rax
imulq %r15, %rax
leaq 0x8(,%rax,4), %rdi
callq 0x3340
movq %rax, %rcx
leaq 0xc683(%rip), %rax      # 0x13408
movq %rcx, (%rax)
movl %r14d, (%rcx)
movl %r15d, 0x4(%rcx)
movq %r15, 0x10(%rsp)
testq %r15, %r15
movq %rcx, (%rsp)
jle 0x6e4b
addq $0x8, %rcx
addq $0xc, %rbx
leaq (%r14,%r14,2), %rax
movq %rax, 0x8(%rsp)
movl %r14d, %edi
leaq (,%r14,4), %r8
xorl %r9d, %r9d
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
xorl %r10d, %r10d
movq %rbx, %r15
testl %r14d, %r14d
jle 0x6e39
movq %r9, %r11
imulq 0x8(%rsp), %r11
addq %rbx, %r11
xorl %r12d, %r12d
movzbl (%r11), %r13d
movzbl 0x1(%r11), %esi
movzbl 0x2(%r11), %ebp
cmpl $0x65, %ebp
jb 0x6dfe
leal (%rsi,%r13), %ebx
addl %ebx, %ebx
xorl %eax, %eax
cmpl %ebp, %ebx
jb 0x6e24
cmpl $-0x1, %edx
cmovel %r9d, %edx
movl $0x1, (%rcx,%r12,4)
cmpb $0x65, %r13b
jb 0x6e2a
addl %esi, %ebp
addl %ebp, %ebp
movl $0x2, %eax
movl %r9d, %r10d
cmpl %r13d, %ebp
jae 0x6e2d
movl %eax, (%rcx,%r12,4)
jmp 0x6e2d
movl %r9d, %r10d
incq %r12
addq $0x3, %r11
cmpl %r12d, %edi
jne 0x6ddf
incq %r9
addq %r8, %rcx
cmpq 0x10(%rsp), %r9
movq %r15, %rbx
jne 0x6dcb
jmp 0x6e53
xorl %r10d, %r10d
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
leaq 0xbf5e(%rip), %rax      # 0x12db8
movl %edx, 0x8(%rax)
movl %r10d, 0xc(%rax)
movq (%rsp), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6c4b
// File: /workspace/github_c_makefile_star2_O3/Matthias-Wandel[P]imgcomp/src/compare_util.c
// Function: AverageBright
double AverageBright(MemImage_t * pic, Region_t Region, ImgMap_t* WeightMap)
{
    double baverage;//
    int DetectionPixels;
    int row;
    int rowbytes = pic->width*3;
    DetectionPixels = 0;
 
    // Compute average brightnesses.
    baverage = 0;//rzaverage = 0;
    for (row=Region.y1;row<Region.y2;row++){
        unsigned char *p1;
		int *px;
        int col, brow = 0;//, redrow = 0;
        p1 = pic->pixels+rowbytes*row;
        px = &WeightMap->values[pic->width*row];
        for (col=Region.x1;col<Region.x2;col++){
            if (px[col]){
                int bv;
                bv = p1[0]+p1[1]*2+p1[2];  // Multiplies by 4.
                brow += bv;
                DetectionPixels += 1;
            }
            p1 += 3;
        }
        baverage += brow;
    }

    if (DetectionPixels < 1000){
        fprintf(stderr, "Detection region too small");
        exit(-1);
    }
   
    return baverage * 0.25 / DetectionPixels; // Multiply by 4 again.
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rax
shrq $0x20, %rax
cmpl %eax, %edx
jge 0x6f82
movq %rsi, %rax
shrq $0x20, %rax
movslq (%rdi), %r8
leal (%r8,%r8,2), %r11d
movslq %esi, %r9
movq %r9, 0x10(%rsp)
movslq %edx, %r10
movslq %r11d, %r9
sarq $0x20, %rdx
movq %rsi, %rbx
sarq $0x20, %rbx
movq %r8, %r14
imulq %r10, %r14
leaq (%rcx,%r14,4), %r14
addq $0x8, %r14
shlq $0x2, %r8
movq %r9, %rcx
imulq %r10, %rcx
addq %rcx, %rdi
addq $0xe, %rdi
xorl %ecx, %ecx
xorpd %xmm0, %xmm0
movq %r8, 0x8(%rsp)
cmpl %eax, %esi
jge 0x6f42
movq %r9, %r8
movq %rax, %r11
xorl %r15d, %r15d
movq %rdi, %r12
movq 0x10(%rsp), %r13
cmpl $0x0, (%r14,%r13,4)
je 0x6f21
movzbl -0x2(%r12), %ebp
movzbl -0x1(%r12), %r9d
movzbl (%r12), %eax
addl %ebp, %r15d
leal (%r15,%r9,2), %r15d
addl %eax, %r15d
incl %ecx
incq %r13
addq $0x3, %r12
cmpq %r13, %rbx
jne 0x6efd
xorps %xmm1, %xmm1
cvtsi2sd %r15d, %xmm1
movq %r11, %rax
movq %r8, %r9
movq 0x8(%rsp), %r8
jmp 0x6f46
xorpd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %r10
addq %r8, %r14
addq %r9, %rdi
cmpq %rdx, %r10
jne 0x6ee8
cmpl $0x3e7, %ecx            # imm = 0x3E7
jle 0x6f82
mulsd 0x5aa8(%rip), %xmm0     # 0xca10
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
divsd %xmm1, %xmm0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x379a
// File: /workspace/github_c_makefile_star2_O3/Matthias-Wandel[P]imgcomp/src/compare_util.c
// Function: MakeImgMap
ImgMap_t * MakeImgMap(int w,int h)
{
	ImgMap_t * ImgMap = malloc(sizeof(int)*w*h+sizeof(ImgMap_t));
	memset(ImgMap, 0, sizeof(int)*w*h+sizeof(ImgMap_t));
	ImgMap->w = w;
	ImgMap->h = h;
	return ImgMap;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movslq %edi, %rbx
movslq %esi, %r14
movq %rbx, %rax
imulq %r14, %rax
leaq 0x8(,%rax,4), %rsi
movl $0x1, %edi
callq 0x3240
movl %ebx, (%rax)
movl %r14d, 0x4(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/Matthias-Wandel[P]imgcomp/src/compare_util.c
// Function: ShowImgMap
void ShowImgMap(ImgMap_t * map, int divisor)
{
	int w = map->w;
    fprintf(Log," ");
	for (int c=0;c<map->w;c++) fprintf(Log,"%2d",c%10);
	fprintf(Log,"\n");
	for (int r=0;r<map->h;r++){
		fprintf(Log,"%c",r%10 == 0 ? '=' : '|');
		for (int c=0;c<map->w;c++){
			const char LowDigits[20] = "   - = 3 4~5~6~7=8=9";
			int v = map->values[r*w+c]/divisor;
            if (v < 10){
                fprintf(Log,"%c%c",LowDigits[v*2],LowDigits[v*2+1]);
            }else{
                fprintf(Log,"%2d",v <= 99 ? v : 99);
            }
		}
		fprintf(Log,"%c\n",r%10 == 0 ? '=' : '|');
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebx
movq %rdi, %r14
movslq (%rdi), %rax
movq %rax, 0x8(%rsp)
leaq 0xbfde(%rip), %r13      # 0x12fb8
movq (%r13), %rsi
movl $0x20, %edi
callq 0x3200
cmpl $0x0, (%r14)
jle 0x7025
movl $0xcccccccd, %r12d      # imm = 0xCCCCCCCD
leaq 0x5a5d(%rip), %r15      # 0xca58
xorl %ebp, %ebp
movl %ebp, %eax
imulq %r12, %rax
shrq $0x23, %rax
addl %eax, %eax
leal (%rax,%rax,4), %eax
movq (%r13), %rdi
movl %ebp, %edx
subl %eax, %edx
movq %r15, %rsi
xorl %eax, %eax
callq 0x32a0
incl %ebp
cmpl (%r14), %ebp
jl 0x6ffd
movq (%r13), %rsi
movl $0xa, %edi
callq 0x3200
cmpl $0x0, 0x4(%r14)
jle 0x7114
leaq 0x8(%r14), %r15
shlq $0x2, 0x8(%rsp)
leaq 0x5a71(%rip), %r12      # 0xcac0
xorl %ecx, %ecx
movq %r13, %rbp
movq (%r13), %rsi
movq %rcx, 0x10(%rsp)
imull $0xcccccccd, %ecx, %eax # imm = 0xCCCCCCCD
rorl %eax
cmpl $0x1999999a, %eax       # imm = 0x1999999A
movl $0x7c, %edi
movl $0x3d, %eax
cmovbl %eax, %edi
movl %edi, 0x4(%rsp)
callq 0x3200
cmpl $0x0, (%r14)
jle 0x70e1
xorl %r13d, %r13d
movl (%r15,%r13,4), %eax
cltd
idivl %ebx
movq (%rbp), %rdi
cmpl $0x9, %eax
jg 0x70bb
cltq
movsbl (%r12,%rax,2), %edx
addq %rax, %rax
cltq
movsbl 0x1(%rax,%r12), %ecx
leaq 0x59aa(%rip), %rsi      # 0xca5c
xorl %eax, %eax
callq 0x32a0
jmp 0x70d6
cmpl $0x63, %eax
movl $0x63, %ecx
cmovael %ecx, %eax
leaq 0x598b(%rip), %rsi      # 0xca58
movl %eax, %edx
xorl %eax, %eax
callq 0x32a0
incq %r13
movslq (%r14), %rax
cmpq %rax, %r13
jl 0x7089
movq %rbp, %r13
movq (%rbp), %rdi
leaq 0x5972(%rip), %rsi      # 0xca61
movl 0x4(%rsp), %edx
xorl %eax, %eax
callq 0x32a0
movq 0x10(%rsp), %rcx
incq %rcx
movslq 0x4(%r14), %rax
addq 0x8(%rsp), %r15
cmpq %rax, %rcx
jl 0x7051
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Matthias-Wandel[P]imgcomp/src/compare_util.c
// Function: BloomImgMap
void BloomImgMap(ImgMap_t * src, ImgMap_t * dst)
{
	int w = src->w;
	int h = src->h;

	// Bloom vertically while copying to dst array
	for (int r=0;r<h;r++){
		int * row = src->values+src->w*r;
		int * prevrow, *nextrow;
		prevrow = src->values+src->w*(r-1);
		if (r ==0) prevrow = src->values;
		
		nextrow = src->values+src->w*(r+1);
		if (r >= h-1) nextrow = row;

		int * dstrow = dst->values+src->w*r;
		
		for (int c=0;c<w;c++){
			int nv = row[c];
			if (nv < prevrow[c]) nv = prevrow[c];
			if (nv < nextrow[c]) nv = nextrow[c];
			dstrow[c] = nv;
		}
	}

	// Bloom horizontally in place
	for (int r=0;r<h;r++){
		int * row = dst->values+src->w*r;
		
		int pv = 0;
		int c;
		for (c=0;c<w-1;c++){
			int nv = row[c];
			if (nv < pv) nv = pv;
			if (row[c+1]>nv) nv = row[c+1];
			pv = row[c];
			row[c] = nv;
		}
		if (row[c] < pv) row[c] = pv;
	}

}

// Assembly:
movl 0x4(%rdi), %eax
testl %eax, %eax
jle 0x7242
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl (%rdi), %ecx
leaq 0x8(%rdi), %r8
leal -0x1(%rax), %r9d
movq %rsi, -0x8(%rsp)
leaq 0x8(%rsi), %rdx
xorl %esi, %esi
xorl %r11d, %r11d
movl %r11d, %r14d
movl (%rdi), %ebp
leal -0x1(%r14), %ebx
imull %ebp, %ebx
cmpl $0x1, %r11d
cmovbl %esi, %ebx
leal 0x1(%r14), %r11d
testl %ecx, %ecx
jle 0x71bf
movl %ebp, %r15d
imull %r14d, %r15d
movslq %r15d, %r12
movslq %ebx, %rbx
leaq (%r8,%rbx,4), %rbx
imull %r11d, %ebp
cmpl %r9d, %r14d
movslq %ebp, %r14
cmovgeq %r12, %r14
leaq (%r8,%r14,4), %r14
leaq (%rdx,%r12,4), %r15
leaq (%r8,%r12,4), %r12
xorl %r13d, %r13d
movl (%r12,%r13,4), %ebp
movl (%rbx,%r13,4), %r10d
cmpl %r10d, %ebp
cmovgl %ebp, %r10d
movl (%r14,%r13,4), %ebp
cmpl %ebp, %r10d
cmovlel %ebp, %r10d
movl %r10d, (%r15,%r13,4)
incq %r13
cmpq %r13, %rcx
jne 0x7199
cmpl %eax, %r11d
jne 0x7150
testl %eax, %eax
movq -0x8(%rsp), %r15
jle 0x7238
leal -0x1(%rcx), %r8d
addq $0xc, %r15
xorl %r9d, %r9d
movl (%rdi), %esi
imull %r9d, %esi
movslq %esi, %r11
leaq (%rdx,%r11,4), %r10
cmpl $0x2, %ecx
jl 0x7221
movl (%r10), %ebp
leaq (%r15,%r11,4), %rbx
xorl %r14d, %r14d
xorl %r11d, %r11d
movl %r11d, %esi
movl %ebp, %r11d
cmpl %esi, %ebp
cmovgl %ebp, %esi
movl (%rbx,%r14,4), %ebp
cmpl %esi, %ebp
cmovgl %ebp, %esi
movl %esi, -0x4(%rbx,%r14,4)
leaq 0x1(%r14), %rsi
movq %rsi, %r14
cmpq %rsi, %r8
jne 0x71f7
movq %r8, %rbx
jmp 0x7226
xorl %r11d, %r11d
xorl %ebx, %ebx
cmpl %r11d, (%r10,%rbx,4)
jge 0x7230
movl %r11d, (%r10,%rbx,4)
incl %r9d
cmpl %eax, %r9d
jne 0x71d8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Matthias-Wandel[P]imgcomp/src/jpeg2mem.c
// Function: WritePpmFile
void WritePpmFile(char * FileName, MemImage_t *MemImage)
{
    FILE * outfile;
    outfile = fopen(FileName,"wb");
    if (outfile == NULL){
        fprintf(Log,"could not open outfile\n");
        return;
    }
    fprintf(outfile, "P%c\n%d %d\n%d\n", MemImage->components == 3 ? '6' : '5',  
            MemImage->width, MemImage->height, 255);
    fwrite(MemImage->pixels, 1, MemImage->width * MemImage->height*MemImage->components, outfile);
    fclose(outfile);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
leaq 0x53a9(%rip), %rsi      # 0xcb33
callq 0x3430
testq %rax, %rax
je 0x77f5
movq %rax, %rbx
xorl %edx, %edx
cmpl $0x3, 0x8(%r14)
sete %dl
addl $0x35, %edx
movl (%r14), %ecx
movl 0x4(%r14), %r8d
leaq 0x539c(%rip), %rsi      # 0xcb4e
movq %rax, %rdi
movl $0xff, %r9d
xorl %eax, %eax
callq 0x32a0
leaq 0xc(%r14), %rdi
movslq (%r14), %rax
movslq 0x4(%r14), %rcx
imulq %rax, %rcx
movslq 0x8(%r14), %rdx
imulq %rcx, %rdx
movl $0x1, %esi
movq %rbx, %rcx
callq 0x34a0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3110
leaq 0xb7bc(%rip), %rax      # 0x12fb8
movq (%rax), %rcx
leaq 0x5330(%rip), %rdi      # 0xcb36
movl $0x17, %esi
movl $0x1, %edx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x34a0
// File: /workspace/github_c_makefile_star2_O3/Matthias-Wandel[P]imgcomp/src/jpgfile.c
// Function: ErrNonfatal
void ErrNonfatal(const char * msg, int a1, int a2)
{
    if (SupressNonFatalErrors) return;

    fprintf(Log,"\nNonfatal Error : ");
    fprintf(Log, msg, a1, a2);
    fprintf(Log, "\n");
}

// Assembly:
cmpl $0x0, 0xbc31(%rip)      # 0x13454
je 0x7826
retq
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
leaq 0xb77d(%rip), %r15      # 0x12fb8
movq (%r15), %rcx
leaq 0x5317(%rip), %rdi      # 0xcb5c
movl $0x12, %esi
movl $0x1, %edx
callq 0x34a0
movq (%r15), %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x32a0
movq (%r15), %rsi
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3200
// File: /workspace/github_c_makefile_star2_O3/Matthias-Wandel[P]imgcomp/src/exif.c
// Function: Get32s
int Get32s(void * Long)
{
    if (MotorolaOrder){
        return  ((( char *)Long)[0] << 24) | (((uchar *)Long)[1] << 16)
              | (((uchar *)Long)[2] << 8 ) | (((uchar *)Long)[3] << 0 );
    }else{
        return  ((( char *)Long)[3] << 24) | (((uchar *)Long)[2] << 16)
              | (((uchar *)Long)[1] << 8 ) | (((uchar *)Long)[0] << 0 );
    }
}

// Assembly:
cmpl $0x0, 0xc989(%rip)      # 0x1451c
je 0x7bb3
movzbl (%rdi), %eax
shll $0x18, %eax
movzbl 0x1(%rdi), %edx
shll $0x10, %edx
orl %eax, %edx
movzbl 0x2(%rdi), %ecx
shll $0x8, %ecx
orl %edx, %ecx
addq $0x3, %rdi
jmp 0x7bcc
movzbl 0x3(%rdi), %eax
shll $0x18, %eax
movzbl 0x2(%rdi), %edx
shll $0x10, %edx
orl %eax, %edx
movzbl 0x1(%rdi), %ecx
shll $0x8, %ecx
orl %edx, %ecx
movzbl (%rdi), %eax
orl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/Matthias-Wandel[P]imgcomp/src/exif.c
// Function: Put32u
void Put32u(void * Value, unsigned PutValue)
{
    if (MotorolaOrder){
        ((uchar *)Value)[0] = (uchar)(PutValue>>24);
        ((uchar *)Value)[1] = (uchar)(PutValue>>16);
        ((uchar *)Value)[2] = (uchar)(PutValue>>8);
        ((uchar *)Value)[3] = (uchar)PutValue;
    }else{
        ((uchar *)Value)[0] = (uchar)PutValue;
        ((uchar *)Value)[1] = (uchar)(PutValue>>8);
        ((uchar *)Value)[2] = (uchar)(PutValue>>16);
        ((uchar *)Value)[3] = (uchar)(PutValue>>24);
    }
}

// Assembly:
movl %esi, %eax
shrl $0x10, %eax
cmpl $0x0, 0xc93e(%rip)      # 0x1451c
je 0x7bee
movl %esi, %ecx
shrl $0x18, %ecx
movl %eax, %edx
movl %esi, %eax
shrl $0x8, %eax
jmp 0x7bf8
movl %esi, %edx
shrl $0x8, %edx
movl %esi, %ecx
shrl $0x18, %esi
movb %cl, (%rdi)
movb %dl, 0x1(%rdi)
movb %al, 0x2(%rdi)
movb %sil, 0x3(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/Matthias-Wandel[P]imgcomp/src/exif.c
// Function: ConvertAnyFormat
double ConvertAnyFormat(void * ValuePtr, int Format)
{
    double Value;
    Value = 0;

    switch(Format){
        case FMT_SBYTE:     Value = *(signed char *)ValuePtr;  break;
        case FMT_BYTE:      Value = *(uchar *)ValuePtr;        break;

        case FMT_USHORT:    Value = Get16u(ValuePtr);          break;
        case FMT_ULONG:     Value = Get32u(ValuePtr);          break;

        case FMT_URATIONAL:
        case FMT_SRATIONAL: 
            {
                int Num,Den;
                Num = Get32s(ValuePtr);
                Den = Get32s(4+(char *)ValuePtr);
                if (Den == 0){
                    Value = 0;
                }else{
                    if (Format == FMT_SRATIONAL){
                        Value = (double)Num/Den;
                    }else{
                        Value = (double)(unsigned)Num/(double)(unsigned)Den;
                    }
                }
                break;
            }

        case FMT_SSHORT:    Value = (signed short)Get16u(ValuePtr);  break;
        case FMT_SLONG:     Value = Get32s(ValuePtr);                break;

        // Not sure if this is correct (never seen float used in Exif format)
        case FMT_SINGLE:    Value = (double)*(float *)ValuePtr;      break;
        case FMT_DOUBLE:    Value = *(double *)ValuePtr;             break;

        default:
            ErrNonfatal("Illegal format code %d in Exif header",Format,0);
    }
    return Value;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
leal -0x1(%r14), %eax
cmpl $0xb, %eax
ja 0x7e47
movq %rdi, %rbx
leaq 0x4ead(%rip), %rcx      # 0xcc8c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbx, %rdi
callq 0x7b8c
movl %eax, %ebp
addq $0x4, %rbx
movq %rbx, %rdi
callq 0x7b8c
testl %eax, %eax
je 0x7e58
cmpl $0xa, %r14d
jne 0x7e83
cvtsi2sd %ebp, %xmm0
cvtsi2sd %eax, %xmm1
jmp 0x7e91
movsbl (%rbx), %eax
jmp 0x7ea0
movq %rbx, %rdi
callq 0x7b8c
movl %eax, %eax
cvtsi2sd %rax, %xmm0
jmp 0x7ea4
cmpl $0x0, 0xc6ea(%rip)      # 0x1451c
je 0x7e97
movzwl (%rbx), %eax
rolw $0x8, %ax
jmp 0x7e9a
movq %rbx, %rdi
callq 0x7b8c
jmp 0x7ea0
leaq 0x5049(%rip), %rdi      # 0xce97
movl %r14d, %esi
xorl %edx, %edx
callq 0x781c
xorps %xmm0, %xmm0
jmp 0x7ea4
movzbl (%rbx), %eax
jmp 0x7ea0
cmpl $0x0, 0xc6b3(%rip)      # 0x1451c
je 0x7e9d
movzwl (%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %eax
jmp 0x7ea0
movsd (%rbx), %xmm0
jmp 0x7ea4
cvtss2sd (%rbx), %xmm0
jmp 0x7ea4
movl %ebp, %ecx
cvtsi2sd %rcx, %xmm0
movl %eax, %eax
cvtsi2sd %rax, %xmm1
divsd %xmm1, %xmm0
jmp 0x7ea4
movzwl (%rbx), %eax
cwtl
jmp 0x7ea0
movzwl (%rbx), %eax
cvtsi2sd %eax, %xmm0
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Matthias-Wandel[P]imgcomp/src/exif.c
// Function: Exif2tm
int Exif2tm(struct tm * timeptr, char * ExifTime)
{
    int a;

    timeptr->tm_wday = -1;

    // Check for format: YYYY:MM:DD HH:MM:SS format.
    // Date and time normally separated by a space, but also seen a ':' there, so
    // skip the middle space with '%*c' so it can be any character.
    timeptr->tm_sec = 0;
    a = sscanf(ExifTime, "%d%*c%d%*c%d%*c%d:%d:%d",
            &timeptr->tm_year, &timeptr->tm_mon, &timeptr->tm_mday,
            &timeptr->tm_hour, &timeptr->tm_min, &timeptr->tm_sec);

    if (a >= 5){
        if (timeptr->tm_year <= 12 && timeptr->tm_mday > 2000 && ExifTime[2] == '.'){
            // LG Electronics VX-9700 seems to encode the date as 'MM.DD.YYYY HH:MM'
            // can't these people read the standard?  At least they left enough room
            // in the header to put an Exif format date in there.
            int tmp;
            tmp = timeptr->tm_year;
            timeptr->tm_year = timeptr->tm_mday;
            timeptr->tm_mday = timeptr->tm_mon;
            timeptr->tm_mon = tmp;
        }

        // Accept five or six parameters.  Some cameras do not store seconds.
        timeptr->tm_isdst = -1;  
        timeptr->tm_mon -= 1;      // Adjust for unix zero-based months 
        timeptr->tm_year -= 1900;  // Adjust for year starting at 1900 
        return TRUE; // worked. 
    }

    return FALSE; // Wasn't in Exif date format.
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
movl $0xffffffff, 0x18(%rdi) # imm = 0xFFFFFFFF
movl $0x0, (%rdi)
leaq 0x14(%rdi), %r13
leaq 0x10(%rdi), %r14
leaq 0xc(%rdi), %r12
leaq 0x8(%rdi), %r9
leaq 0x4(%rdi), %r10
leaq 0x4584(%rip), %rsi      # 0xcf7c
xorl %ebp, %ebp
movq %r15, %rdi
movq %r13, %rdx
movq %r14, %rcx
movq %r12, %r8
xorl %eax, %eax
pushq %rbx
pushq %r10
callq 0x3380
addq $0x10, %rsp
cmpl $0x5, %eax
jl 0x8a59
movl (%r13), %ecx
cmpl $0xc, %ecx
jg 0x8a40
movl (%r12), %eax
cmpl $0x7d1, %eax            # imm = 0x7D1
jl 0x8a40
cmpb $0x2e, 0x2(%r15)
jne 0x8a40
movl (%r14), %edx
movl %edx, (%r12)
movl %ecx, (%r14)
jmp 0x8a42
movl %ecx, %eax
movl $0xffffffff, 0x20(%rbx) # imm = 0xFFFFFFFF
decl 0x10(%rbx)
addl $0xfffff894, %eax       # imm = 0xFFFFF894
movl %eax, 0x14(%rbx)
movl $0x1, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Matthias-Wandel[P]imgcomp/src/exif.c
// Function: ShowConciseImageInfo
void ShowConciseImageInfo(void)
{
    printf("\"%s\"",ImageInfo.FileName);

    printf(" %dx%d",ImageInfo.Width, ImageInfo.Height);

    if (ImageInfo.ExposureTime){
        if (ImageInfo.ExposureTime <= 0.5){
            printf(" (1/%d)",(int)(0.5 + 1/ImageInfo.ExposureTime));
        }else{
            printf(" (%1.1f)",ImageInfo.ExposureTime);
        }
    }

    if (ImageInfo.ApertureFNumber){
        printf(" f/%3.1f",(double)ImageInfo.ApertureFNumber);
    }

    if (ImageInfo.FocalLength35mmEquiv){
        printf(" f(35)=%dmm",ImageInfo.FocalLength35mmEquiv);
    }

    if (ImageInfo.FlashUsed >= 0 && ImageInfo.FlashUsed & 1){
        printf(" (flash)");
    }

    printf("\n");
}

// Assembly:
pushq %rbx
leaq 0x21d0(%rip), %rdi      # 0xb1ab
leaq 0xa476(%rip), %rbx      # 0x13458
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3170
movl 0x1064(%rbx), %edx
movl 0x1068(%rbx), %esi
leaq 0x43d0(%rip), %rdi      # 0xd3cf
xorl %eax, %eax
callq 0x3170
movss 0x1080(%rbx), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x9018
jnp 0x9069
movss 0x3e38(%rip), %xmm1     # 0xce58
ucomiss %xmm0, %xmm1
jae 0x9039
cvtss2sd %xmm0, %xmm0
leaq 0x43a6(%rip), %rdi      # 0xd3d6
movb $0x1, %al
callq 0x3170
jmp 0x9066
movss 0x3e13(%rip), %xmm1     # 0xce54
divss %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
addsd 0x36a4(%rip), %xmm0     # 0xc6f8
cvttsd2si %xmm0, %esi
leaq 0x42cd(%rip), %rdi      # 0xd32c
xorl %eax, %eax
callq 0x3170
xorps %xmm1, %xmm1
movss 0x1084(%rbx), %xmm0
ucomiss %xmm1, %xmm0
jne 0x9078
jnp 0x908a
cvtss2sd %xmm0, %xmm0
leaq 0x435c(%rip), %rdi      # 0xd3df
movb $0x1, %al
callq 0x3170
movl 0x1094(%rbx), %esi
testl %esi, %esi
je 0x90a2
leaq 0x434d(%rip), %rdi      # 0xd3e8
xorl %eax, %eax
callq 0x3170
movl $0x80000001, %eax       # imm = 0x80000001
andl 0x1078(%rbx), %eax
cmpl $0x1, %eax
jne 0x90c0
leaq 0x433b(%rip), %rdi      # 0xd3f4
xorl %eax, %eax
callq 0x3170
movl $0xa, %edi
popq %rbx
jmp 0x3050
nop
// File: /workspace/github_c_makefile_star2_O3/Matthias-Wandel[P]imgcomp/src/util.c
// Function: CatPath
char * CatPath(char *Dir, char * FileName)
{
    static char catpath[502];
    int pathlen;

    pathlen = strlen(Dir);
    if (pathlen > 300){
        fprintf(Log, "path too long!");
        exit(-1);
    }
    memcpy(catpath, Dir, pathlen+1);
    if (catpath[pathlen-1] != '/' && catpath[pathlen-1] != '\\'){
        catpath[pathlen] = '/';
        pathlen += 1;
    }
    strncpy(catpath+pathlen, FileName,256);
    return catpath;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r12
callq 0x3130
movq %rax, %r15
cmpl $0x12d, %r15d           # imm = 0x12D
jge 0x98bb
movl %r15d, %r13d
leal 0x1(%r13), %ebp
movslq %ebp, %rdx
leaq 0xae35(%rip), %r14      # 0x14690
movq %r14, %rdi
movq %r12, %rsi
callq 0x32d0
shlq $0x20, %r15
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
addq %r15, %rax
sarq $0x20, %rax
movzbl (%rax,%r14), %eax
cmpl $0x2f, %eax
je 0x9896
cmpl $0x5c, %eax
je 0x9896
sarq $0x20, %r15
movb $0x2f, (%r15,%r14)
movl %ebp, %r13d
movslq %r13d, %rdi
addq %r14, %rdi
movl $0x100, %edx            # imm = 0x100
movq %rbx, %rsi
callq 0x3090
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x96f6(%rip), %rax      # 0x12fb8
movq (%rax), %rcx
leaq 0x4988(%rip), %rdi      # 0xe254
movl $0xe, %esi
movl $0x1, %edx
callq 0x34a0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x3490