#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
size_t fread(char *, int, size_t, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
scalar_t__ ftell(int /*<<< orphan*/ *);
size_t fwrite(char *, int, size_t, int /*<<< orphan*/ *);
char *malloc(int);
int pow(int, double);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int rc = 0, i = 0, l = 0, offset = 0, byte = 0;
  size_t in_filesize = 0, out_filesize = 0;
  char *in_filename = NULL, *out_filename = NULL, *in_data = NULL,
       *out_data = NULL;
  FILE *in = NULL, *out = NULL;
  if (argc < 3) {
    printf("psdthumb (v%s)\n\nUsage: psdthumb <in.psd> <out.jpg>\n", "1.0.1");
    rc = 1;
    goto cleanup;
  }
  in_filename = argv[1];
  out_filename = argv[2];
  in = fopen(in_filename, "r");
  out = fopen(out_filename, "w+");
  if (!in) {
    printf("Could not open %s\n", in_filename);
    rc = 1;
    goto cleanup;
  }
  if (!out) {
    printf("Could not open %s\n", out_filename);
    rc = 1;
    goto cleanup;
  }
  (void)fseek(in, 0, SEEK_END);
  in_filesize = (size_t)ftell(in);
  (void)fseek(in, 0, SEEK_SET);
  in_data = malloc(sizeof(char) * in_filesize + 1);
  if (fread(in_data, 1, in_filesize, in) != (size_t)in_filesize) {
    printf("Unable to read file: %s\n", in_filename);
    rc = 1;
    goto cleanup;
  }
  if (in_data[0] != '8' || in_data[1] != 'B' || in_data[2] != 'P' ||
      in_data[3] != 'S') {
    printf("Not a PSD file\n");
    rc = 1;
    goto cleanup;
  }
  for (i = 0, l = (int)in_filesize; i < l; i++) {
    if (in_data[i] == '8' && in_data[i + 1] == 'B' && in_data[i + 2] == 'I' &&
        in_data[i + 3] == 'M') {
      if ((in_data[i + 4] == (char)4 && in_data[i + 5] == (char)9) ||
          (in_data[i + 4] == (char)4 && in_data[i + 5] == (char)12)) {
        offset = i + 6 + 2;
        break;
      }
    }
  }
  for (i = 0, l = 3; i <= 4; i++) {
    byte = (int)in_data[offset++];
    byte += byte < 0 ? 256 : 0;
    out_filesize += byte * pow(256, (double)(l - i));
  }
  offset += 27;
  out_filesize -= 28;
  out_data = malloc(sizeof(char) * out_filesize + 1);
  for (i = 0, l = (int)out_filesize; i < l; i++) {
    out_data[i] = in_data[offset++];
  }
  if (fwrite(out_data, 1, out_filesize, out) != (size_t)out_filesize) {
    printf("Error writing %s\n", out_filename);
    rc = 1;
    goto cleanup;
  }
cleanup:
  if (in) {
    (void)fclose(in);
  }
  if (out) {
    (void)fclose(out);
  }
  if (in_data) {
    free(in_data);
  }
  if (out_data) {
    free(out_data);
  }
  return rc;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
movq   $0x0,-0x60(%rbp)
movq   $0x0,-0x68(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1244 <main+0xa4>
lea    0xdd6(%rip),%rdi
lea    0xe03(%rip),%rsi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x14(%rbp)
jmp    1603 <main+0x463>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rdi
lea    0xdd3(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x60(%rbp)
mov    -0x48(%rbp),%rdi
lea    0xdc1(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    12ad <main+0x10d>
mov    -0x40(%rbp),%rsi
lea    0xda5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x14(%rbp)
jmp    1603 <main+0x463>
cmpq   $0x0,-0x68(%rbp)
jne    12d6 <main+0x136>
mov    -0x48(%rbp),%rsi
lea    0xd7c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x14(%rbp)
jmp    1603 <main+0x463>
mov    -0x60(%rbp),%rdi
mov    0x2d07(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1090 <fseek@plt>
mov    -0x60(%rbp),%rdi
call   1070 <ftell@plt>
mov    %rax,-0x30(%rbp)
mov    -0x60(%rbp),%rdi
mov    0x2cd6(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1090 <fseek@plt>
mov    -0x30(%rbp),%rax
shl    $0x0,%rax
add    $0x1,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    -0x60(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
cmp    -0x30(%rbp),%rax
je     1360 <main+0x1c0>
mov    -0x40(%rbp),%rsi
lea    0xd05(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x14(%rbp)
jmp    1603 <main+0x463>
mov    -0x50(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x38,%eax
jne    13a3 <main+0x203>
mov    -0x50(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x42,%eax
jne    13a3 <main+0x203>
mov    -0x50(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x50,%eax
jne    13a3 <main+0x203>
mov    -0x50(%rbp),%rax
movsbl 0x3(%rax),%eax
cmp    $0x53,%eax
je     13bd <main+0x21d>
lea    0xcc1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x14(%rbp)
jmp    1603 <main+0x463>
movl   $0x0,-0x18(%rbp)
mov    -0x30(%rbp),%rax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    14cb <main+0x32b>
mov    -0x50(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x38,%eax
jne    14b8 <main+0x318>
mov    -0x50(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x42,%eax
jne    14b8 <main+0x318>
mov    -0x50(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x49,%eax
jne    14b8 <main+0x318>
mov    -0x50(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x4d,%eax
jne    14b8 <main+0x318>
mov    -0x50(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x4,%eax
jne    146e <main+0x2ce>
mov    -0x50(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x5,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x9,%eax
je     14a2 <main+0x302>
mov    -0x50(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x4,%eax
jne    14b3 <main+0x313>
mov    -0x50(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x5,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xc,%eax
jne    14b3 <main+0x313>
mov    -0x18(%rbp),%eax
add    $0x6,%eax
add    $0x2,%eax
mov    %eax,-0x20(%rbp)
jmp    14cb <main+0x32b>
jmp    14b8 <main+0x318>
jmp    14bd <main+0x31d>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    13cb <main+0x22b>
movl   $0x0,-0x18(%rbp)
movl   $0x3,-0x1c(%rbp)
cmpl   $0x4,-0x18(%rbp)
jg     154c <main+0x3ac>
mov    -0x50(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x20(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edx
xor    %eax,%eax
mov    $0x100,%ecx
cmp    $0x0,%edx
cmovl  %ecx,%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x1c(%rbp),%eax
sub    -0x18(%rbp),%eax
cvtsi2sd %eax,%xmm0
mov    $0x100,%edi
call   10b0 <pow@plt>
mov    %eax,%ecx
mov    -0x6c(%rbp),%eax
imul   %ecx,%eax
cltq
add    -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    14d9 <main+0x339>
mov    -0x20(%rbp),%eax
add    $0x1b,%eax
mov    %eax,-0x20(%rbp)
mov    -0x38(%rbp),%rax
sub    $0x1c,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
shl    $0x0,%rax
add    $0x1,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x38(%rbp),%rax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    15c0 <main+0x420>
mov    -0x50(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x20(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x58(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1586 <main+0x3e6>
mov    -0x58(%rbp),%rdi
mov    -0x38(%rbp),%rdx
mov    -0x68(%rbp),%rcx
mov    $0x1,%esi
call   10c0 <fwrite@plt>
cmp    -0x38(%rbp),%rax
je     15fe <main+0x45e>
mov    -0x48(%rbp),%rsi
lea    0xa90(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x14(%rbp)
jmp    1603 <main+0x463>
jmp    1603 <main+0x463>
cmpq   $0x0,-0x60(%rbp)
je     1617 <main+0x477>
mov    -0x60(%rbp),%rdi
call   1050 <fclose@plt>
cmpq   $0x0,-0x68(%rbp)
je     162b <main+0x48b>
mov    -0x68(%rbp),%rdi
call   1050 <fclose@plt>
cmpq   $0x0,-0x50(%rbp)
je     163f <main+0x49f>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x58(%rbp)
je     1653 <main+0x4b3>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
cmp    $0x2,%edi
jg     11f2 <main+0x32>
lea    0xe46(%rip),%rdi
lea    0xe73(%rip),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%ebp
jmp    13b9 <main+0x1f9>
mov    0x8(%rsi),%r12
mov    0x10(%rsi),%rbp
lea    0xe59(%rip),%rsi
mov    %r12,%rdi
call   10c0 <fopen@plt>
mov    %rax,%r15
lea    0xe49(%rip),%rsi
mov    %rbp,%rdi
call   10c0 <fopen@plt>
mov    %rax,%r14
test   %r15,%r15
je     1328 <main+0x168>
test   %r14,%r14
je     134a <main+0x18a>
mov    %rbp,0x30(%rsp)
mov    0x2dac(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   10b0 <fseek@plt>
mov    %r15,%rdi
call   1080 <ftell@plt>
mov    %rax,%rbx
mov    0x2d7e(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   10b0 <fseek@plt>
lea    0x1(%rbx),%edi
call   10a0 <malloc@plt>
mov    %rax,%r13
mov    $0x1,%ebp
mov    %rax,%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
mov    %r15,%rcx
call   1050 <fread@plt>
cmp    %rbx,%rax
jne    1367 <main+0x1a7>
cmpb   $0x38,0x0(%r13)
jne    137c <main+0x1bc>
cmpb   $0x42,0x1(%r13)
jne    137c <main+0x1bc>
cmpb   $0x50,0x2(%r13)
jne    137c <main+0x1bc>
cmpb   $0x53,0x3(%r13)
jne    137c <main+0x1bc>
test   %ebx,%ebx
jle    13ce <main+0x20e>
mov    %ebx,%eax
add    $0xffffffffffffffff,%rax
mov    $0x38,%dl
xor    %ebp,%ebp
xor    %ecx,%ecx
cmp    $0x38,%dl
jne    130e <main+0x14e>
cmpb   $0x42,0x1(%r13,%rcx,1)
jne    130e <main+0x14e>
cmpb   $0x49,0x2(%r13,%rcx,1)
jne    130e <main+0x14e>
cmpb   $0x4d,0x3(%r13,%rcx,1)
jne    130e <main+0x14e>
cmpb   $0x4,0x4(%r13,%rcx,1)
jne    130e <main+0x14e>
mov    0x5(%r13,%rcx,1),%dl
cmp    $0xc,%dl
je     1545 <main+0x385>
cmp    $0x9,%dl
je     1545 <main+0x385>
cmp    %rcx,%rax
je     13ca <main+0x20a>
movzbl 0x1(%r13,%rcx,1),%edx
add    $0x1,%rcx
cmp    $0x38,%dl
je     12d7 <main+0x117>
jmp    130e <main+0x14e>
lea    0xd30(%rip),%rdi
xor    %ebx,%ebx
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%ebp
xor    %r13d,%r13d
test   %r14,%r14
jne    1397 <main+0x1d7>
jmp    139f <main+0x1df>
lea    0xd0e(%rip),%rdi
xor    %ebx,%ebx
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%ebp
xor    %r13d,%r13d
jmp    138a <main+0x1ca>
lea    0xd04(%rip),%rdi
xor    %ebx,%ebx
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    138a <main+0x1ca>
lea    0xd1a(%rip),%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
mov    %r15,%rdi
call   1060 <fclose@plt>
test   %r14,%r14
je     139f <main+0x1df>
mov    %r14,%rdi
call   1060 <fclose@plt>
test   %r13,%r13
je     13ac <main+0x1ec>
mov    %r13,%rdi
call   1030 <free@plt>
test   %rbx,%rbx
je     13b9 <main+0x1f9>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x38,%al
jmp    13d2 <main+0x212>
mov    $0x38,%al
xor    %ebp,%ebp
movsbl %al,%eax
mov    %eax,%ecx
and    $0x80,%cl
movzbl %cl,%ecx
lea    (%rax,%rcx,2),%ebx
movsd  0xc18(%rip),%xmm0
mov    $0x100,%edi
call   10d0 <pow@plt>
imul   %ebx,%eax
mov    %rax,0x20(%rsp)
movslq %eax,%r12
movzbl 0x1(%rbp,%r13,1),%eax
movsbl %al,%ecx
and    $0xffffff80,%eax
lea    (%rcx,%rax,2),%ebx
movsd  0xbf4(%rip),%xmm0
mov    $0x100,%edi
call   10d0 <pow@plt>
imul   %ebx,%eax
mov    %eax,0x14(%rsp)
movslq %eax,%rbx
add    %r12,%rbx
movzbl 0x2(%rbp,%r13,1),%eax
movsbl %al,%ecx
and    $0xffffff80,%eax
lea    (%rcx,%rax,2),%r12d
movsd  0xbcd(%rip),%xmm0
mov    $0x100,%edi
call   10d0 <pow@plt>
imul   %r12d,%eax
mov    %rbp,%r12
mov    %eax,0x10(%rsp)
movslq %eax,%rbp
add    %rbx,%rbp
movzbl 0x3(%r12,%r13,1),%eax
movsbl %al,%ecx
and    $0xffffff80,%eax
lea    (%rcx,%rax,2),%ebx
xorps  %xmm0,%xmm0
mov    $0x100,%edi
call   10d0 <pow@plt>
imul   %ebx,%eax
mov    %eax,0xc(%rsp)
movslq %eax,%rbx
add    %rbp,%rbx
mov    %r12,0x18(%rsp)
movzbl 0x4(%r12,%r13,1),%eax
movsbl %al,%ecx
and    $0xffffff80,%eax
lea    (%rcx,%rax,2),%ebp
movsd  0xb75(%rip),%xmm0
mov    $0x100,%edi
call   10d0 <pow@plt>
mov    %eax,%r12d
imul   %ebp,%r12d
movslq %r12d,%rax
lea    (%rbx,%rax,1),%rdi
lea    (%rax,%rbx,1),%rbp
add    $0xffffffffffffffe4,%rbp
add    $0xffffffe5,%edi
call   10a0 <malloc@plt>
mov    %rax,%rbx
mov    %rbp,0x28(%rsp)
test   %ebp,%ebp
jle    150b <main+0x34b>
mov    0x18(%rsp),%rax
add    $0x20,%eax
cltq
mov    %r13,%rsi
add    %rax,%rsi
mov    0x20(%rsp),%rax
add    0x14(%rsp),%eax
add    0x10(%rsp),%eax
add    0xc(%rsp),%eax
lea    (%r12,%rax,1),%edx
add    $0xffffffe3,%edx
add    $0x1,%rdx
mov    %rbx,%rdi
call   1090 <memcpy@plt>
mov    $0x1,%ebp
mov    %rbx,%rdi
mov    $0x1,%esi
mov    0x28(%rsp),%r12
mov    %r12,%rdx
mov    %r14,%rcx
call   10e0 <fwrite@plt>
cmp    %r12,%rax
jne    1534 <main+0x374>
xor    %ebp,%ebp
jmp    138a <main+0x1ca>
lea    0xb50(%rip),%rdi
mov    0x30(%rsp),%rsi
jmp    1373 <main+0x1b3>
add    $0x8,%ecx
movslq %ecx,%rbp
mov    0x0(%r13,%rbp,1),%al
jmp    13d2 <main+0x212>

LLVM IR (-O0):
@.str = [52 x i8] c"psdthumb (v%s)\0A\0AUsage: psdthumb <in.psd> <out.jpg>\0A\00"
@.str.1 = [6 x i8] c"1.0.1\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [3 x i8] c"w+\00"
@.str.4 = [19 x i8] c"Could not open %s\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.5 = [25 x i8] c"Unable to read file: %s\0A\00"
@.str.6 = [16 x i8] c"Not a PSD file\0A\00"
@.str.7 = [18 x i8] c"Error writing %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
%12 = alloca i64
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i32*
%18 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i64 0, i64* %11
store i64 0, i64* %12
store i8* null, i8** %13
store i8* null, i8** %14
store i8* null, i8** %15
store i8* null, i8** %16
store i32* null, i32** %17
store i32* null, i32** %18
%19 = load i32, i32* %4
%20 = icmp slt i32 %19, 3
br i1 %20, label %21, label %23
21: ; preds = %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %6
br label %253
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
store i8* %26, i8** %13
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 2
%29 = load i8*, i8** %28
store i8* %29, i8** %14
%30 = load i8*, i8** %13
%31 = call i32* @fopen(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %31, i32** %17
%32 = load i8*, i8** %14
%33 = call i32* @fopen(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %33, i32** %18
%34 = load i32*, i32** %17
%35 = icmp ne i32* %34, null
br i1 %35, label %39, label %36
36: ; preds = %23
%37 = load i8*, i8** %13
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %37)
store i32 1, i32* %6
br label %253
39: ; preds = %23
%40 = load i32*, i32** %18
%41 = icmp ne i32* %40, null
br i1 %41, label %45, label %42
42: ; preds = %39
%43 = load i8*, i8** %14
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %43)
store i32 1, i32* %6
br label %253
45: ; preds = %39
%46 = load i32*, i32** %17
%47 = load i32, i32* @SEEK_END
%48 = call i32 @fseek(i32* %46, i32 0, i32 %47)
%49 = load i32*, i32** %17
%50 = call i64 @ftell(i32* %49)
store i64 %50, i64* %11
%51 = load i32*, i32** %17
%52 = load i32, i32* @SEEK_SET
%53 = call i32 @fseek(i32* %51, i32 0, i32 %52)
%54 = load i64, i64* %11
%55 = mul i64 1, %54
%56 = add i64 %55, 1
%57 = trunc i64 %56 to i32
%58 = call i8* @malloc(i32 %57)
store i8* %58, i8** %15
%59 = load i8*, i8** %15
%60 = load i64, i64* %11
%61 = load i32*, i32** %17
%62 = call i64 @fread(i8* %59, i32 1, i64 %60, i32* %61)
%63 = load i64, i64* %11
%64 = icmp ne i64 %62, %63
br i1 %64, label %65, label %68
65: ; preds = %45
%66 = load i8*, i8** %13
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* %66)
store i32 1, i32* %6
br label %253
68: ; preds = %45
%69 = load i8*, i8** %15
%70 = getelementptr inbounds i8, i8* %69, i64 0
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = icmp ne i32 %72, 56
br i1 %73, label %92, label %74
74: ; preds = %68
%75 = load i8*, i8** %15
%76 = getelementptr inbounds i8, i8* %75, i64 1
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = icmp ne i32 %78, 66
br i1 %79, label %92, label %80
80: ; preds = %74
%81 = load i8*, i8** %15
%82 = getelementptr inbounds i8, i8* %81, i64 2
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = icmp ne i32 %84, 80
br i1 %85, label %92, label %86
86: ; preds = %80
%87 = load i8*, i8** %15
%88 = getelementptr inbounds i8, i8* %87, i64 3
%89 = load i8, i8* %88
%90 = sext i8 %89 to i32
%91 = icmp ne i32 %90, 83
br i1 %91, label %92, label %94
92: ; preds = %86, %80, %74, %68
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %6
br label %253
94: ; preds = %86
store i32 0, i32* %7
%95 = load i64, i64* %11
%96 = trunc i64 %95 to i32
store i32 %96, i32* %8
br label %97
97: ; preds = %178, %94
%98 = load i32, i32* %7
%99 = load i32, i32* %8
%100 = icmp slt i32 %98, %99
br i1 %100, label %101, label %181
101: ; preds = %97
%102 = load i8*, i8** %15
%103 = load i32, i32* %7
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds i8, i8* %102, i64 %104
%106 = load i8, i8* %105
%107 = sext i8 %106 to i32
%108 = icmp eq i32 %107, 56
br i1 %108, label %109, label %177
109: ; preds = %101
%110 = load i8*, i8** %15
%111 = load i32, i32* %7
%112 = add nsw i32 %111, 1
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds i8, i8* %110, i64 %113
%115 = load i8, i8* %114
%116 = sext i8 %115 to i32
%117 = icmp eq i32 %116, 66
br i1 %117, label %118, label %177
118: ; preds = %109
%119 = load i8*, i8** %15
%120 = load i32, i32* %7
%121 = add nsw i32 %120, 2
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds i8, i8* %119, i64 %122
%124 = load i8, i8* %123
%125 = sext i8 %124 to i32
%126 = icmp eq i32 %125, 73
br i1 %126, label %127, label %177
127: ; preds = %118
%128 = load i8*, i8** %15
%129 = load i32, i32* %7
%130 = add nsw i32 %129, 3
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds i8, i8* %128, i64 %131
%133 = load i8, i8* %132
%134 = sext i8 %133 to i32
%135 = icmp eq i32 %134, 77
br i1 %135, label %136, label %177
136: ; preds = %127
%137 = load i8*, i8** %15
%138 = load i32, i32* %7
%139 = add nsw i32 %138, 4
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds i8, i8* %137, i64 %140
%142 = load i8, i8* %141
%143 = sext i8 %142 to i32
%144 = icmp eq i32 %143, 4
br i1 %144, label %145, label %154
145: ; preds = %136
%146 = load i8*, i8** %15
%147 = load i32, i32* %7
%148 = add nsw i32 %147, 5
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds i8, i8* %146, i64 %149
%151 = load i8, i8* %150
%152 = sext i8 %151 to i32
%153 = icmp eq i32 %152, 9
br i1 %153, label %172, label %154
154: ; preds = %145, %136
%155 = load i8*, i8** %15
%156 = load i32, i32* %7
%157 = add nsw i32 %156, 4
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds i8, i8* %155, i64 %158
%160 = load i8, i8* %159
%161 = sext i8 %160 to i32
%162 = icmp eq i32 %161, 4
br i1 %162, label %163, label %176
163: ; preds = %154
%164 = load i8*, i8** %15
%165 = load i32, i32* %7
%166 = add nsw i32 %165, 5
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds i8, i8* %164, i64 %167
%169 = load i8, i8* %168
%170 = sext i8 %169 to i32
%171 = icmp eq i32 %170, 12
br i1 %171, label %172, label %176
172: ; preds = %163, %145
%173 = load i32, i32* %7
%174 = add nsw i32 %173, 6
%175 = add nsw i32 %174, 2
store i32 %175, i32* %9
br label %181
176: ; preds = %163, %154
br label %177
177: ; preds = %176, %127, %118, %109, %101
br label %178
178: ; preds = %177
%179 = load i32, i32* %7
%180 = add nsw i32 %179, 1
store i32 %180, i32* %7
br label %97
181: ; preds = %172, %97
store i32 0, i32* %7
store i32 3, i32* %8
br label %182
182: ; preds = %209, %181
%183 = load i32, i32* %7
%184 = icmp sle i32 %183, 4
br i1 %184, label %185, label %212
185: ; preds = %182
%186 = load i8*, i8** %15
%187 = load i32, i32* %9
%188 = add nsw i32 %187, 1
store i32 %188, i32* %9
%189 = sext i32 %187 to i64
%190 = getelementptr inbounds i8, i8* %186, i64 %189
%191 = load i8, i8* %190
%192 = sext i8 %191 to i32
store i32 %192, i32* %10
%193 = load i32, i32* %10
%194 = icmp slt i32 %193, 0
%195 = zext i1 %194 to i64
%196 = select i1 %194, i32 256, i32 0
%197 = load i32, i32* %10
%198 = add nsw i32 %197, %196
store i32 %198, i32* %10
%199 = load i32, i32* %10
%200 = load i32, i32* %8
%201 = load i32, i32* %7
%202 = sub nsw i32 %200, %201
%203 = sitofp i32 %202 to double
%204 = call i32 @pow(i32 256, double %203)
%205 = mul nsw i32 %199, %204
%206 = sext i32 %205 to i64
%207 = load i64, i64* %12
%208 = add i64 %207, %206
store i64 %208, i64* %12
br label %209
209: ; preds = %185
%210 = load i32, i32* %7
%211 = add nsw i32 %210, 1
store i32 %211, i32* %7
br label %182
212: ; preds = %182
%213 = load i32, i32* %9
%214 = add nsw i32 %213, 27
store i32 %214, i32* %9
%215 = load i64, i64* %12
%216 = sub i64 %215, 28
store i64 %216, i64* %12
%217 = load i64, i64* %12
%218 = mul i64 1, %217
%219 = add i64 %218, 1
%220 = trunc i64 %219 to i32
%221 = call i8* @malloc(i32 %220)
store i8* %221, i8** %16
store i32 0, i32* %7
%222 = load i64, i64* %12
%223 = trunc i64 %222 to i32
store i32 %223, i32* %8
br label %224
224: ; preds = %239, %212
%225 = load i32, i32* %7
%226 = load i32, i32* %8
%227 = icmp slt i32 %225, %226
br i1 %227, label %228, label %242
228: ; preds = %224
%229 = load i8*, i8** %15
%230 = load i32, i32* %9
%231 = add nsw i32 %230, 1
store i32 %231, i32* %9
%232 = sext i32 %230 to i64
%233 = getelementptr inbounds i8, i8* %229, i64 %232
%234 = load i8, i8* %233
%235 = load i8*, i8** %16
%236 = load i32, i32* %7
%237 = sext i32 %236 to i64
%238 = getelementptr inbounds i8, i8* %235, i64 %237
store i8 %234, i8* %238
br label %239
239: ; preds = %228
%240 = load i32, i32* %7
%241 = add nsw i32 %240, 1
store i32 %241, i32* %7
br label %224
242: ; preds = %224
%243 = load i8*, i8** %16
%244 = load i64, i64* %12
%245 = load i32*, i32** %18
%246 = call i64 @fwrite(i8* %243, i32 1, i64 %244, i32* %245)
%247 = load i64, i64* %12
%248 = icmp ne i64 %246, %247
br i1 %248, label %249, label %252
249: ; preds = %242
%250 = load i8*, i8** %14
%251 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i8* %250)
store i32 1, i32* %6
br label %253
252: ; preds = %242
br label %253
253: ; preds = %252, %249, %92, %65, %42, %36, %21
%254 = load i32*, i32** %17
%255 = icmp ne i32* %254, null
br i1 %255, label %256, label %259
256: ; preds = %253
%257 = load i32*, i32** %17
%258 = call i32 @fclose(i32* %257)
br label %259
259: ; preds = %256, %253
%260 = load i32*, i32** %18
%261 = icmp ne i32* %260, null
br i1 %261, label %262, label %265
262: ; preds = %259
%263 = load i32*, i32** %18
%264 = call i32 @fclose(i32* %263)
br label %265
265: ; preds = %262, %259
%266 = load i8*, i8** %15
%267 = icmp ne i8* %266, null
br i1 %267, label %268, label %271
268: ; preds = %265
%269 = load i8*, i8** %15
%270 = call i32 @free(i8* %269)
br label %271
271: ; preds = %268, %265
%272 = load i8*, i8** %16
%273 = icmp ne i8* %272, null
br i1 %273, label %274, label %277
274: ; preds = %271
%275 = load i8*, i8** %16
%276 = call i32 @free(i8* %275)
br label %277
277: ; preds = %274, %271
%278 = load i32, i32* %6
ret i32 %278
}

LLVM IR (-O2):
@.str = [52 x i8] c"psdthumb (v%s)\0A\0AUsage: psdthumb <in.psd> <out.jpg>\0A\00"
@.str.1 = [6 x i8] c"1.0.1\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [3 x i8] c"w+\00"
@.str.4 = [19 x i8] c"Could not open %s\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.5 = [25 x i8] c"Unable to read file: %s\0A\00"
@.str.7 = [18 x i8] c"Error writing %s\0A\00"
@str = [15 x i8] c"Not a PSD file\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %196
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = tail call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%12 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%13 = icmp eq i32* %11, null
br i1 %13, label %14, label %16
14: ; preds = %6
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %8)
br label %181
16: ; preds = %6
%17 = icmp eq i32* %12, null
br i1 %17, label %18, label %20
18: ; preds = %16
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i8* %10)
br label %176
20: ; preds = %16
%21 = load i32, i32* @SEEK_END
%22 = tail call i32 @fseek(i32* %11, i32 0, i32 %21)
%23 = tail call i64 @ftell(i32* %11)
%24 = load i32, i32* @SEEK_SET
%25 = tail call i32 @fseek(i32* %11, i32 0, i32 %24)
%26 = trunc i64 %23 to i32
%27 = add i32 %26, 1
%28 = tail call i8* @malloc(i32 %27)
%29 = tail call i64 @fread(i8* %28, i32 1, i64 %23, i32* %11)
%30 = icmp eq i64 %29, %23
br i1 %30, label %33, label %31
31: ; preds = %20
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* %8)
br label %176
33: ; preds = %20
%34 = load i8, i8* %28
%35 = icmp eq i8 %34, 56
br i1 %35, label %36, label %52
36: ; preds = %33
%37 = getelementptr inbounds i8, i8* %28, i64 1
%38 = load i8, i8* %37
%39 = icmp eq i8 %38, 66
br i1 %39, label %40, label %52
40: ; preds = %36
%41 = getelementptr inbounds i8, i8* %28, i64 2
%42 = load i8, i8* %41
%43 = icmp eq i8 %42, 80
br i1 %43, label %44, label %52
44: ; preds = %40
%45 = getelementptr inbounds i8, i8* %28, i64 3
%46 = load i8, i8* %45
%47 = icmp eq i8 %46, 83
br i1 %47, label %48, label %52
48: ; preds = %44
%49 = icmp sgt i32 %26, 0
br i1 %49, label %50, label %94
50: ; preds = %48
%51 = and i64 %23, 4294967295
br label %54
52: ; preds = %44, %40, %36, %33
%53 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
br label %176
54: ; preds = %91, %50
%55 = phi i8 [ 56, %50 ], [ %93, %91 ]
%56 = phi i64 [ 0, %50 ], [ %58, %91 ]
%57 = icmp eq i8 %55, 56
%58 = add nuw nsw i64 %56, 1
br i1 %57, label %59, label %89
59: ; preds = %54
%60 = getelementptr inbounds i8, i8* %28, i64 %58
%61 = load i8, i8* %60
%62 = icmp eq i8 %61, 66
br i1 %62, label %63, label %89
63: ; preds = %59
%64 = add nuw nsw i64 %56, 2
%65 = getelementptr inbounds i8, i8* %28, i64 %64
%66 = load i8, i8* %65
%67 = icmp eq i8 %66, 73
br i1 %67, label %68, label %89
68: ; preds = %63
%69 = add nuw nsw i64 %56, 3
%70 = getelementptr inbounds i8, i8* %28, i64 %69
%71 = load i8, i8* %70
%72 = icmp eq i8 %71, 77
br i1 %72, label %73, label %89
73: ; preds = %68
%74 = add nuw nsw i64 %56, 4
%75 = getelementptr inbounds i8, i8* %28, i64 %74
%76 = load i8, i8* %75
%77 = icmp eq i8 %76, 4
br i1 %77, label %78, label %89
78: ; preds = %73
%79 = add nuw nsw i64 %56, 5
%80 = getelementptr inbounds i8, i8* %28, i64 %79
%81 = load i8, i8* %80
switch i8 %81, label %89 [
i8 9, label %82
i8 12, label %82
]
82: ; preds = %78, %78
%83 = trunc i64 %56 to i32
%84 = add nuw nsw i32 %83, 8
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8, i8* %28, i64 %85
%87 = load i8, i8* %86
%88 = sext i32 %84 to i64
br label %94
89: ; preds = %78, %54, %73, %59, %63, %68
%90 = icmp eq i64 %58, %51
br i1 %90, label %94, label %91
91: ; preds = %89
%92 = getelementptr inbounds i8, i8* %28, i64 %58
%93 = load i8, i8* %92
br label %54
94: ; preds = %89, %48, %82
%95 = phi i8 [ %87, %82 ], [ 56, %48 ], [ 56, %89 ]
%96 = phi i64 [ %88, %82 ], [ 0, %48 ], [ 0, %89 ]
%97 = add nsw i64 %96, 1
%98 = sext i8 %95 to i32
%99 = and i8 %95, -128
%100 = zext i8 %99 to i32
%101 = shl nuw nsw i32 %100, 1
%102 = add nsw i32 %101, %98
%103 = tail call i32 @pow(i32 256, double 3.000000e+00)
%104 = mul i32 %102, %103
%105 = sext i32 %104 to i64
%106 = add nsw i64 %96, 2
%107 = getelementptr inbounds i8, i8* %28, i64 %97
%108 = load i8, i8* %107
%109 = sext i8 %108 to i32
%110 = and i8 %108, -128
%111 = zext i8 %110 to i32
%112 = shl nuw nsw i32 %111, 1
%113 = add nsw i32 %112, %109
%114 = tail call i32 @pow(i32 256, double 2.000000e+00)
%115 = mul i32 %113, %114
%116 = sext i32 %115 to i64
%117 = add nsw i64 %105, %116
%118 = add nsw i64 %96, 3
%119 = getelementptr inbounds i8, i8* %28, i64 %106
%120 = load i8, i8* %119
%121 = sext i8 %120 to i32
%122 = and i8 %120, -128
%123 = zext i8 %122 to i32
%124 = shl nuw nsw i32 %123, 1
%125 = add nsw i32 %124, %121
%126 = tail call i32 @pow(i32 256, double 1.000000e+00)
%127 = mul i32 %125, %126
%128 = sext i32 %127 to i64
%129 = add nsw i64 %117, %128
%130 = add nsw i64 %96, 4
%131 = getelementptr inbounds i8, i8* %28, i64 %118
%132 = load i8, i8* %131
%133 = sext i8 %132 to i32
%134 = and i8 %132, -128
%135 = zext i8 %134 to i32
%136 = shl nuw nsw i32 %135, 1
%137 = add nsw i32 %136, %133
%138 = tail call i32 @pow(i32 256, double 0.000000e+00)
%139 = mul i32 %137, %138
%140 = sext i32 %139 to i64
%141 = add nsw i64 %129, %140
%142 = getelementptr inbounds i8, i8* %28, i64 %130
%143 = load i8, i8* %142
%144 = sext i8 %143 to i32
%145 = and i8 %143, -128
%146 = zext i8 %145 to i32
%147 = shl nuw nsw i32 %146, 1
%148 = add nsw i32 %147, %144
%149 = tail call i32 @pow(i32 256, double -1.000000e+00)
%150 = mul nsw i32 %148, %149
%151 = sext i32 %150 to i64
%152 = add nsw i64 %141, %151
%153 = add nsw i64 %152, -28
%154 = trunc i64 %152 to i32
%155 = add i32 %154, -27
%156 = tail call i8* @malloc(i32 %155)
%157 = trunc i64 %153 to i32
%158 = icmp sgt i32 %157, 0
br i1 %158, label %159, label %171
159: ; preds = %94
%160 = shl nsw i64 %96, 32
%161 = add i64 %160, 137438953472
%162 = ashr exact i64 %161, 32
%163 = getelementptr i8, i8* %28, i64 %162
%164 = add i32 %104, %115
%165 = add i32 %164, %127
%166 = add i32 %165, %139
%167 = add i32 %166, %150
%168 = add i32 %167, -29
%169 = zext i32 %168 to i64
%170 = add nuw nsw i64 %169, 1
br label %171
171: ; preds = %159, %94
%172 = tail call i64 @fwrite(i8* %156, i32 1, i64 %153, i32* %12)
%173 = icmp eq i64 %172, %153
br i1 %173, label %176, label %174
174: ; preds = %171
%175 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i8* %10)
br label %176
176: ; preds = %174, %171, %18, %52, %31
%177 = phi i8* [ null, %18 ], [ null, %52 ], [ null, %31 ], [ %156, %171 ], [ %156, %174 ]
%178 = phi i8* [ null, %18 ], [ %28, %52 ], [ %28, %31 ], [ %28, %171 ], [ %28, %174 ]
%179 = phi i32 [ 1, %18 ], [ 1, %52 ], [ 1, %31 ], [ 0, %171 ], [ 1, %174 ]
%180 = tail call i32 @fclose(i32* %11)
br label %181
181: ; preds = %14, %176
%182 = phi i8* [ %177, %176 ], [ null, %14 ]
%183 = phi i8* [ %178, %176 ], [ null, %14 ]
%184 = phi i32 [ %179, %176 ], [ 1, %14 ]
%185 = icmp eq i32* %12, null
br i1 %185, label %188, label %186
186: ; preds = %181
%187 = tail call i32 @fclose(i32* %12)
br label %188
188: ; preds = %186, %181
%189 = icmp eq i8* %183, null
br i1 %189, label %192, label %190
190: ; preds = %188
%191 = tail call i32 @free(i8* %183)
br label %192
192: ; preds = %190, %188
%193 = icmp eq i8* %182, null
br i1 %193, label %196, label %194
194: ; preds = %192
%195 = tail call i32 @free(i8* %182)
br label %196
196: ; preds = %4, %194, %192
%197 = phi i32 [ 1, %4 ], [ %184, %194 ], [ %184, %192 ]
ret i32 %197
}