#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(unsigned char *);
int /*<<< orphan*/ fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, int, int);
int gen_yuv420p_graybar(int width, int height, int barnum, unsigned char ymin,
                        unsigned char ymax) {
  int barwidth;
  float lum_inc;
  unsigned char lum_temp;
  int uv_width, uv_height;
  FILE *fp = NULL;
  unsigned char *data_y = NULL;
  unsigned char *data_u = NULL;
  unsigned char *data_v = NULL;
  int t = 0, i = 0, j = 0;
  char filename[100] = {0};
  if (width <= 0 || height <= 0 || barnum <= 0) {
    printf(
        "Error: Width, Height or Bar Number cannot be 0 or negative number!\n");
    printf("Default Param is used.\n");
    width = 640;
    height = 480;
    barnum = 10;
  }
  if (width % barnum != 0) {
    printf(
        "Warning: Width cannot be divided by Bar Number without remainder!\n");
  }
  barwidth = width / barnum;
  lum_inc = ((float)(ymax - ymin)) / ((float)(barnum - 1));
  uv_width = width / 2;
  uv_height = height / 2;
  data_y = (unsigned char *)malloc(width * height);
  data_u = (unsigned char *)malloc(uv_width * uv_height);
  data_v = (unsigned char *)malloc(uv_width * uv_height);
  sprintf(filename, "graybar_%dx%d_yuv420p.yuv", width, height);
  if ((fp = fopen(filename, "wb+")) == NULL) {
    printf("Error: Cannot create file!");
    return -1;
  }
  printf("Y, U, V value from picture's left to right:\n");
  for (t = 0; t < (width / barwidth); t++) {
    lum_temp = ymin + (char)(t * lum_inc);
    printf("%3d, 128, 128\n", lum_temp);
  }
  for (j = 0; j < height; j++) {
    for (i = 0; i < width; i++) {
      t = i / barwidth;
      lum_temp = ymin + (char)(t * lum_inc);
      data_y[j * width + i] = lum_temp;
    }
  }
  for (j = 0; j < uv_height; j++) {
    for (i = 0; i < uv_width; i++) {
      data_u[j * uv_width + i] = 128;
    }
  }
  for (j = 0; j < uv_height; j++) {
    for (i = 0; i < uv_width; i++) {
      data_v[j * uv_width + i] = 128;
    }
  }
  fwrite(data_y, width * height, 1, fp);
  fwrite(data_u, uv_width * uv_height, 1, fp);
  fwrite(data_v, uv_width * uv_height, 1, fp);
  fclose(fp);
  free(data_y);
  free(data_u);
  free(data_v);
  printf("Finish generate %s!\n", filename);
  return 0;
}


x86 assembly (clang, -O0):
<gen_yuv420p_graybar>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %r8b,%al
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %cl,-0x11(%rbp)
mov    %al,-0x12(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
lea    -0xc0(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1060 <memset@plt>
cmpl   $0x0,-0x8(%rbp)
jle    1203 <gen_yuv420p_graybar+0x83>
cmpl   $0x0,-0xc(%rbp)
jle    1203 <gen_yuv420p_graybar+0x83>
cmpl   $0x0,-0x10(%rbp)
jg     1234 <gen_yuv420p_graybar+0xb4>
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x280,-0x8(%rbp)
movl   $0x1e0,-0xc(%rbp)
movl   $0xa,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
je     1252 <gen_yuv420p_graybar+0xd2>
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    %eax,-0x18(%rbp)
movzbl -0x12(%rbp),%eax
movzbl -0x11(%rbp),%ecx
sub    %ecx,%eax
cvtsi2ss %eax,%xmm0
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%edi
imul   -0xc(%rbp),%edi
call   1070 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x24(%rbp),%edi
imul   -0x28(%rbp),%edi
call   1070 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x24(%rbp),%edi
imul   -0x28(%rbp),%edi
call   1070 <malloc@plt>
mov    %rax,-0x48(%rbp)
lea    -0xc0(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xdc2(%rip),%rsi
call   1090 <sprintf@plt>
lea    -0xc0(%rbp),%rdi
lea    0xdc9(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    131d <gen_yuv420p_graybar+0x19d>
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    155b <gen_yuv420p_graybar+0x3db>
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    %eax,-0xc4(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    %eax,%ecx
mov    -0xc4(%rbp),%eax
cmp    %ecx,%eax
jge    1390 <gen_yuv420p_graybar+0x210>
movzbl -0x11(%rbp),%eax
cvtsi2ssl -0x4c(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%ecx
movsbl %cl,%ecx
add    %ecx,%eax
mov    %al,-0x1d(%rbp)
movzbl -0x1d(%rbp),%esi
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1332 <gen_yuv420p_graybar+0x1b2>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1418 <gen_yuv420p_graybar+0x298>
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1405 <gen_yuv420p_graybar+0x285>
mov    -0x50(%rbp),%eax
mov    -0x18(%rbp),%ecx
cltd
idiv   %ecx
mov    %eax,-0x4c(%rbp)
movzbl -0x11(%rbp),%eax
cvtsi2ssl -0x4c(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%ecx
movsbl %cl,%ecx
add    %ecx,%eax
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%dl
mov    -0x38(%rbp),%rax
mov    -0x54(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x50(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    13aa <gen_yuv420p_graybar+0x22a>
jmp    140a <gen_yuv420p_graybar+0x28a>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1397 <gen_yuv420p_graybar+0x217>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1474 <gen_yuv420p_graybar+0x2f4>
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1461 <gen_yuv420p_graybar+0x2e1>
mov    -0x40(%rbp),%rax
mov    -0x54(%rbp),%ecx
imul   -0x24(%rbp),%ecx
add    -0x50(%rbp),%ecx
movslq %ecx,%rcx
movb   $0x80,(%rax,%rcx,1)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1432 <gen_yuv420p_graybar+0x2b2>
jmp    1466 <gen_yuv420p_graybar+0x2e6>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    141f <gen_yuv420p_graybar+0x29f>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    14d0 <gen_yuv420p_graybar+0x350>
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    14bd <gen_yuv420p_graybar+0x33d>
mov    -0x48(%rbp),%rax
mov    -0x54(%rbp),%ecx
imul   -0x24(%rbp),%ecx
add    -0x50(%rbp),%ecx
movslq %ecx,%rcx
movb   $0x80,(%rax,%rcx,1)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    148e <gen_yuv420p_graybar+0x30e>
jmp    14c2 <gen_yuv420p_graybar+0x342>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    147b <gen_yuv420p_graybar+0x2fb>
mov    -0x38(%rbp),%rdi
mov    -0x8(%rbp),%esi
imul   -0xc(%rbp),%esi
mov    -0x30(%rbp),%rcx
mov    $0x1,%edx
call   10a0 <fwrite@plt>
mov    -0x40(%rbp),%rdi
mov    -0x24(%rbp),%esi
imul   -0x28(%rbp),%esi
mov    -0x30(%rbp),%rcx
mov    $0x1,%edx
call   10a0 <fwrite@plt>
mov    -0x48(%rbp),%rdi
mov    -0x24(%rbp),%esi
imul   -0x28(%rbp),%esi
mov    -0x30(%rbp),%rcx
mov    $0x1,%edx
call   10a0 <fwrite@plt>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
lea    -0xc0(%rbp),%rsi
lea    0xbc7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_yuv420p_graybar>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
mov    %r8d,0x18(%rsp)
mov    %ecx,%ebp
mov    %esi,0x10(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movl   $0x0,0xd0(%rsp)
test   %edi,%edi
jle    11fb <gen_yuv420p_graybar+0x6b>
cmpl   $0x0,0x10(%rsp)
jle    11fb <gen_yuv420p_graybar+0x6b>
mov    %edx,%ecx
mov    %edi,%r13d
test   %edx,%edx
jg     1226 <gen_yuv420p_graybar+0x96>
lea    0xec9(%rip),%rdi
call   1040 <puts@plt>
lea    0xf00(%rip),%rdi
call   1040 <puts@plt>
mov    $0x280,%r13d
movl   $0x1e0,0x10(%rsp)
mov    $0xa,%ecx
mov    %r13d,%eax
xor    %edx,%edx
mov    %ecx,0x40(%rsp)
div    %ecx
mov    %eax,%r14d
test   %edx,%edx
mov    %r13d,0xc(%rsp)
je     124e <gen_yuv420p_graybar+0xbe>
lea    0xe45(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%r13d
mov    %r13d,%ebx
shr    %ebx
mov    0x10(%rsp),%r12d
mov    %r12d,%r15d
shr    %r15d
mov    %r13d,%edi
imul   %r12d,%edi
mov    %edi,0x58(%rsp)
call   1080 <malloc@plt>
mov    %rax,0x30(%rsp)
mov    %rbx,0x20(%rsp)
mov    %r15d,0x38(%rsp)
imul   %r15d,%ebx
mov    %ebx,%edi
call   1080 <malloc@plt>
mov    %rax,0x50(%rsp)
mov    %ebx,0x5c(%rsp)
mov    %ebx,%edi
call   1080 <malloc@plt>
mov    %rax,0x48(%rsp)
lea    0xd5c(%rip),%rsi
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
mov    %r13d,%edx
mov    %r12d,%ecx
call   10a0 <sprintf@plt>
lea    0xd5c(%rip),%rsi
mov    %rbx,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     14ab <gen_yuv420p_graybar+0x31b>
mov    %rax,0x68(%rsp)
movzbl 0x18(%rsp),%eax
movzbl %bpl,%ecx
sub    %ecx,%eax
cvtsi2ss %eax,%xmm1
mov    0x40(%rsp),%eax
add    $0xffffffff,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  %xmm0,%xmm1
movss  %xmm1,0x18(%rsp)
lea    0xd5b(%rip),%rdi
call   1040 <puts@plt>
mov    %r13d,%eax
xor    %edx,%edx
div    %r14d
mov    %eax,%r15d
lea    0xd20(%rip),%r12
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
mulss  0x18(%rsp),%xmm0
cvttss2si %xmm0,%eax
add    %bpl,%al
movzbl %al,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%ebx
cmp    %r15d,%ebx
jne    1320 <gen_yuv420p_graybar+0x190>
cmpl   $0x0,0x10(%rsp)
mov    0x30(%rsp),%r15
mov    0xc(%rsp),%r11d
movss  0x18(%rsp),%xmm1
jle    1412 <gen_yuv420p_graybar+0x282>
movslq %r11d,%r10
mov    0x10(%rsp),%r9d
mov    %r11d,%r8d
mov    %r8d,%ebx
and    $0xfffffffe,%ebx
mov    %r15,%rdi
add    $0x1,%rdi
xor    %esi,%esi
jmp    1390 <gen_yuv420p_graybar+0x200>
add    $0x1,%rsi
add    %r10,%rdi
cmp    %r9,%rsi
je     1412 <gen_yuv420p_graybar+0x282>
test   %r11d,%r11d
jle    1380 <gen_yuv420p_graybar+0x1f0>
xor    %ecx,%ecx
cmp    $0x1,%r11d
je     13e1 <gen_yuv420p_graybar+0x251>
nopl   (%rax)
mov    %ecx,%eax
cltd
idiv   %r14d
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
add    %bpl,%al
mov    %al,-0x1(%rdi,%rcx,1)
lea    0x1(%rcx),%eax
cltd
idiv   %r14d
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
add    %bpl,%al
mov    %al,(%rdi,%rcx,1)
add    $0x2,%rcx
cmp    %rbx,%rcx
jne    13a0 <gen_yuv420p_graybar+0x210>
test   $0x1,%r8b
je     1380 <gen_yuv420p_graybar+0x1f0>
mov    %ecx,%eax
cltd
idiv   %r14d
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mov    %rsi,%rax
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%edx
imul   %r10,%rax
add    %bpl,%dl
add    %rcx,%rax
mov    %dl,(%r15,%rax,1)
jmp    1380 <gen_yuv420p_graybar+0x1f0>
cmpl   $0x2,0x10(%rsp)
jb     153b <gen_yuv420p_graybar+0x3ab>
mov    0x20(%rsp),%rax
cmp    $0x2,%eax
mov    $0x1,%r13d
cmovae %eax,%r13d
mov    $0x1,%ecx
mov    0x38(%rsp),%edx
cmp    $0x2,%edx
cmovae %edx,%ecx
lea    -0x1(%rcx),%rdx
mov    %ecx,%ebx
and    $0x3,%ebx
xor    %r12d,%r12d
mov    %rdx,0x60(%rsp)
cmp    $0x3,%rdx
mov    %rcx,0x28(%rsp)
jae    15cf <gen_yuv420p_graybar+0x43f>
xor    %r14d,%r14d
test   %rbx,%rbx
mov    0x30(%rsp),%r15
mov    0x20(%rsp),%rbp
je     14c3 <gen_yuv420p_graybar+0x333>
imul   %ebp,%r14d
jmp    1489 <gen_yuv420p_graybar+0x2f9>
cs nopw 0x0(%rax,%rax,1)
add    %ebp,%r14d
add    $0xffffffffffffffff,%rbx
je     14c3 <gen_yuv420p_graybar+0x333>
cmp    $0x2,%r11d
jb     1480 <gen_yuv420p_graybar+0x2f0>
mov    %r14d,%edi
add    0x50(%rsp),%rdi
mov    $0x80,%esi
mov    %r13,%rdx
call   1070 <memset@plt>
mov    0xc(%rsp),%r11d
jmp    1480 <gen_yuv420p_graybar+0x2f0>
lea    0xb6c(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%ebx
jmp    15bb <gen_yuv420p_graybar+0x42b>
cmpl   $0x2,0x10(%rsp)
jb     153b <gen_yuv420p_graybar+0x3ab>
mov    0x20(%rsp),%rax
cmp    $0x2,%eax
mov    $0x1,%r14d
cmovae %eax,%r14d
mov    0x28(%rsp),%rdx
mov    %edx,%r12d
and    $0x3,%r12d
xor    %ebx,%ebx
cmpq   $0x3,0x60(%rsp)
jae    1680 <gen_yuv420p_graybar+0x4f0>
xor    %ebp,%ebp
test   %r12,%r12
mov    0x30(%rsp),%r15
je     153b <gen_yuv420p_graybar+0x3ab>
imul   0x20(%rsp),%ebp
jmp    151a <gen_yuv420p_graybar+0x38a>
nopl   0x0(%rax)
add    0x20(%rsp),%ebp
add    $0xffffffffffffffff,%r12
je     153b <gen_yuv420p_graybar+0x3ab>
cmp    $0x2,%r11d
jb     1510 <gen_yuv420p_graybar+0x380>
mov    %ebp,%edi
add    0x48(%rsp),%rdi
mov    $0x80,%esi
mov    %r14,%rdx
call   1070 <memset@plt>
mov    0xc(%rsp),%r11d
jmp    1510 <gen_yuv420p_graybar+0x380>
mov    %r15,%rdi
mov    0x58(%rsp),%esi
mov    $0x1,%edx
mov    0x68(%rsp),%rbp
mov    %rbp,%rcx
call   10b0 <fwrite@plt>
mov    0x50(%rsp),%r14
mov    %r14,%rdi
mov    0x5c(%rsp),%ebx
mov    %ebx,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10b0 <fwrite@plt>
mov    0x48(%rsp),%r12
mov    %r12,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10b0 <fwrite@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
lea    0xa9b(%rip),%rdi
xor    %ebx,%ebx
lea    0x70(%rsp),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebx,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ecx,%edx
and    $0xfffffffc,%edx
lea    (%rax,%rax,1),%ecx
mov    %rcx,0x18(%rsp)
lea    0x0(,%rax,4),%ebp
lea    (%rax,%rax,2),%eax
mov    %rax,0x38(%rsp)
xor    %r14d,%r14d
mov    %rdx,0x40(%rsp)
mov    0x50(%rsp),%r15
jmp    1610 <gen_yuv420p_graybar+0x480>
nopw   0x0(%rax,%rax,1)
add    $0x4,%r14
add    %ebp,%r12d
cmp    %r14,%rdx
je     1461 <gen_yuv420p_graybar+0x2d1>
cmp    $0x2,%r11d
jb     1600 <gen_yuv420p_graybar+0x470>
mov    %r12d,%edi
add    %r15,%rdi
mov    $0x80,%esi
mov    %r13,%rdx
call   1070 <memset@plt>
mov    0x20(%rsp),%rax
lea    (%rax,%r12,1),%edi
add    %r15,%rdi
mov    $0x80,%esi
mov    %r13,%rdx
call   1070 <memset@plt>
mov    0x18(%rsp),%rax
lea    (%rax,%r12,1),%edi
add    %r15,%rdi
mov    $0x80,%esi
mov    %r13,%rdx
call   1070 <memset@plt>
mov    0x38(%rsp),%rax
lea    (%rax,%r12,1),%edi
add    %r15,%rdi
mov    $0x80,%esi
mov    %r13,%rdx
call   1070 <memset@plt>
mov    0x40(%rsp),%rdx
mov    0xc(%rsp),%r11d
jmp    1600 <gen_yuv420p_graybar+0x470>
and    $0xfffffffc,%edx
lea    (%rax,%rax,1),%ecx
mov    %rcx,0x18(%rsp)
lea    0x0(,%rax,4),%r13d
lea    (%rax,%rax,2),%eax
mov    %rax,0x10(%rsp)
xor    %ebp,%ebp
mov    %rdx,0x28(%rsp)
mov    0x48(%rsp),%r15
jmp    16c0 <gen_yuv420p_graybar+0x530>
nopl   0x0(%rax)
add    $0x4,%rbp
add    %r13d,%ebx
cmp    %rbp,%rdx
je     14f8 <gen_yuv420p_graybar+0x368>
cmp    $0x2,%r11d
jb     16b0 <gen_yuv420p_graybar+0x520>
mov    %ebx,%edi
add    %r15,%rdi
mov    $0x80,%esi
mov    %r14,%rdx
call   1070 <memset@plt>
mov    0x20(%rsp),%rax
lea    (%rax,%rbx,1),%edi
add    %r15,%rdi
mov    $0x80,%esi
mov    %r14,%rdx
call   1070 <memset@plt>
mov    0x18(%rsp),%rax
lea    (%rax,%rbx,1),%edi
add    %r15,%rdi
mov    $0x80,%esi
mov    %r14,%rdx
call   1070 <memset@plt>
mov    0x10(%rsp),%rax
lea    (%rax,%rbx,1),%edi
add    %r15,%rdi
mov    $0x80,%esi
mov    %r14,%rdx
call   1070 <memset@plt>
mov    0x28(%rsp),%rdx
mov    0xc(%rsp),%r11d
jmp    16b0 <gen_yuv420p_graybar+0x520>

LLVM IR (-O0):
@.str = [68 x i8] c"Error: Width, Height or Bar Number cannot be 0 or negative number!\0A\00"
@.str.1 = [24 x i8] c"Default Param is used.\0A\00"
@.str.2 = [67 x i8] c"Warning: Width cannot be divided by Bar Number without remainder!\0A\00"
@.str.3 = [26 x i8] c"graybar_%dx%d_yuv420p.yuv\00"
@.str.4 = [4 x i8] c"wb+\00"
@.str.5 = [27 x i8] c"Error: Cannot create file!\00"
@.str.6 = [45 x i8] c"Y, U, V value from picture's left to right:\0A\00"
@.str.7 = [15 x i8] c"%3d, 128, 128\0A\00"
@.str.8 = [21 x i8] c"Finish generate %s!\0A\00"
define i32 @gen_yuv420p_graybar(i32 %0, i32 %1, i32 %2, i8 zeroext %3, i8 zeroext %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
%11 = alloca i8
%12 = alloca i32
%13 = alloca float
%14 = alloca i8
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32*
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca [100 x i8]
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i8 %3, i8* %10
store i8 %4, i8* %11
store i32* null, i32** %17
store i8* null, i8** %18
store i8* null, i8** %19
store i8* null, i8** %20
store i32 0, i32* %21
store i32 0, i32* %22
store i32 0, i32* %23
%25 = bitcast [100 x i8]* %24 to i8*
%26 = load i32, i32* %7
%27 = icmp sle i32 %26, 0
br i1 %27, label %34, label %28
28: ; preds = %5
%29 = load i32, i32* %8
%30 = icmp sle i32 %29, 0
br i1 %30, label %34, label %31
31: ; preds = %28
%32 = load i32, i32* %9
%33 = icmp sle i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %31, %28, %5
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0))
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
store i32 640, i32* %7
store i32 480, i32* %8
store i32 10, i32* %9
br label %37
37: ; preds = %34, %31
%38 = load i32, i32* %7
%39 = load i32, i32* %9
%40 = srem i32 %38, %39
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %37
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.2, i64 0, i64 0))
br label %44
44: ; preds = %42, %37
%45 = load i32, i32* %7
%46 = load i32, i32* %9
%47 = sdiv i32 %45, %46
store i32 %47, i32* %12
%48 = load i8, i8* %11
%49 = zext i8 %48 to i32
%50 = load i8, i8* %10
%51 = zext i8 %50 to i32
%52 = sub nsw i32 %49, %51
%53 = sitofp i32 %52 to float
%54 = load i32, i32* %9
%55 = sub nsw i32 %54, 1
%56 = sitofp i32 %55 to float
%57 = fdiv float %53, %56
store float %57, float* %13
%58 = load i32, i32* %7
%59 = sdiv i32 %58, 2
store i32 %59, i32* %15
%60 = load i32, i32* %8
%61 = sdiv i32 %60, 2
store i32 %61, i32* %16
%62 = load i32, i32* %7
%63 = load i32, i32* %8
%64 = mul nsw i32 %62, %63
%65 = call i64 @malloc(i32 %64)
%66 = inttoptr i64 %65 to i8*
store i8* %66, i8** %18
%67 = load i32, i32* %15
%68 = load i32, i32* %16
%69 = mul nsw i32 %67, %68
%70 = call i64 @malloc(i32 %69)
%71 = inttoptr i64 %70 to i8*
store i8* %71, i8** %19
%72 = load i32, i32* %15
%73 = load i32, i32* %16
%74 = mul nsw i32 %72, %73
%75 = call i64 @malloc(i32 %74)
%76 = inttoptr i64 %75 to i8*
store i8* %76, i8** %20
%77 = getelementptr inbounds [100 x i8], [100 x i8]* %24, i64 0, i64 0
%78 = load i32, i32* %7
%79 = load i32, i32* %8
%80 = call i32 @sprintf(i8* %77, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %78, i32 %79)
%81 = getelementptr inbounds [100 x i8], [100 x i8]* %24, i64 0, i64 0
%82 = call i32* @fopen(i8* %81, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
store i32* %82, i32** %17
%83 = icmp eq i32* %82, null
br i1 %83, label %84, label %86
84: ; preds = %44
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %6
br label %232
86: ; preds = %44
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %21
br label %88
88: ; preds = %108, %86
%89 = load i32, i32* %21
%90 = load i32, i32* %7
%91 = load i32, i32* %12
%92 = sdiv i32 %90, %91
%93 = icmp slt i32 %89, %92
br i1 %93, label %94, label %111
94: ; preds = %88
%95 = load i8, i8* %10
%96 = zext i8 %95 to i32
%97 = load i32, i32* %21
%98 = sitofp i32 %97 to float
%99 = load float, float* %13
%100 = fmul float %98, %99
%101 = fptosi float %100 to i8
%102 = sext i8 %101 to i32
%103 = add nsw i32 %96, %102
%104 = trunc i32 %103 to i8
store i8 %104, i8* %14
%105 = load i8, i8* %14
%106 = zext i8 %105 to i32
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 %106)
br label %108
108: ; preds = %94
%109 = load i32, i32* %21
%110 = add nsw i32 %109, 1
store i32 %110, i32* %21
br label %88
111: ; preds = %88
store i32 0, i32* %23
br label %112
112: ; preds = %148, %111
%113 = load i32, i32* %23
%114 = load i32, i32* %8
%115 = icmp slt i32 %113, %114
br i1 %115, label %116, label %151
116: ; preds = %112
store i32 0, i32* %22
br label %117
117: ; preds = %144, %116
%118 = load i32, i32* %22
%119 = load i32, i32* %7
%120 = icmp slt i32 %118, %119
br i1 %120, label %121, label %147
121: ; preds = %117
%122 = load i32, i32* %22
%123 = load i32, i32* %12
%124 = sdiv i32 %122, %123
store i32 %124, i32* %21
%125 = load i8, i8* %10
%126 = zext i8 %125 to i32
%127 = load i32, i32* %21
%128 = sitofp i32 %127 to float
%129 = load float, float* %13
%130 = fmul float %128, %129
%131 = fptosi float %130 to i8
%132 = sext i8 %131 to i32
%133 = add nsw i32 %126, %132
%134 = trunc i32 %133 to i8
store i8 %134, i8* %14
%135 = load i8, i8* %14
%136 = load i8*, i8** %18
%137 = load i32, i32* %23
%138 = load i32, i32* %7
%139 = mul nsw i32 %137, %138
%140 = load i32, i32* %22
%141 = add nsw i32 %139, %140
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds i8, i8* %136, i64 %142
store i8 %135, i8* %143
br label %144
144: ; preds = %121
%145 = load i32, i32* %22
%146 = add nsw i32 %145, 1
store i32 %146, i32* %22
br label %117
147: ; preds = %117
br label %148
148: ; preds = %147
%149 = load i32, i32* %23
%150 = add nsw i32 %149, 1
store i32 %150, i32* %23
br label %112
151: ; preds = %112
store i32 0, i32* %23
br label %152
152: ; preds = %174, %151
%153 = load i32, i32* %23
%154 = load i32, i32* %16
%155 = icmp slt i32 %153, %154
br i1 %155, label %156, label %177
156: ; preds = %152
store i32 0, i32* %22
br label %157
157: ; preds = %170, %156
%158 = load i32, i32* %22
%159 = load i32, i32* %15
%160 = icmp slt i32 %158, %159
br i1 %160, label %161, label %173
161: ; preds = %157
%162 = load i8*, i8** %19
%163 = load i32, i32* %23
%164 = load i32, i32* %15
%165 = mul nsw i32 %163, %164
%166 = load i32, i32* %22
%167 = add nsw i32 %165, %166
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds i8, i8* %162, i64 %168
store i8 -128, i8* %169
br label %170
170: ; preds = %161
%171 = load i32, i32* %22
%172 = add nsw i32 %171, 1
store i32 %172, i32* %22
br label %157
173: ; preds = %157
br label %174
174: ; preds = %173
%175 = load i32, i32* %23
%176 = add nsw i32 %175, 1
store i32 %176, i32* %23
br label %152
177: ; preds = %152
store i32 0, i32* %23
br label %178
178: ; preds = %200, %177
%179 = load i32, i32* %23
%180 = load i32, i32* %16
%181 = icmp slt i32 %179, %180
br i1 %181, label %182, label %203
182: ; preds = %178
store i32 0, i32* %22
br label %183
183: ; preds = %196, %182
%184 = load i32, i32* %22
%185 = load i32, i32* %15
%186 = icmp slt i32 %184, %185
br i1 %186, label %187, label %199
187: ; preds = %183
%188 = load i8*, i8** %20
%189 = load i32, i32* %23
%190 = load i32, i32* %15
%191 = mul nsw i32 %189, %190
%192 = load i32, i32* %22
%193 = add nsw i32 %191, %192
%194 = sext i32 %193 to i64
%195 = getelementptr inbounds i8, i8* %188, i64 %194
store i8 -128, i8* %195
br label %196
196: ; preds = %187
%197 = load i32, i32* %22
%198 = add nsw i32 %197, 1
store i32 %198, i32* %22
br label %183
199: ; preds = %183
br label %200
200: ; preds = %199
%201 = load i32, i32* %23
%202 = add nsw i32 %201, 1
store i32 %202, i32* %23
br label %178
203: ; preds = %178
%204 = load i8*, i8** %18
%205 = load i32, i32* %7
%206 = load i32, i32* %8
%207 = mul nsw i32 %205, %206
%208 = load i32*, i32** %17
%209 = call i32 @fwrite(i8* %204, i32 %207, i32 1, i32* %208)
%210 = load i8*, i8** %19
%211 = load i32, i32* %15
%212 = load i32, i32* %16
%213 = mul nsw i32 %211, %212
%214 = load i32*, i32** %17
%215 = call i32 @fwrite(i8* %210, i32 %213, i32 1, i32* %214)
%216 = load i8*, i8** %20
%217 = load i32, i32* %15
%218 = load i32, i32* %16
%219 = mul nsw i32 %217, %218
%220 = load i32*, i32** %17
%221 = call i32 @fwrite(i8* %216, i32 %219, i32 1, i32* %220)
%222 = load i32*, i32** %17
%223 = call i32 @fclose(i32* %222)
%224 = load i8*, i8** %18
%225 = call i32 @free(i8* %224)
%226 = load i8*, i8** %19
%227 = call i32 @free(i8* %226)
%228 = load i8*, i8** %20
%229 = call i32 @free(i8* %228)
%230 = getelementptr inbounds [100 x i8], [100 x i8]* %24, i64 0, i64 0
%231 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* %230)
store i32 0, i32* %6
br label %232
232: ; preds = %203, %84
%233 = load i32, i32* %6
ret i32 %233
}

LLVM IR (-O2):
@.str.3 = [26 x i8] c"graybar_%dx%d_yuv420p.yuv\00"
@.str.4 = [4 x i8] c"wb+\00"
@.str.5 = [27 x i8] c"Error: Cannot create file!\00"
@.str.7 = [15 x i8] c"%3d, 128, 128\0A\00"
@.str.8 = [21 x i8] c"Finish generate %s!\0A\00"
@str = [44 x i8] c"Y, U, V value from picture's left to right:\00"
@str.9 = [66 x i8] c"Warning: Width cannot be divided by Bar Number without remainder!\00"
@str.10 = [67 x i8] c"Error: Width, Height or Bar Number cannot be 0 or negative number!\00"
@str.11 = [23 x i8] c"Default Param is used.\00"
define i32 @gen_yuv420p_graybar(i32 %0, i32 %1, i32 %2, i8 zeroext %3, i8 zeroext %4) {
%6 = alloca [100 x i8]
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%8 = icmp slt i32 %0, 1
%9 = icmp slt i32 %1, 1
%10 = or i1 %8, %9
%11 = icmp slt i32 %2, 1
%12 = or i1 %10, %11
br i1 %12, label %13, label %16
13: ; preds = %5
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str.10, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.11, i64 0, i64 0))
br label %16
16: ; preds = %5, %13
%17 = phi i32 [ 10, %13 ], [ %2, %5 ]
%18 = phi i32 [ 480, %13 ], [ %1, %5 ]
%19 = phi i32 [ 640, %13 ], [ %0, %5 ]
%20 = urem i32 %19, %17
%21 = udiv i32 %19, %17
%22 = icmp eq i32 %20, 0
br i1 %22, label %25, label %23
23: ; preds = %16
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str.9, i64 0, i64 0))
br label %25
25: ; preds = %23, %16
%26 = zext i8 %4 to i32
%27 = zext i8 %3 to i32
%28 = sub nsw i32 %26, %27
%29 = sitofp i32 %28 to float
%30 = add nsw i32 %17, -1
%31 = sitofp i32 %30 to float
%32 = fdiv float %29, %31
%33 = lshr i32 %19, 1
%34 = lshr i32 %18, 1
%35 = mul nsw i32 %19, %18
%36 = tail call i64 @malloc(i32 %35)
%37 = inttoptr i64 %36 to i8*
%38 = mul nsw i32 %33, %34
%39 = tail call i64 @malloc(i32 %38)
%40 = inttoptr i64 %39 to i8*
%41 = tail call i64 @malloc(i32 %38)
%42 = inttoptr i64 %41 to i8*
%43 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %19, i32 %18)
%44 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%45 = icmp eq i32* %44, null
br i1 %45, label %46, label %48
46: ; preds = %25
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %229
48: ; preds = %25
%49 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%50 = udiv i32 %19, %21
br label %62
51: ; preds = %62
%52 = icmp sgt i32 %18, 0
br i1 %52, label %53, label %76
53: ; preds = %51
%54 = icmp sgt i32 %19, 0
%55 = sext i32 %19 to i64
%56 = zext i32 %18 to i64
%57 = zext i32 %19 to i64
%58 = and i64 %57, 1
%59 = icmp eq i32 %19, 1
%60 = and i64 %57, 4294967294
%61 = icmp eq i64 %58, 0
br label %72
62: ; preds = %48, %62
%63 = phi i32 [ %70, %62 ], [ 0, %48 ]
%64 = sitofp i32 %63 to float
%65 = fmul float %32, %64
%66 = fptosi float %65 to i8
%67 = add i8 %66, %3
%68 = zext i8 %67 to i32
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 %68)
%70 = add nuw nsw i32 %63, 1
%71 = icmp eq i32 %70, %50
br i1 %71, label %51, label %62
72: ; preds = %53, %123
%73 = phi i64 [ 0, %53 ], [ %124, %123 ]
br i1 %54, label %74, label %123
74: ; preds = %72
%75 = mul nsw i64 %73, %55
br i1 %59, label %112, label %89
76: ; preds = %123, %51
%77 = icmp ult i32 %18, 2
br i1 %77, label %220, label %78
78: ; preds = %76
%79 = icmp ult i32 %19, 2
%80 = call i32 @llvm.umax.i32(i32 %33, i32 1)
%81 = zext i32 %80 to i64
%82 = call i32 @llvm.umax.i32(i32 %34, i32 1)
%83 = zext i32 %82 to i64
%84 = add nsw i64 %83, -1
%85 = and i64 %83, 3
%86 = icmp ult i64 %84, 3
br i1 %86, label %149, label %87
87: ; preds = %78
%88 = and i64 %83, 2147483644
br label %126
89: ; preds = %74, %89
%90 = phi i64 [ %109, %89 ], [ 0, %74 ]
%91 = phi i64 [ %110, %89 ], [ 0, %74 ]
%92 = trunc i64 %90 to i32
%93 = sdiv i32 %92, %21
%94 = sitofp i32 %93 to float
%95 = fmul float %32, %94
%96 = fptosi float %95 to i8
%97 = add i8 %96, %3
%98 = add nsw i64 %90, %75
%99 = getelementptr inbounds i8, i8* %37, i64 %98
store i8 %97, i8* %99
%100 = or i64 %90, 1
%101 = trunc i64 %100 to i32
%102 = sdiv i32 %101, %21
%103 = sitofp i32 %102 to float
%104 = fmul float %32, %103
%105 = fptosi float %104 to i8
%106 = add i8 %105, %3
%107 = add nsw i64 %100, %75
%108 = getelementptr inbounds i8, i8* %37, i64 %107
store i8 %106, i8* %108
%109 = add nuw nsw i64 %90, 2
%110 = add i64 %91, 2
%111 = icmp eq i64 %110, %60
br i1 %111, label %112, label %89
112: ; preds = %89, %74
%113 = phi i64 [ 0, %74 ], [ %109, %89 ]
br i1 %61, label %123, label %114
114: ; preds = %112
%115 = trunc i64 %113 to i32
%116 = sdiv i32 %115, %21
%117 = sitofp i32 %116 to float
%118 = fmul float %32, %117
%119 = fptosi float %118 to i8
%120 = add i8 %119, %3
%121 = add nsw i64 %113, %75
%122 = getelementptr inbounds i8, i8* %37, i64 %121
store i8 %120, i8* %122
br label %123
123: ; preds = %114, %112, %72
%124 = add nuw nsw i64 %73, 1
%125 = icmp eq i64 %124, %56
br i1 %125, label %76, label %72
126: ; preds = %174, %87
%127 = phi i64 [ 0, %87 ], [ %175, %174 ]
%128 = phi i64 [ 0, %87 ], [ %176, %174 ]
br i1 %79, label %174, label %129
129: ; preds = %126
%130 = trunc i64 %127 to i32
%131 = mul i32 %33, %130
%132 = zext i32 %131 to i64
%133 = getelementptr i8, i8* %40, i64 %132
%134 = trunc i64 %127 to i32
%135 = or i32 %134, 1
%136 = mul i32 %33, %135
%137 = zext i32 %136 to i64
%138 = getelementptr i8, i8* %40, i64 %137
%139 = trunc i64 %127 to i32
%140 = or i32 %139, 2
%141 = mul i32 %33, %140
%142 = zext i32 %141 to i64
%143 = getelementptr i8, i8* %40, i64 %142
%144 = trunc i64 %127 to i32
%145 = or i32 %144, 3
%146 = mul i32 %33, %145
%147 = zext i32 %146 to i64
%148 = getelementptr i8, i8* %40, i64 %147
br label %174
149: ; preds = %174, %78
%150 = phi i64 [ 0, %78 ], [ %175, %174 ]
%151 = icmp eq i64 %85, 0
br i1 %151, label %164, label %152
152: ; preds = %149, %160
%153 = phi i64 [ %161, %160 ], [ %150, %149 ]
%154 = phi i64 [ %162, %160 ], [ 0, %149 ]
br i1 %79, label %160, label %155
155: ; preds = %152
%156 = trunc i64 %153 to i32
%157 = mul i32 %33, %156
%158 = zext i32 %157 to i64
%159 = getelementptr i8, i8* %40, i64 %158
br label %160
160: ; preds = %155, %152
%161 = add nuw nsw i64 %153, 1
%162 = add i64 %154, 1
%163 = icmp eq i64 %162, %85
br i1 %163, label %164, label %152
164: ; preds = %160, %149
br i1 %77, label %220, label %165
165: ; preds = %164
%166 = icmp ult i32 %19, 2
%167 = call i32 @llvm.umax.i32(i32 %33, i32 1)
%168 = zext i32 %167 to i64
%169 = add nsw i64 %83, -1
%170 = and i64 %83, 3
%171 = icmp ult i64 %169, 3
br i1 %171, label %205, label %172
172: ; preds = %165
%173 = and i64 %83, 2147483644
br label %178
174: ; preds = %126, %129
%175 = add nuw nsw i64 %127, 4
%176 = add i64 %128, 4
%177 = icmp eq i64 %176, %88
br i1 %177, label %149, label %126
178: ; preds = %201, %172
%179 = phi i64 [ 0, %172 ], [ %202, %201 ]
%180 = phi i64 [ 0, %172 ], [ %203, %201 ]
br i1 %166, label %201, label %181
181: ; preds = %178
%182 = trunc i64 %179 to i32
%183 = mul i32 %33, %182
%184 = zext i32 %183 to i64
%185 = getelementptr i8, i8* %42, i64 %184
%186 = trunc i64 %179 to i32
%187 = or i32 %186, 1
%188 = mul i32 %33, %187
%189 = zext i32 %188 to i64
%190 = getelementptr i8, i8* %42, i64 %189
%191 = trunc i64 %179 to i32
%192 = or i32 %191, 2
%193 = mul i32 %33, %192
%194 = zext i32 %193 to i64
%195 = getelementptr i8, i8* %42, i64 %194
%196 = trunc i64 %179 to i32
%197 = or i32 %196, 3
%198 = mul i32 %33, %197
%199 = zext i32 %198 to i64
%200 = getelementptr i8, i8* %42, i64 %199
br label %201
201: ; preds = %178, %181
%202 = add nuw nsw i64 %179, 4
%203 = add i64 %180, 4
%204 = icmp eq i64 %203, %173
br i1 %204, label %205, label %178
205: ; preds = %201, %165
%206 = phi i64 [ 0, %165 ], [ %202, %201 ]
%207 = icmp eq i64 %170, 0
br i1 %207, label %220, label %208
208: ; preds = %205, %216
%209 = phi i64 [ %217, %216 ], [ %206, %205 ]
%210 = phi i64 [ %218, %216 ], [ 0, %205 ]
br i1 %166, label %216, label %211
211: ; preds = %208
%212 = trunc i64 %209 to i32
%213 = mul i32 %33, %212
%214 = zext i32 %213 to i64
%215 = getelementptr i8, i8* %42, i64 %214
br label %216
216: ; preds = %211, %208
%217 = add nuw nsw i64 %209, 1
%218 = add i64 %210, 1
%219 = icmp eq i64 %218, %170
br i1 %219, label %220, label %208
220: ; preds = %205, %216, %76, %164
%221 = tail call i32 @fwrite(i8* %37, i32 %35, i32 1, i32* %44)
%222 = tail call i32 @fwrite(i8* %40, i32 %38, i32 1, i32* %44)
%223 = tail call i32 @fwrite(i8* %42, i32 %38, i32 1, i32* %44)
%224 = tail call i32 @fclose(i32* %44)
%225 = tail call i32 @free(i8* %37)
%226 = tail call i32 @free(i8* %40)
%227 = tail call i32 @free(i8* %42)
%228 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* %7)
br label %229
229: ; preds = %220, %46
%230 = phi i32 [ -1, %46 ], [ 0, %220 ]
ret i32 %230
}