#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_SET;
int atoi(int /*<<< orphan*/);
scalar_t__ decode_boot(unsigned char *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int find_head_offset(unsigned char *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(unsigned char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ getenv(char *);
int getflagstr(unsigned char *, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ stdout;
int main() {
  FILE *art_fp;
  int art_len;
  unsigned char *art_ptr;
  int art_head_offset = 0;
  char mtd_fw[128] = "\0";
  int f_size = 0;
  fprintf(stdout, "Content-type:text/html\r\n\r\n");
  fprintf(stdout, "<html><title>boot upgrade</title>\n");
  fprintf(stdout, "<body>\n");
  if ((art_fp = fopen("/tmp/boot_upgrade.bin", "wb+")) == NULL) {
    printf("open fw file failed\n");
    fprintf(stdout, "</body>\n");
    fprintf(stdout, "\n</html>\n");
    exit(1);
  }
  art_len = atoi(getenv("CONTENT_LENGTH"));
  art_ptr = (unsigned char *)malloc(sizeof(unsigned char) * art_len);
  if (art_ptr == NULL) {
    printf("<br>malloc failed <br>");
    goto error_exit;
  }
  f_size = fread(art_ptr, 1, art_len, stdin);
  if (f_size != art_len) {
    printf("<br>fread failed <br>");
    goto error_exit;
  }
  int boot_len = 0;
  boot_len = getflagstr(art_ptr, art_len);
  f_size = 0;
  art_head_offset = find_head_offset(art_ptr);
  if (art_head_offset == -1) {
    printf("<br>find head offset failed <br>");
    goto error_exit;
  }
  art_ptr += art_head_offset;
  if (decode_boot(art_ptr, boot_len - art_head_offset + 1) != 0) {
    printf("invalid uboot! <br>");
    goto error_exit;
  }
  int uboot_len = 0;
  uboot_len = boot_len - art_head_offset + 1 - 12;
  f_size = fwrite(art_ptr + 12, 1, uboot_len, art_fp);
  if (f_size != uboot_len) {
    printf("<br>fwrite failed <br>");
    goto error_exit;
  }
  fclose(art_fp);
  FILE *fp_mtd = NULL;
  fp_mtd = fopen("/dev/mtdblock0", "rb+");
  if (fp_mtd == NULL) {
    printf("open /dev/mtdblock0 failed\n");
    exit(1);
  }
  f_size = 0;
  f_size = fwrite(art_ptr + 12, 1, uboot_len, fp_mtd);
  if (f_size != uboot_len) {
    printf("<br>fwrite failed <br>");
    goto error_exit;
  }
  fseek(fp_mtd, 0, SEEK_SET);
  unsigned char *read_buf = NULL;
  unsigned int en_num = 0;
  unsigned int en_num_tmp = 0;
  unsigned int *ibuf = NULL;
  int i = 0;
  en_num = *(unsigned int *)(art_ptr + 8);
  int read_len = 0;
  read_buf = (unsigned char *)malloc(uboot_len);
  memset(read_buf, 0, uboot_len);
  read_len = fread(read_buf, 1, uboot_len, fp_mtd);
  if (read_len != uboot_len) {
    printf("<br>read uboot from mtdblock0 failed <br>");
    goto error_exit;
  }
  ibuf = (unsigned int *)(read_buf);
  for (i = 0; i < uboot_len / 4; i++) {
    en_num_tmp ^= *(ibuf + i);
  }
  if (en_num_tmp != en_num) {
    printf("<br>uboot check failed <br>");
    goto error_exit;
  }
  fclose(fp_mtd);
  free(art_ptr);
  free(read_buf);
  printf("<br>boot upgrade successful :)<br>");
  fprintf(stdout, "</body>\n");
  fprintf(stdout, "\n</html>\n");
  return 0;
error_exit:
  printf("<br>boot upgrade failed :(<br>");
  fprintf(stdout, "</body>\n");
  fprintf(stdout, "\n</html>\n");
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x24(%rbp)
lea    -0xb0(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   10a0 <memset@plt>
movl   $0x0,-0xb4(%rbp)
mov    0x2d93(%rip),%rax
mov    (%rax),%edi
lea    0xdba(%rip),%rsi
call   10b0 <fprintf@plt>
mov    0x2d7e(%rip),%rax
mov    (%rax),%edi
lea    0xdc0(%rip),%rsi
call   10b0 <fprintf@plt>
mov    0x2d69(%rip),%rax
mov    (%rax),%edi
lea    0xdce(%rip),%rsi
call   10b0 <fprintf@plt>
lea    0xdca(%rip),%rdi
lea    0xdd9(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    12d6 <main+0xd6>
lea    0xdc3(%rip),%rdi
call   1080 <printf@plt>
mov    0x2d27(%rip),%rax
mov    (%rax),%edi
lea    0xdc3(%rip),%rsi
call   10b0 <fprintf@plt>
mov    0x2d12(%rip),%rax
mov    (%rax),%edi
lea    0xdb7(%rip),%rsi
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    0xdab(%rip),%rdi
call   1040 <getenv@plt>
mov    %eax,%edi
call   1100 <atoi@plt>
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    131b <main+0x11b>
lea    0xd86(%rip),%rdi
call   1080 <printf@plt>
jmp    16ba <main+0x4ba>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    0x2cbf(%rip),%rax
mov    (%rax),%rcx
mov    $0x1,%esi
call   1060 <fread@plt>
mov    %eax,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     135c <main+0x15c>
lea    0xd5c(%rip),%rdi
call   1080 <printf@plt>
jmp    16ba <main+0x4ba>
movl   $0x0,-0xb8(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <getflagstr@plt>
mov    %eax,-0xb8(%rbp)
movl   $0x0,-0xb4(%rbp)
mov    -0x20(%rbp),%rdi
call   10d0 <find_head_offset@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    13a9 <main+0x1a9>
lea    0xd25(%rip),%rdi
call   1080 <printf@plt>
jmp    16ba <main+0x4ba>
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0xb8(%rbp),%esi
sub    -0x24(%rbp),%esi
add    $0x1,%esi
call   1090 <decode_boot@plt>
cmp    $0x0,%rax
je     13ea <main+0x1ea>
lea    0xd05(%rip),%rdi
call   1080 <printf@plt>
jmp    16ba <main+0x4ba>
movl   $0x0,-0xbc(%rbp)
mov    -0xb8(%rbp),%eax
sub    -0x24(%rbp),%eax
add    $0x1,%eax
sub    $0xc,%eax
mov    %eax,-0xbc(%rbp)
mov    -0x20(%rbp),%rdi
add    $0xc,%rdi
mov    -0xbc(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
call   1120 <fwrite@plt>
mov    %eax,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
cmp    -0xbc(%rbp),%eax
je     144e <main+0x24e>
lea    0xcb5(%rip),%rdi
call   1080 <printf@plt>
jmp    16ba <main+0x4ba>
mov    -0x10(%rbp),%rdi
call   1070 <fclose@plt>
movq   $0x0,-0xc8(%rbp)
lea    0xca7(%rip),%rdi
lea    0xcaf(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0xc8(%rbp)
cmpq   $0x0,-0xc8(%rbp)
jne    14a0 <main+0x2a0>
lea    0xc92(%rip),%rdi
call   1080 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
movl   $0x0,-0xb4(%rbp)
mov    -0x20(%rbp),%rdi
add    $0xc,%rdi
mov    -0xbc(%rbp),%edx
mov    -0xc8(%rbp),%rcx
mov    $0x1,%esi
call   1120 <fwrite@plt>
mov    %eax,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
cmp    -0xbc(%rbp),%eax
je     14f2 <main+0x2f2>
lea    0xc11(%rip),%rdi
call   1080 <printf@plt>
jmp    16ba <main+0x4ba>
mov    -0xc8(%rbp),%rdi
mov    0x2ad8(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10e0 <fseek@plt>
movq   $0x0,-0xd0(%rbp)
movl   $0x0,-0xd4(%rbp)
movl   $0x0,-0xd8(%rbp)
movq   $0x0,-0xe0(%rbp)
movl   $0x0,-0xe4(%rbp)
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0xd4(%rbp)
movl   $0x0,-0xe8(%rbp)
mov    -0xbc(%rbp),%edi
call   10c0 <malloc@plt>
mov    %rax,-0xd0(%rbp)
mov    -0xd0(%rbp),%rdi
mov    -0xbc(%rbp),%edx
xor    %esi,%esi
call   10a0 <memset@plt>
mov    -0xd0(%rbp),%rdi
mov    -0xbc(%rbp),%edx
mov    -0xc8(%rbp),%rcx
mov    $0x1,%esi
call   1060 <fread@plt>
mov    %eax,-0xe8(%rbp)
mov    -0xe8(%rbp),%eax
cmp    -0xbc(%rbp),%eax
je     15c1 <main+0x3c1>
lea    0xb88(%rip),%rdi
call   1080 <printf@plt>
jmp    16ba <main+0x4ba>
mov    -0xd0(%rbp),%rax
mov    %rax,-0xe0(%rbp)
movl   $0x0,-0xe4(%rbp)
mov    -0xe4(%rbp),%eax
mov    %eax,-0xec(%rbp)
mov    -0xbc(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xec(%rbp),%eax
cmp    %ecx,%eax
jge    1634 <main+0x434>
mov    -0xe0(%rbp),%rax
movslq -0xe4(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
xor    -0xd8(%rbp),%eax
mov    %eax,-0xd8(%rbp)
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    15d9 <main+0x3d9>
mov    -0xd8(%rbp),%eax
cmp    -0xd4(%rbp),%eax
je     1657 <main+0x457>
lea    0xb1c(%rip),%rdi
call   1080 <printf@plt>
jmp    16ba <main+0x4ba>
mov    -0xc8(%rbp),%rdi
call   1070 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1050 <free@plt>
mov    -0xd0(%rbp),%rdi
call   1050 <free@plt>
lea    0xb06(%rip),%rdi
call   1080 <printf@plt>
mov    0x2945(%rip),%rax
mov    (%rax),%edi
lea    0x9e1(%rip),%rsi
call   10b0 <fprintf@plt>
mov    0x2930(%rip),%rax
mov    (%rax),%edi
lea    0x9d5(%rip),%rsi
call   10b0 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    16f7 <main+0x4f7>
lea    0xae7(%rip),%rdi
call   1080 <printf@plt>
mov    0x2903(%rip),%rax
mov    (%rax),%edi
lea    0x99f(%rip),%rsi
call   10b0 <fprintf@plt>
mov    0x28ee(%rip),%rax
mov    (%rax),%edi
lea    0x993(%rip),%rsi
call   10b0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    0x2dab(%rip),%r15
mov    (%r15),%edi
lea    0xdd1(%rip),%rsi
call   10c0 <fprintf@plt>
mov    (%r15),%edi
lea    0xddd(%rip),%rsi
call   10c0 <fprintf@plt>
mov    (%r15),%edi
lea    0xdf1(%rip),%rsi
call   10c0 <fprintf@plt>
lea    0xded(%rip),%rdi
lea    0xdfc(%rip),%rsi
call   1100 <fopen@plt>
test   %rax,%rax
je     156f <main+0x35f>
mov    %rax,%rbp
lea    0xdfb(%rip),%rdi
call   1040 <getenv@plt>
mov    %eax,%edi
call   1110 <atoi@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   10d0 <malloc@plt>
test   %rax,%rax
je     12f3 <main+0xe3>
mov    %rax,%r14
mov    0x2d4c(%rip),%rax
mov    (%rax),%rcx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %ebx,%edx
call   1070 <fread@plt>
cmp    %ebx,%eax
jne    12ff <main+0xef>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <getflagstr@plt>
mov    %eax,%r12d
mov    %r14,%rdi
call   10e0 <find_head_offset@plt>
cmp    $0xffffffff,%eax
je     130b <main+0xfb>
movslq %eax,%rcx
add    %rcx,%r14
sub    %eax,%r12d
lea    0x1(%r12),%esi
mov    %r14,%rdi
call   10a0 <decode_boot@plt>
test   %rax,%rax
je     1317 <main+0x107>
lea    0xde2(%rip),%rbx
jmp    1527 <main+0x317>
lea    0xd88(%rip),%rbx
jmp    1527 <main+0x317>
lea    0xd93(%rip),%rbx
jmp    1527 <main+0x317>
lea    0xd9d(%rip),%rbx
jmp    1527 <main+0x317>
lea    -0xb(%r12),%r13d
lea    0xc(%r14),%rdi
mov    %rdi,0x8(%rsp)
mov    $0x1,%esi
mov    %r13d,%edx
mov    %rbp,%rcx
call   1130 <fwrite@plt>
lea    0xda8(%rip),%rbx
cmp    %r13d,%eax
jne    1527 <main+0x317>
mov    %rbp,%rdi
call   1080 <fclose@plt>
lea    0xda7(%rip),%rdi
lea    0xdaf(%rip),%rsi
call   1100 <fopen@plt>
test   %rax,%rax
je     15a3 <main+0x393>
mov    %rax,%rbp
mov    0x8(%rsp),%rdi
mov    $0x1,%esi
mov    %r13d,%edx
mov    %rax,%rcx
call   1130 <fwrite@plt>
cmp    %r13d,%eax
jne    1527 <main+0x317>
mov    0x2c47(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
mov    %rbp,0x10(%rsp)
xor    %ebp,%ebp
xor    %esi,%esi
call   10f0 <fseek@plt>
mov    0x8(%r14),%eax
mov    %eax,0x8(%rsp)
mov    %r13d,%edi
call   10d0 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    %r13d,%edx
call   10b0 <memset@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r13d,%edx
mov    0x10(%rsp),%rcx
call   1070 <fread@plt>
cmp    %r13d,%eax
jne    13fd <main+0x1ed>
cmp    $0xf,%r12d
jl     14f5 <main+0x2e5>
mov    %r13d,%eax
shr    $0x2,%eax
cmp    $0x20,%r13d
jae    1409 <main+0x1f9>
xor    %ecx,%ecx
xor    %ebp,%ebp
jmp    14e9 <main+0x2d9>
lea    0xd0a(%rip),%rbx
jmp    1527 <main+0x317>
mov    %eax,%ecx
and    $0xfffffff8,%ecx
lea    -0x8(%rcx),%rsi
mov    %rsi,%rdi
shr    $0x3,%rdi
add    $0x1,%rdi
mov    %edi,%edx
and    $0x3,%edx
cmp    $0x18,%rsi
jae    1434 <main+0x224>
pxor   %xmm0,%xmm0
xor    %esi,%esi
pxor   %xmm1,%xmm1
jmp    149b <main+0x28b>
and    $0xfffffffffffffffc,%rdi
pxor   %xmm0,%xmm0
xor    %esi,%esi
pxor   %xmm1,%xmm1
movdqu (%rbx,%rsi,4),%xmm2
pxor   %xmm0,%xmm2
movdqu 0x10(%rbx,%rsi,4),%xmm0
pxor   %xmm1,%xmm0
movdqu 0x20(%rbx,%rsi,4),%xmm1
movdqu 0x30(%rbx,%rsi,4),%xmm3
movdqu 0x40(%rbx,%rsi,4),%xmm4
pxor   %xmm1,%xmm4
pxor   %xmm2,%xmm4
movdqu 0x50(%rbx,%rsi,4),%xmm2
pxor   %xmm3,%xmm2
pxor   %xmm0,%xmm2
movdqu 0x60(%rbx,%rsi,4),%xmm0
pxor   %xmm4,%xmm0
movdqu 0x70(%rbx,%rsi,4),%xmm1
pxor   %xmm2,%xmm1
add    $0x20,%rsi
add    $0xfffffffffffffffc,%rdi
jne    1442 <main+0x232>
test   %rdx,%rdx
je     14ca <main+0x2ba>
lea    (%rbx,%rsi,4),%rsi
add    $0x10,%rsi
shl    $0x5,%rdx
xor    %edi,%edi
movdqu -0x10(%rsi,%rdi,1),%xmm2
pxor   %xmm2,%xmm0
movdqu (%rsi,%rdi,1),%xmm2
pxor   %xmm2,%xmm1
add    $0x20,%rdi
cmp    %rdi,%rdx
jne    14ae <main+0x29e>
pxor   %xmm1,%xmm0
pshufd $0xee,%xmm0,%xmm1
pxor   %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
pxor   %xmm1,%xmm0
movd   %xmm0,%ebp
cmp    %rax,%rcx
je     14f5 <main+0x2e5>
xor    (%rbx,%rcx,4),%ebp
add    $0x1,%rcx
cmp    %rcx,%rax
jne    14e9 <main+0x2d9>
cmp    0x8(%rsp),%ebp
jne    1520 <main+0x310>
mov    0x10(%rsp),%rdi
call   1080 <fclose@plt>
mov    %r14,%rdi
call   1050 <free@plt>
mov    %rbx,%rdi
call   1050 <free@plt>
xor    %ebx,%ebx
lea    0xc36(%rip),%rdi
jmp    153b <main+0x32b>
lea    0xc11(%rip),%rbx
mov    %rbx,%rdi
call   1090 <printf@plt>
mov    $0x1,%ebx
lea    0xc3c(%rip),%rdi
call   1090 <printf@plt>
mov    (%r15),%edi
lea    0xb16(%rip),%rsi
call   10c0 <fprintf@plt>
mov    (%r15),%edi
lea    0xb10(%rip),%rsi
call   10c0 <fprintf@plt>
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc3b(%rip),%rdi
call   1060 <puts@plt>
mov    (%r15),%edi
lea    0xadb(%rip),%rsi
call   10c0 <fprintf@plt>
mov    (%r15),%edi
lea    0xad5(%rip),%rsi
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
lea    0xbec(%rip),%rdi
call   1060 <puts@plt>
mov    $0x1,%edi
call   1120 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [27 x i8] c"Content-type:text/html\0D\0A\0D\0A\00"
@.str.1 = [35 x i8] c"<html><title>boot upgrade</title>\0A\00"
@.str.2 = [8 x i8] c"<body>\0A\00"
@.str.3 = [22 x i8] c"/tmp/boot_upgrade.bin\00"
@.str.4 = [4 x i8] c"wb+\00"
@.str.5 = [21 x i8] c"open fw file failed\0A\00"
@.str.6 = [9 x i8] c"</body>\0A\00"
@.str.7 = [10 x i8] c"\0A</html>\0A\00"
@.str.8 = [15 x i8] c"CONTENT_LENGTH\00"
@.str.9 = [23 x i8] c"<br>malloc failed <br>\00"
@stdin = global i32* null
@.str.10 = [22 x i8] c"<br>fread failed <br>\00"
@.str.11 = [33 x i8] c"<br>find head offset failed <br>\00"
@.str.12 = [20 x i8] c"invalid uboot! <br>\00"
@.str.13 = [23 x i8] c"<br>fwrite failed <br>\00"
@.str.14 = [15 x i8] c"/dev/mtdblock0\00"
@.str.15 = [4 x i8] c"rb+\00"
@.str.16 = [28 x i8] c"open /dev/mtdblock0 failed\0A\00"
@SEEK_SET = global i32 0
@.str.17 = [42 x i8] c"<br>read uboot from mtdblock0 failed <br>\00"
@.str.18 = [28 x i8] c"<br>uboot check failed <br>\00"
@.str.19 = [35 x i8] c"<br>boot upgrade successful :)<br>\00"
@.str.20 = [31 x i8] c"<br>boot upgrade failed :(<br>\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [128 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32*
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
%17 = bitcast [128 x i8]* %6 to i8*
store i32 0, i32* %7
%18 = load i32, i32* @stdout
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%20 = load i32, i32* @stdout
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%22 = load i32, i32* @stdout
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32* @fopen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
store i32* %24, i32** %2
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %33
26: ; preds = %0
%27 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%28 = load i32, i32* @stdout
%29 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%30 = load i32, i32* @stdout
%31 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%32 = call i32 @exit(i32 1)
unreachable
33: ; preds = %0
%34 = call i32 @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
%35 = call i32 @atoi(i32 %34)
store i32 %35, i32* %3
%36 = load i32, i32* %3
%37 = sext i32 %36 to i64
%38 = mul i64 1, %37
%39 = trunc i64 %38 to i32
%40 = call i64 @malloc(i32 %39)
%41 = inttoptr i64 %40 to i8*
store i8* %41, i8** %4
%42 = load i8*, i8** %4
%43 = icmp eq i8* %42, null
br i1 %43, label %44, label %46
44: ; preds = %33
%45 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
br label %176
46: ; preds = %33
%47 = load i8*, i8** %4
%48 = load i32, i32* %3
%49 = load i32*, i32** @stdin
%50 = call i32 @fread(i8* %47, i32 1, i32 %48, i32* %49)
store i32 %50, i32* %7
%51 = load i32, i32* %7
%52 = load i32, i32* %3
%53 = icmp ne i32 %51, %52
br i1 %53, label %54, label %56
54: ; preds = %46
%55 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
br label %176
56: ; preds = %46
store i32 0, i32* %8
%57 = load i8*, i8** %4
%58 = load i32, i32* %3
%59 = call i32 @getflagstr(i8* %57, i32 %58)
store i32 %59, i32* %8
store i32 0, i32* %7
%60 = load i8*, i8** %4
%61 = call i32 @find_head_offset(i8* %60)
store i32 %61, i32* %5
%62 = load i32, i32* %5
%63 = icmp eq i32 %62, -1
br i1 %63, label %64, label %66
64: ; preds = %56
%65 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0))
br label %176
66: ; preds = %56
%67 = load i32, i32* %5
%68 = load i8*, i8** %4
%69 = sext i32 %67 to i64
%70 = getelementptr inbounds i8, i8* %68, i64 %69
store i8* %70, i8** %4
%71 = load i8*, i8** %4
%72 = load i32, i32* %8
%73 = load i32, i32* %5
%74 = sub nsw i32 %72, %73
%75 = add nsw i32 %74, 1
%76 = call i64 @decode_boot(i8* %71, i32 %75)
%77 = icmp ne i64 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %66
%79 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0))
br label %176
80: ; preds = %66
store i32 0, i32* %9
%81 = load i32, i32* %8
%82 = load i32, i32* %5
%83 = sub nsw i32 %81, %82
%84 = add nsw i32 %83, 1
%85 = sub nsw i32 %84, 12
store i32 %85, i32* %9
%86 = load i8*, i8** %4
%87 = getelementptr inbounds i8, i8* %86, i64 12
%88 = load i32, i32* %9
%89 = load i32*, i32** %2
%90 = call i32 @fwrite(i8* %87, i32 1, i32 %88, i32* %89)
store i32 %90, i32* %7
%91 = load i32, i32* %7
%92 = load i32, i32* %9
%93 = icmp ne i32 %91, %92
br i1 %93, label %94, label %96
94: ; preds = %80
%95 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0))
br label %176
96: ; preds = %80
%97 = load i32*, i32** %2
%98 = call i32 @fclose(i32* %97)
store i32* null, i32** %10
%99 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0))
store i32* %99, i32** %10
%100 = load i32*, i32** %10
%101 = icmp eq i32* %100, null
br i1 %101, label %102, label %105
102: ; preds = %96
%103 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.16, i64 0, i64 0))
%104 = call i32 @exit(i32 1)
unreachable
105: ; preds = %96
store i32 0, i32* %7
%106 = load i8*, i8** %4
%107 = getelementptr inbounds i8, i8* %106, i64 12
%108 = load i32, i32* %9
%109 = load i32*, i32** %10
%110 = call i32 @fwrite(i8* %107, i32 1, i32 %108, i32* %109)
store i32 %110, i32* %7
%111 = load i32, i32* %7
%112 = load i32, i32* %9
%113 = icmp ne i32 %111, %112
br i1 %113, label %114, label %116
114: ; preds = %105
%115 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0))
br label %176
116: ; preds = %105
%117 = load i32*, i32** %10
%118 = load i32, i32* @SEEK_SET
%119 = call i32 @fseek(i32* %117, i32 0, i32 %118)
store i8* null, i8** %11
store i32 0, i32* %12
store i32 0, i32* %13
store i32* null, i32** %14
store i32 0, i32* %15
%120 = load i8*, i8** %4
%121 = getelementptr inbounds i8, i8* %120, i64 8
%122 = bitcast i8* %121 to i32*
%123 = load i32, i32* %122
store i32 %123, i32* %12
store i32 0, i32* %16
%124 = load i32, i32* %9
%125 = call i64 @malloc(i32 %124)
%126 = inttoptr i64 %125 to i8*
store i8* %126, i8** %11
%127 = load i8*, i8** %11
%128 = load i32, i32* %9
%129 = call i32 @memset(i8* %127, i32 0, i32 %128)
%130 = load i8*, i8** %11
%131 = load i32, i32* %9
%132 = load i32*, i32** %10
%133 = call i32 @fread(i8* %130, i32 1, i32 %131, i32* %132)
store i32 %133, i32* %16
%134 = load i32, i32* %16
%135 = load i32, i32* %9
%136 = icmp ne i32 %134, %135
br i1 %136, label %137, label %139
137: ; preds = %116
%138 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.17, i64 0, i64 0))
br label %176
139: ; preds = %116
%140 = load i8*, i8** %11
%141 = bitcast i8* %140 to i32*
store i32* %141, i32** %14
store i32 0, i32* %15
br label %142
142: ; preds = %155, %139
%143 = load i32, i32* %15
%144 = load i32, i32* %9
%145 = sdiv i32 %144, 4
%146 = icmp slt i32 %143, %145
br i1 %146, label %147, label %158
147: ; preds = %142
%148 = load i32*, i32** %14
%149 = load i32, i32* %15
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds i32, i32* %148, i64 %150
%152 = load i32, i32* %151
%153 = load i32, i32* %13
%154 = xor i32 %153, %152
store i32 %154, i32* %13
br label %155
155: ; preds = %147
%156 = load i32, i32* %15
%157 = add nsw i32 %156, 1
store i32 %157, i32* %15
br label %142
158: ; preds = %142
%159 = load i32, i32* %13
%160 = load i32, i32* %12
%161 = icmp ne i32 %159, %160
br i1 %161, label %162, label %164
162: ; preds = %158
%163 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.18, i64 0, i64 0))
br label %176
164: ; preds = %158
%165 = load i32*, i32** %10
%166 = call i32 @fclose(i32* %165)
%167 = load i8*, i8** %4
%168 = call i32 @free(i8* %167)
%169 = load i8*, i8** %11
%170 = call i32 @free(i8* %169)
%171 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.19, i64 0, i64 0))
%172 = load i32, i32* @stdout
%173 = call i32 @fprintf(i32 %172, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%174 = load i32, i32* @stdout
%175 = call i32 @fprintf(i32 %174, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
store i32 0, i32* %1
br label %182
176: ; preds = %162, %137, %114, %94, %78, %64, %54, %44
%177 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.20, i64 0, i64 0))
%178 = load i32, i32* @stdout
%179 = call i32 @fprintf(i32 %178, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%180 = load i32, i32* @stdout
%181 = call i32 @fprintf(i32 %180, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %1
br label %182
182: ; preds = %176, %164
%183 = load i32, i32* %1
ret i32 %183
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [27 x i8] c"Content-type:text/html\0D\0A\0D\0A\00"
@.str.1 = [35 x i8] c"<html><title>boot upgrade</title>\0A\00"
@.str.2 = [8 x i8] c"<body>\0A\00"
@.str.3 = [22 x i8] c"/tmp/boot_upgrade.bin\00"
@.str.4 = [4 x i8] c"wb+\00"
@.str.6 = [9 x i8] c"</body>\0A\00"
@.str.7 = [10 x i8] c"\0A</html>\0A\00"
@.str.8 = [15 x i8] c"CONTENT_LENGTH\00"
@.str.9 = [23 x i8] c"<br>malloc failed <br>\00"
@stdin = global i32* null
@.str.10 = [22 x i8] c"<br>fread failed <br>\00"
@.str.11 = [33 x i8] c"<br>find head offset failed <br>\00"
@.str.12 = [20 x i8] c"invalid uboot! <br>\00"
@.str.13 = [23 x i8] c"<br>fwrite failed <br>\00"
@.str.14 = [15 x i8] c"/dev/mtdblock0\00"
@.str.15 = [4 x i8] c"rb+\00"
@SEEK_SET = global i32 0
@.str.17 = [42 x i8] c"<br>read uboot from mtdblock0 failed <br>\00"
@.str.18 = [28 x i8] c"<br>uboot check failed <br>\00"
@.str.19 = [35 x i8] c"<br>boot upgrade successful :)<br>\00"
@.str.20 = [31 x i8] c"<br>boot upgrade failed :(<br>\00"
@str = [27 x i8] c"open /dev/mtdblock0 failed\00"
@str.21 = [20 x i8] c"open fw file failed\00"
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stdout
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %16
9: ; preds = %0
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.21, i64 0, i64 0))
%11 = load i32, i32* @stdout
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%13 = load i32, i32* @stdout
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %0
%17 = tail call i32 @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
%18 = tail call i32 @atoi(i32 %17)
%19 = tail call i64 @malloc(i32 %18)
%20 = inttoptr i64 %19 to i8*
%21 = icmp eq i64 %19, 0
br i1 %21, label %169, label %22
22: ; preds = %16
%23 = load i32*, i32** @stdin
%24 = tail call i32 @fread(i8* %20, i32 1, i32 %18, i32* %23)
%25 = icmp eq i32 %24, %18
br i1 %25, label %26, label %169
26: ; preds = %22
%27 = tail call i32 @getflagstr(i8* %20, i32 %18)
%28 = tail call i32 @find_head_offset(i8* %20)
%29 = icmp eq i32 %28, -1
br i1 %29, label %169, label %30
30: ; preds = %26
%31 = sext i32 %28 to i64
%32 = getelementptr inbounds i8, i8* %20, i64 %31
%33 = sub nsw i32 %27, %28
%34 = add nsw i32 %33, 1
%35 = tail call i64 @decode_boot(i8* %32, i32 %34)
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %169
37: ; preds = %30
%38 = add nsw i32 %33, -11
%39 = getelementptr inbounds i8, i8* %32, i64 12
%40 = tail call i32 @fwrite(i8* %39, i32 1, i32 %38, i32* %7)
%41 = icmp eq i32 %40, %38
br i1 %41, label %42, label %169
42: ; preds = %37
%43 = tail call i32 @fclose(i32* %7)
%44 = tail call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0))
%45 = icmp eq i32* %44, null
br i1 %45, label %46, label %49
46: ; preds = %42
%47 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%48 = tail call i32 @exit(i32 1)
unreachable
49: ; preds = %42
%50 = tail call i32 @fwrite(i8* %39, i32 1, i32 %38, i32* %44)
%51 = icmp eq i32 %50, %38
br i1 %51, label %52, label %169
52: ; preds = %49
%53 = load i32, i32* @SEEK_SET
%54 = tail call i32 @fseek(i32* %44, i32 0, i32 %53)
%55 = getelementptr inbounds i8, i8* %32, i64 8
%56 = bitcast i8* %55 to i32*
%57 = load i32, i32* %56
%58 = tail call i64 @malloc(i32 %38)
%59 = inttoptr i64 %58 to i8*
%60 = tail call i32 @memset(i8* %59, i32 0, i32 %38)
%61 = tail call i32 @fread(i8* %59, i32 1, i32 %38, i32* %44)
%62 = icmp eq i32 %61, %38
br i1 %62, label %63, label %169
63: ; preds = %52
%64 = inttoptr i64 %58 to i32*
%65 = icmp sgt i32 %33, 14
br i1 %65, label %66, label %162
66: ; preds = %63
%67 = lshr i32 %38, 2
%68 = zext i32 %67 to i64
%69 = icmp ult i32 %38, 32
br i1 %69, label %151, label %70
70: ; preds = %66
%71 = and i64 %68, 1073741816
%72 = add nsw i64 %71, -8
%73 = lshr exact i64 %72, 3
%74 = add nuw nsw i64 %73, 1
%75 = and i64 %74, 3
%76 = icmp ult i64 %72, 24
br i1 %76, label %122, label %77
77: ; preds = %70
%78 = and i64 %74, 4611686018427387900
br label %79
79: ; preds = %79, %77
%80 = phi i64 [ 0, %77 ], [ %119, %79 ]
%81 = phi <4 x i32> [ zeroinitializer, %77 ], [ %117, %79 ]
%82 = phi <4 x i32> [ zeroinitializer, %77 ], [ %118, %79 ]
%83 = phi i64 [ 0, %77 ], [ %120, %79 ]
%84 = getelementptr inbounds i32, i32* %64, i64 %80
%85 = bitcast i32* %84 to <4 x i32>*
%86 = load <4 x i32>, <4 x i32>* %85
%87 = getelementptr inbounds i32, i32* %84, i64 4
%88 = bitcast i32* %87 to <4 x i32>*
%89 = load <4 x i32>, <4 x i32>* %88
%90 = xor <4 x i32> %86, %81
%91 = xor <4 x i32> %89, %82
%92 = or i64 %80, 8
%93 = getelementptr inbounds i32, i32* %64, i64 %92
%94 = bitcast i32* %93 to <4 x i32>*
%95 = load <4 x i32>, <4 x i32>* %94
%96 = getelementptr inbounds i32, i32* %93, i64 4
%97 = bitcast i32* %96 to <4 x i32>*
%98 = load <4 x i32>, <4 x i32>* %97
%99 = xor <4 x i32> %95, %90
%100 = xor <4 x i32> %98, %91
%101 = or i64 %80, 16
%102 = getelementptr inbounds i32, i32* %64, i64 %101
%103 = bitcast i32* %102 to <4 x i32>*
%104 = load <4 x i32>, <4 x i32>* %103
%105 = getelementptr inbounds i32, i32* %102, i64 4
%106 = bitcast i32* %105 to <4 x i32>*
%107 = load <4 x i32>, <4 x i32>* %106
%108 = xor <4 x i32> %104, %99
%109 = xor <4 x i32> %107, %100
%110 = or i64 %80, 24
%111 = getelementptr inbounds i32, i32* %64, i64 %110
%112 = bitcast i32* %111 to <4 x i32>*
%113 = load <4 x i32>, <4 x i32>* %112
%114 = getelementptr inbounds i32, i32* %111, i64 4
%115 = bitcast i32* %114 to <4 x i32>*
%116 = load <4 x i32>, <4 x i32>* %115
%117 = xor <4 x i32> %113, %108
%118 = xor <4 x i32> %116, %109
%119 = add nuw i64 %80, 32
%120 = add i64 %83, 4
%121 = icmp eq i64 %120, %78
br i1 %121, label %122, label %79
122: ; preds = %79, %70
%123 = phi <4 x i32> [ undef, %70 ], [ %117, %79 ]
%124 = phi <4 x i32> [ undef, %70 ], [ %118, %79 ]
%125 = phi i64 [ 0, %70 ], [ %119, %79 ]
%126 = phi <4 x i32> [ zeroinitializer, %70 ], [ %117, %79 ]
%127 = phi <4 x i32> [ zeroinitializer, %70 ], [ %118, %79 ]
%128 = icmp eq i64 %75, 0
br i1 %128, label %145, label %129
129: ; preds = %122, %129
%130 = phi i64 [ %142, %129 ], [ %125, %122 ]
%131 = phi <4 x i32> [ %140, %129 ], [ %126, %122 ]
%132 = phi <4 x i32> [ %141, %129 ], [ %127, %122 ]
%133 = phi i64 [ %143, %129 ], [ 0, %122 ]
%134 = getelementptr inbounds i32, i32* %64, i64 %130
%135 = bitcast i32* %134 to <4 x i32>*
%136 = load <4 x i32>, <4 x i32>* %135
%137 = getelementptr inbounds i32, i32* %134, i64 4
%138 = bitcast i32* %137 to <4 x i32>*
%139 = load <4 x i32>, <4 x i32>* %138
%140 = xor <4 x i32> %136, %131
%141 = xor <4 x i32> %139, %132
%142 = add nuw i64 %130, 8
%143 = add i64 %133, 1
%144 = icmp eq i64 %143, %75
br i1 %144, label %145, label %129
145: ; preds = %129, %122
%146 = phi <4 x i32> [ %123, %122 ], [ %140, %129 ]
%147 = phi <4 x i32> [ %124, %122 ], [ %141, %129 ]
%148 = xor <4 x i32> %147, %146
%149 = call i32 @llvm.vector.reduce.xor.v4i32(<4 x i32> %148)
%150 = icmp eq i64 %71, %68
br i1 %150, label %162, label %151
151: ; preds = %66, %145
%152 = phi i64 [ 0, %66 ], [ %71, %145 ]
%153 = phi i32 [ 0, %66 ], [ %149, %145 ]
br label %154
154: ; preds = %151, %154
%155 = phi i64 [ %160, %154 ], [ %152, %151 ]
%156 = phi i32 [ %159, %154 ], [ %153, %151 ]
%157 = getelementptr inbounds i32, i32* %64, i64 %155
%158 = load i32, i32* %157
%159 = xor i32 %158, %156
%160 = add nuw nsw i64 %155, 1
%161 = icmp eq i64 %160, %68
br i1 %161, label %162, label %154
162: ; preds = %154, %145, %63
%163 = phi i32 [ 0, %63 ], [ %149, %145 ], [ %159, %154 ]
%164 = icmp eq i32 %163, %57
br i1 %164, label %165, label %169
165: ; preds = %162
%166 = tail call i32 @fclose(i32* %44)
%167 = tail call i32 @free(i8* %32)
%168 = tail call i32 @free(i8* %59)
br label %172
169: ; preds = %162, %52, %49, %37, %30, %26, %22, %16
%170 = phi i8* [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), %16 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), %22 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0), %26 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0), %30 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0), %37 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0), %49 ], [ getelementptr inbounds ([42 x i8], [42 x i8]* @.str.17, i64 0, i64 0), %52 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str.18, i64 0, i64 0), %162 ]
%171 = tail call i32 @printf(i8* dereferenceable(1) %170)
br label %172
172: ; preds = %169, %165
%173 = phi i8* [ getelementptr inbounds ([31 x i8], [31 x i8]* @.str.20, i64 0, i64 0), %169 ], [ getelementptr inbounds ([35 x i8], [35 x i8]* @.str.19, i64 0, i64 0), %165 ]
%174 = phi i32 [ 1, %169 ], [ 0, %165 ]
%175 = tail call i32 @printf(i8* dereferenceable(1) %173)
%176 = load i32, i32* @stdout
%177 = tail call i32 @fprintf(i32 %176, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%178 = load i32, i32* @stdout
%179 = tail call i32 @fprintf(i32 %178, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0))
ret i32 %174
}