#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_yuvgradient_bar(int width, int height, int barnum,
                                unsigned char src_y, unsigned char src_u,
                                unsigned char src_v, unsigned char dst_y,
                                unsigned char dst_u, unsigned char dst_v) {
  int uv_width, uv_height;
  unsigned char *data_y = NULL;
  unsigned char *data_u = NULL;
  unsigned char *data_v = NULL;
  FILE *fp = NULL;
  int barwidth, uv_barwidth;
  float y_inc, u_inc, v_inc = 0;
  unsigned char y_temp, u_temp, v_temp = 0;
  char filename[100] = {0};
  int t = 0, i = 0, j = 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;
  }
  if (width % barnum != 0)
    printf(
        "Warning: Width cannot be divided by Bar Number without remainder!\n");
  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);
  barwidth = width / barnum;
  uv_barwidth = barwidth / (width / uv_width);
  y_inc = ((float)(dst_y - src_y)) / ((float)(barnum - 1));
  u_inc = ((float)(dst_u - src_u)) / ((float)(barnum - 1));
  v_inc = ((float)(dst_v - src_v)) / ((float)(barnum - 1));
  sprintf(filename, "yuvgradientbar_%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++) {
    y_temp = src_y + (char)(t * y_inc);
    u_temp = src_u + (char)(t * u_inc);
    v_temp = src_v + (char)(t * v_inc);
    printf("%3d, %3d, %3d\n", y_temp, u_temp, v_temp);
  }
  for (j = 0; j < height; j++) {
    for (i = 0; i < width; i++) {
      t = i / barwidth;
      y_temp = src_y + (char)(t * y_inc);
      data_y[j * width + i] = y_temp;
    }
  }
  for (j = 0; j < uv_height; j++) {
    for (i = 0; i < uv_width; i++) {
      t = i / uv_barwidth;
      u_temp = src_u + (char)(t * u_inc);
      data_u[j * uv_width + i] = u_temp;
    }
  }
  for (j = 0; j < uv_height; j++) {
    for (i = 0; i < uv_width; i++) {
      t = i / uv_barwidth;
      v_temp = src_v + (char)(t * v_inc);
      data_v[j * uv_width + i] = v_temp;
    }
  }
  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_yuvgradient_bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %r8d,-0xdc(%rbp)
mov    %ecx,%eax
mov    -0xdc(%rbp),%ecx
mov    %eax,-0xd8(%rbp)
mov    %edx,%eax
mov    -0xd8(%rbp),%edx
mov    %eax,-0xd4(%rbp)
mov    %esi,%eax
mov    -0xd4(%rbp),%esi
mov    %eax,-0xd0(%rbp)
mov    %edi,%r8d
mov    -0xd0(%rbp),%edi
mov    %r9b,%al
mov    0x20(%rbp),%r9b
mov    0x18(%rbp),%r9b
mov    0x10(%rbp),%r9b
mov    %r8d,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %dl,-0x11(%rbp)
mov    %cl,-0x12(%rbp)
mov    %al,-0x13(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x54(%rbp)
movb   $0x0,-0x57(%rbp)
lea    -0xc0(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1060 <memset@plt>
movl   $0x0,-0xc4(%rbp)
movl   $0x0,-0xc8(%rbp)
movl   $0x0,-0xcc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1262 <gen_yuv420p_yuvgradient_bar+0xe2>
cmpl   $0x0,-0xc(%rbp)
jle    1262 <gen_yuv420p_yuvgradient_bar+0xe2>
cmpl   $0x0,-0x10(%rbp)
jg     128c <gen_yuv420p_yuvgradient_bar+0x10c>
lea    0xd97(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x280,-0x8(%rbp)
movl   $0x1e0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
je     12aa <gen_yuv420p_yuvgradient_bar+0x12a>
lea    0xdb9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
imul   -0xc(%rbp),%edi
call   1070 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%edi
imul   -0x1c(%rbp),%edi
call   1070 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%edi
imul   -0x1c(%rbp),%edi
call   1070 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0xe0(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    %eax,%ecx
mov    -0xe0(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x48(%rbp)
movzbl 0x10(%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,-0x4c(%rbp)
movzbl 0x18(%rbp),%eax
movzbl -0x12(%rbp),%ecx
sub    %ecx,%eax
cvtsi2ss %eax,%xmm0
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x50(%rbp)
movzbl 0x20(%rbp),%eax
movzbl -0x13(%rbp),%ecx
sub    %ecx,%eax
cvtsi2ss %eax,%xmm0
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x54(%rbp)
lea    -0xc0(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xd0a(%rip),%rsi
call   1090 <sprintf@plt>
lea    -0xc0(%rbp),%rdi
lea    0xd18(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    13d5 <gen_yuv420p_yuvgradient_bar+0x255>
lea    0xd02(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1733 <gen_yuv420p_yuvgradient_bar+0x5b3>
lea    0xd03(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xc4(%rbp)
mov    -0xc4(%rbp),%eax
mov    %eax,-0xe4(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x44(%rbp)
mov    %eax,%ecx
mov    -0xe4(%rbp),%eax
cmp    %ecx,%eax
jge    149b <gen_yuv420p_yuvgradient_bar+0x31b>
movzbl -0x11(%rbp),%eax
cvtsi2ssl -0xc4(%rbp),%xmm0
ff
movss  -0x4c(%rbp),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%ecx
add    %ecx,%eax
mov    %al,-0x55(%rbp)
movzbl -0x12(%rbp),%eax
cvtsi2ssl -0xc4(%rbp),%xmm0
ff
movss  -0x50(%rbp),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%ecx
add    %ecx,%eax
mov    %al,-0x56(%rbp)
movzbl -0x13(%rbp),%eax
cvtsi2ssl -0xc4(%rbp),%xmm0
ff
movss  -0x54(%rbp),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%ecx
movsbl %cl,%ecx
add    %ecx,%eax
mov    %al,-0x57(%rbp)
movzbl -0x55(%rbp),%esi
movzbl -0x56(%rbp),%edx
movzbl -0x57(%rbp),%ecx
lea    0xc8c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc4(%rbp)
jmp    13ed <gen_yuv420p_yuvgradient_bar+0x26d>
movl   $0x0,-0xcc(%rbp)
mov    -0xcc(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    154a <gen_yuv420p_yuvgradient_bar+0x3ca>
movl   $0x0,-0xc8(%rbp)
mov    -0xc8(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1531 <gen_yuv420p_yuvgradient_bar+0x3b1>
mov    -0xc8(%rbp),%eax
mov    -0x44(%rbp),%ecx
cltd
idiv   %ecx
mov    %eax,-0xc4(%rbp)
movzbl -0x11(%rbp),%eax
cvtsi2ssl -0xc4(%rbp),%xmm0
ff
movss  -0x4c(%rbp),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%ecx
movsbl %cl,%ecx
add    %ecx,%eax
mov    %al,-0x55(%rbp)
mov    -0x55(%rbp),%dl
mov    -0x28(%rbp),%rax
mov    -0xcc(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0xc8(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc8(%rbp)
jmp    14be <gen_yuv420p_yuvgradient_bar+0x33e>
jmp    1536 <gen_yuv420p_yuvgradient_bar+0x3b6>
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    14a5 <gen_yuv420p_yuvgradient_bar+0x325>
movl   $0x0,-0xcc(%rbp)
mov    -0xcc(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    15f9 <gen_yuv420p_yuvgradient_bar+0x479>
movl   $0x0,-0xc8(%rbp)
mov    -0xc8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    15e0 <gen_yuv420p_yuvgradient_bar+0x460>
mov    -0xc8(%rbp),%eax
mov    -0x48(%rbp),%ecx
cltd
idiv   %ecx
mov    %eax,-0xc4(%rbp)
movzbl -0x12(%rbp),%eax
cvtsi2ssl -0xc4(%rbp),%xmm0
ff
movss  -0x50(%rbp),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%ecx
movsbl %cl,%ecx
add    %ecx,%eax
mov    %al,-0x56(%rbp)
mov    -0x56(%rbp),%dl
mov    -0x30(%rbp),%rax
mov    -0xcc(%rbp),%ecx
imul   -0x18(%rbp),%ecx
add    -0xc8(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc8(%rbp)
jmp    156d <gen_yuv420p_yuvgradient_bar+0x3ed>
jmp    15e5 <gen_yuv420p_yuvgradient_bar+0x465>
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    1554 <gen_yuv420p_yuvgradient_bar+0x3d4>
movl   $0x0,-0xcc(%rbp)
mov    -0xcc(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    16a8 <gen_yuv420p_yuvgradient_bar+0x528>
movl   $0x0,-0xc8(%rbp)
mov    -0xc8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    168f <gen_yuv420p_yuvgradient_bar+0x50f>
mov    -0xc8(%rbp),%eax
mov    -0x48(%rbp),%ecx
cltd
idiv   %ecx
mov    %eax,-0xc4(%rbp)
movzbl -0x13(%rbp),%eax
cvtsi2ssl -0xc4(%rbp),%xmm0
ff
movss  -0x54(%rbp),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%ecx
movsbl %cl,%ecx
add    %ecx,%eax
mov    %al,-0x57(%rbp)
mov    -0x57(%rbp),%dl
mov    -0x38(%rbp),%rax
mov    -0xcc(%rbp),%ecx
imul   -0x18(%rbp),%ecx
add    -0xc8(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc8(%rbp)
jmp    161c <gen_yuv420p_yuvgradient_bar+0x49c>
jmp    1694 <gen_yuv420p_yuvgradient_bar+0x514>
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    1603 <gen_yuv420p_yuvgradient_bar+0x483>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%esi
imul   -0xc(%rbp),%esi
mov    -0x40(%rbp),%rcx
mov    $0x1,%edx
call   10a0 <fwrite@plt>
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%esi
imul   -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rcx
mov    $0x1,%edx
call   10a0 <fwrite@plt>
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%esi
imul   -0x1c(%rbp),%esi
mov    -0x40(%rbp),%rcx
mov    $0x1,%edx
call   10a0 <fwrite@plt>
mov    -0x40(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
lea    -0xc0(%rbp),%rsi
lea    0x9f6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_yuv420p_yuvgradient_bar>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    %r9d,0x18(%rsp)
mov    %r8d,%r15d
mov    %ecx,%r14d
mov    %edx,%r12d
xorps  %xmm0,%xmm0
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movl   $0x0,0xb0(%rsp)
test   %edi,%edi
jle    11e5 <gen_yuv420p_yuvgradient_bar+0x65>
mov    %esi,%ebp
test   %esi,%esi
jle    11e5 <gen_yuv420p_yuvgradient_bar+0x65>
mov    %edi,%ebx
test   %r12d,%r12d
jg     1207 <gen_yuv420p_yuvgradient_bar+0x87>
lea    0xee6(%rip),%rdi
call   1040 <puts@plt>
lea    0xf1d(%rip),%rdi
call   1040 <puts@plt>
mov    $0x280,%ebx
mov    $0x1e0,%ebp
mov    %ebx,%eax
cltd
mov    %r12d,0x10(%rsp)
idiv   %r12d
mov    %eax,%r13d
test   %edx,%edx
je     1225 <gen_yuv420p_yuvgradient_bar+0xa5>
lea    0xe70(%rip),%rdi
call   1040 <puts@plt>
mov    %ebx,%eax
shr    %eax
mov    %eax,0x8(%rsp)
mov    %ebp,%r12d
shr    %r12d
mov    %ebx,%edi
imul   %ebp,%edi
mov    %edi,0x38(%rsp)
call   1070 <malloc@plt>
mov    %rax,0x28(%rsp)
mov    %ebp,0xc(%rsp)
mov    0x8(%rsp),%ebp
mov    %r12d,0x1c(%rsp)
imul   %r12d,%ebp
mov    %ebp,%edi
call   1070 <malloc@plt>
mov    %rax,0x48(%rsp)
mov    %ebp,0x3c(%rsp)
mov    %ebp,%edi
call   1070 <malloc@plt>
mov    %rax,0x30(%rsp)
mov    %ebx,%eax
xor    %edx,%edx
divl   0x8(%rsp)
mov    %eax,%ecx
mov    %r13d,%eax
cltd
idiv   %ecx
mov    %eax,%r12d
lea    0xd73(%rip),%rsi
lea    0x50(%rsp),%rbp
mov    %rbp,%rdi
mov    %ebx,%edx
mov    0xc(%rsp),%ecx
call   1090 <sprintf@plt>
lea    0xd7a(%rip),%rsi
mov    %rbp,%rdi
call   1080 <fopen@plt>
test   %rax,%rax
je     1585 <gen_yuv420p_yuvgradient_bar+0x405>
mov    %rax,0x40(%rsp)
movzbl 0xf0(%rsp),%eax
movzbl %r14b,%ecx
sub    %ecx,%eax
cvtsi2ss %eax,%xmm1
mov    0x10(%rsp),%eax
add    $0xffffffff,%eax
cvtsi2ss %eax,%xmm0
divss  %xmm0,%xmm1
movss  %xmm1,0x10(%rsp)
movzbl 0xf8(%rsp),%eax
movzbl %r15b,%ecx
sub    %ecx,%eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,0x20(%rsp)
movzbl 0x100(%rsp),%eax
movzbl 0x18(%rsp),%ecx
sub    %ecx,%eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,0x24(%rsp)
lea    0xd3a(%rip),%rdi
call   1040 <puts@plt>
mov    %ebx,%eax
cltd
idiv   %r13d
test   %eax,%eax
mov    %ebx,0x14(%rsp)
mov    0x28(%rsp),%r11
jle    13bb <gen_yuv420p_yuvgradient_bar+0x23b>
mov    %eax,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
movss  0x10(%rsp),%xmm1
mulss  %xmm0,%xmm1
cvttss2si %xmm1,%eax
add    %r14b,%al
movss  0x20(%rsp),%xmm1
mulss  %xmm0,%xmm1
cvttss2si %xmm1,%ecx
add    %r15b,%cl
mulss  0x24(%rsp),%xmm0
cvttss2si %xmm0,%edi
add    0x18(%rsp),%dil
movzbl %al,%esi
movzbl %cl,%edx
movzbl %dil,%ecx
lea    0xca7(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1350 <gen_yuv420p_yuvgradient_bar+0x1d0>
cmpl   $0x0,0xc(%rsp)
mov    0x14(%rsp),%ebx
mov    0x28(%rsp),%r11
jle    1474 <gen_yuv420p_yuvgradient_bar+0x2f4>
movslq %ebx,%r10
mov    0xc(%rsp),%r9d
mov    %ebx,%r8d
mov    %r8d,%ebp
and    $0xfffffffe,%ebp
mov    %r11,%rdi
add    $0x1,%rdi
xor    %esi,%esi
movss  0x10(%rsp),%xmm1
jmp    13f0 <gen_yuv420p_yuvgradient_bar+0x270>
nopl   (%rax)
add    $0x1,%rsi
add    %r10,%rdi
cmp    %r9,%rsi
je     1474 <gen_yuv420p_yuvgradient_bar+0x2f4>
test   %ebx,%ebx
jle    13e0 <gen_yuv420p_yuvgradient_bar+0x260>
xor    %ecx,%ecx
cmp    $0x1,%ebx
je     1441 <gen_yuv420p_yuvgradient_bar+0x2c1>
nopl   0x0(%rax,%rax,1)
mov    %ecx,%eax
cltd
idiv   %r13d
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
add    %r14b,%al
mov    %al,-0x1(%rdi,%rcx,1)
lea    0x1(%rcx),%eax
cltd
idiv   %r13d
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
add    %r14b,%al
mov    %al,(%rdi,%rcx,1)
add    $0x2,%rcx
cmp    %rbp,%rcx
jne    1400 <gen_yuv420p_yuvgradient_bar+0x280>
test   $0x1,%r8b
je     13e0 <gen_yuv420p_yuvgradient_bar+0x260>
mov    %ecx,%eax
cltd
idiv   %r13d
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mov    %rsi,%rax
mulss  0x10(%rsp),%xmm0
cvttss2si %xmm0,%edx
imul   %r10,%rax
add    %r14b,%dl
add    %rcx,%rax
mov    %dl,(%r11,%rax,1)
jmp    13e0 <gen_yuv420p_yuvgradient_bar+0x260>
cmpl   $0x2,0xc(%rsp)
mov    0x18(%rsp),%r14d
mov    0x48(%rsp),%r13
movss  0x24(%rsp),%xmm1
jb     15a8 <gen_yuv420p_yuvgradient_bar+0x428>
mov    0x8(%rsp),%eax
cmp    $0x2,%eax
mov    $0x1,%r11d
mov    $0x1,%r10d
cmovae %eax,%r10d
mov    0x1c(%rsp),%eax
cmp    $0x2,%eax
cmovae %eax,%r11d
lea    -0x1(%r10),%r8
mov    %r10d,%esi
and    $0xfffffffe,%esi
mov    %r13,%r9
add    $0x1,%r9
xor    %edi,%edi
xor    %ebp,%ebp
movss  0x20(%rsp),%xmm2
jmp    14e1 <gen_yuv420p_yuvgradient_bar+0x361>
xchg   %ax,%ax
add    $0x1,%rbp
add    0x8(%rsp),%edi
cmp    %r11,%rbp
je     159d <gen_yuv420p_yuvgradient_bar+0x41d>
cmp    $0x2,%ebx
jb     14d0 <gen_yuv420p_yuvgradient_bar+0x350>
test   %r8,%r8
je     154d <gen_yuv420p_yuvgradient_bar+0x3cd>
mov    %edi,%ebx
add    %r9,%rbx
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ecx,%eax
cltd
idiv   %r12d
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  %xmm2,%xmm0
cvttss2si %xmm0,%eax
add    %r15b,%al
mov    %al,-0x1(%rbx,%rcx,1)
lea    0x1(%rcx),%eax
cltd
idiv   %r12d
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  %xmm2,%xmm0
cvttss2si %xmm0,%eax
add    %r15b,%al
mov    %al,(%rbx,%rcx,1)
add    $0x2,%rcx
cmp    %rsi,%rcx
jne    1500 <gen_yuv420p_yuvgradient_bar+0x380>
mov    0x14(%rsp),%ebx
test   $0x1,%r10b
je     14d0 <gen_yuv420p_yuvgradient_bar+0x350>
jmp    1559 <gen_yuv420p_yuvgradient_bar+0x3d9>
xor    %ecx,%ecx
test   $0x1,%r10b
je     14d0 <gen_yuv420p_yuvgradient_bar+0x350>
mov    %ecx,%eax
cltd
idiv   %r12d
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mov    0x8(%rsp),%eax
mulss  %xmm2,%xmm0
cvttss2si %xmm0,%edx
imul   %ebp,%eax
add    %r15b,%dl
add    %rcx,%rax
mov    %dl,0x0(%r13,%rax,1)
jmp    14d0 <gen_yuv420p_yuvgradient_bar+0x350>
lea    0xa99(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%ebx
jmp    1628 <gen_yuv420p_yuvgradient_bar+0x4a8>
cmpl   $0x2,0xc(%rsp)
jae    163c <gen_yuv420p_yuvgradient_bar+0x4bc>
mov    0x28(%rsp),%r14
mov    %r14,%rdi
mov    0x38(%rsp),%esi
mov    $0x1,%edx
mov    0x40(%rsp),%rbp
mov    %rbp,%rcx
call   10a0 <fwrite@plt>
mov    %r13,%rdi
mov    0x3c(%rsp),%ebx
mov    %ebx,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10a0 <fwrite@plt>
mov    0x30(%rsp),%r15
mov    %r15,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10a0 <fwrite@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
lea    0xa35(%rip),%rdi
xor    %ebx,%ebx
lea    0x50(%rsp),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebx,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x1c(%rsp),%eax
cmp    $0x2,%eax
mov    $0x1,%r11d
cmovae %eax,%r11d
mov    %r10d,%esi
and    $0xfffffffe,%esi
mov    0x30(%rsp),%r9
add    $0x1,%r9
xor    %edi,%edi
xor    %ebp,%ebp
jmp    1681 <gen_yuv420p_yuvgradient_bar+0x501>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbp
add    0x8(%rsp),%edi
cmp    %r11,%rbp
je     15a8 <gen_yuv420p_yuvgradient_bar+0x428>
cmp    $0x2,%ebx
jb     1670 <gen_yuv420p_yuvgradient_bar+0x4f0>
test   %r8,%r8
je     16ed <gen_yuv420p_yuvgradient_bar+0x56d>
mov    %edi,%ebx
add    %r9,%rbx
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ecx,%eax
cltd
idiv   %r12d
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
add    %r14b,%al
mov    %al,-0x1(%rbx,%rcx,1)
lea    0x1(%rcx),%eax
cltd
idiv   %r12d
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
add    %r14b,%al
mov    %al,(%rbx,%rcx,1)
add    $0x2,%rcx
cmp    %rsi,%rcx
jne    16a0 <gen_yuv420p_yuvgradient_bar+0x520>
mov    0x14(%rsp),%ebx
test   $0x1,%r10b
je     1670 <gen_yuv420p_yuvgradient_bar+0x4f0>
jmp    16f9 <gen_yuv420p_yuvgradient_bar+0x579>
xor    %ecx,%ecx
test   $0x1,%r10b
je     1670 <gen_yuv420p_yuvgradient_bar+0x4f0>
mov    %ecx,%eax
cltd
idiv   %r12d
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mov    0x8(%rsp),%eax
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%edx
imul   %ebp,%eax
add    %r14b,%dl
add    %rcx,%rax
mov    0x30(%rsp),%rcx
mov    %dl,(%rcx,%rax,1)
jmp    1670 <gen_yuv420p_yuvgradient_bar+0x4f0>

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 = [33 x i8] c"yuvgradientbar_%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, %3d, %3d\0A\00"
@.str.8 = [21 x i8] c"Finish generate %s!\0A\00"
define i32 @gen_yuv420p_yuvgradient_bar(i32 %0, i32 %1, i32 %2, i8 zeroext %3, i8 zeroext %4, i8 zeroext %5, i8 zeroext %6, i8 zeroext %7, i8 zeroext %8) {
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i8
%15 = alloca i8
%16 = alloca i8
%17 = alloca i8
%18 = alloca i8
%19 = alloca i8
%20 = alloca i32
%21 = alloca i32
%22 = alloca i8*
%23 = alloca i8*
%24 = alloca i8*
%25 = alloca i32*
%26 = alloca i32
%27 = alloca i32
%28 = alloca float
%29 = alloca float
%30 = alloca float
%31 = alloca i8
%32 = alloca i8
%33 = alloca i8
%34 = alloca [100 x i8]
%35 = alloca i32
%36 = alloca i32
%37 = alloca i32
store i32 %0, i32* %11
store i32 %1, i32* %12
store i32 %2, i32* %13
store i8 %3, i8* %14
store i8 %4, i8* %15
store i8 %5, i8* %16
store i8 %6, i8* %17
store i8 %7, i8* %18
store i8 %8, i8* %19
store i8* null, i8** %22
store i8* null, i8** %23
store i8* null, i8** %24
store i32* null, i32** %25
store float 0.000000e+00, float* %30
store i8 0, i8* %33
%38 = bitcast [100 x i8]* %34 to i8*
store i32 0, i32* %35
store i32 0, i32* %36
store i32 0, i32* %37
%39 = load i32, i32* %11
%40 = icmp sle i32 %39, 0
br i1 %40, label %47, label %41
41: ; preds = %9
%42 = load i32, i32* %12
%43 = icmp sle i32 %42, 0
br i1 %43, label %47, label %44
44: ; preds = %41
%45 = load i32, i32* %13
%46 = icmp sle i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %44, %41, %9
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0))
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
store i32 640, i32* %11
store i32 480, i32* %12
br label %50
50: ; preds = %47, %44
%51 = load i32, i32* %11
%52 = load i32, i32* %13
%53 = srem i32 %51, %52
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %50
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.2, i64 0, i64 0))
br label %57
57: ; preds = %55, %50
%58 = load i32, i32* %11
%59 = sdiv i32 %58, 2
store i32 %59, i32* %20
%60 = load i32, i32* %12
%61 = sdiv i32 %60, 2
store i32 %61, i32* %21
%62 = load i32, i32* %11
%63 = load i32, i32* %12
%64 = mul nsw i32 %62, %63
%65 = call i64 @malloc(i32 %64)
%66 = inttoptr i64 %65 to i8*
store i8* %66, i8** %22
%67 = load i32, i32* %20
%68 = load i32, i32* %21
%69 = mul nsw i32 %67, %68
%70 = call i64 @malloc(i32 %69)
%71 = inttoptr i64 %70 to i8*
store i8* %71, i8** %23
%72 = load i32, i32* %20
%73 = load i32, i32* %21
%74 = mul nsw i32 %72, %73
%75 = call i64 @malloc(i32 %74)
%76 = inttoptr i64 %75 to i8*
store i8* %76, i8** %24
%77 = load i32, i32* %11
%78 = load i32, i32* %13
%79 = sdiv i32 %77, %78
store i32 %79, i32* %26
%80 = load i32, i32* %26
%81 = load i32, i32* %11
%82 = load i32, i32* %20
%83 = sdiv i32 %81, %82
%84 = sdiv i32 %80, %83
store i32 %84, i32* %27
%85 = load i8, i8* %17
%86 = zext i8 %85 to i32
%87 = load i8, i8* %14
%88 = zext i8 %87 to i32
%89 = sub nsw i32 %86, %88
%90 = sitofp i32 %89 to float
%91 = load i32, i32* %13
%92 = sub nsw i32 %91, 1
%93 = sitofp i32 %92 to float
%94 = fdiv float %90, %93
store float %94, float* %28
%95 = load i8, i8* %18
%96 = zext i8 %95 to i32
%97 = load i8, i8* %15
%98 = zext i8 %97 to i32
%99 = sub nsw i32 %96, %98
%100 = sitofp i32 %99 to float
%101 = load i32, i32* %13
%102 = sub nsw i32 %101, 1
%103 = sitofp i32 %102 to float
%104 = fdiv float %100, %103
store float %104, float* %29
%105 = load i8, i8* %19
%106 = zext i8 %105 to i32
%107 = load i8, i8* %16
%108 = zext i8 %107 to i32
%109 = sub nsw i32 %106, %108
%110 = sitofp i32 %109 to float
%111 = load i32, i32* %13
%112 = sub nsw i32 %111, 1
%113 = sitofp i32 %112 to float
%114 = fdiv float %110, %113
store float %114, float* %30
%115 = getelementptr inbounds [100 x i8], [100 x i8]* %34, i64 0, i64 0
%116 = load i32, i32* %11
%117 = load i32, i32* %12
%118 = call i32 @sprintf(i8* %115, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %116, i32 %117)
%119 = getelementptr inbounds [100 x i8], [100 x i8]* %34, i64 0, i64 0
%120 = call i32* @fopen(i8* %119, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
store i32* %120, i32** %25
%121 = icmp eq i32* %120, null
br i1 %121, label %122, label %124
122: ; preds = %57
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %10
br label %322
124: ; preds = %57
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %35
br label %126
126: ; preds = %170, %124
%127 = load i32, i32* %35
%128 = load i32, i32* %11
%129 = load i32, i32* %26
%130 = sdiv i32 %128, %129
%131 = icmp slt i32 %127, %130
br i1 %131, label %132, label %173
132: ; preds = %126
%133 = load i8, i8* %14
%134 = zext i8 %133 to i32
%135 = load i32, i32* %35
%136 = sitofp i32 %135 to float
%137 = load float, float* %28
%138 = fmul float %136, %137
%139 = fptosi float %138 to i8
%140 = sext i8 %139 to i32
%141 = add nsw i32 %134, %140
%142 = trunc i32 %141 to i8
store i8 %142, i8* %31
%143 = load i8, i8* %15
%144 = zext i8 %143 to i32
%145 = load i32, i32* %35
%146 = sitofp i32 %145 to float
%147 = load float, float* %29
%148 = fmul float %146, %147
%149 = fptosi float %148 to i8
%150 = sext i8 %149 to i32
%151 = add nsw i32 %144, %150
%152 = trunc i32 %151 to i8
store i8 %152, i8* %32
%153 = load i8, i8* %16
%154 = zext i8 %153 to i32
%155 = load i32, i32* %35
%156 = sitofp i32 %155 to float
%157 = load float, float* %30
%158 = fmul float %156, %157
%159 = fptosi float %158 to i8
%160 = sext i8 %159 to i32
%161 = add nsw i32 %154, %160
%162 = trunc i32 %161 to i8
store i8 %162, i8* %33
%163 = load i8, i8* %31
%164 = zext i8 %163 to i32
%165 = load i8, i8* %32
%166 = zext i8 %165 to i32
%167 = load i8, i8* %33
%168 = zext i8 %167 to i32
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 %164, i32 %166, i32 %168)
br label %170
170: ; preds = %132
%171 = load i32, i32* %35
%172 = add nsw i32 %171, 1
store i32 %172, i32* %35
br label %126
173: ; preds = %126
store i32 0, i32* %37
br label %174
174: ; preds = %210, %173
%175 = load i32, i32* %37
%176 = load i32, i32* %12
%177 = icmp slt i32 %175, %176
br i1 %177, label %178, label %213
178: ; preds = %174
store i32 0, i32* %36
br label %179
179: ; preds = %206, %178
%180 = load i32, i32* %36
%181 = load i32, i32* %11
%182 = icmp slt i32 %180, %181
br i1 %182, label %183, label %209
183: ; preds = %179
%184 = load i32, i32* %36
%185 = load i32, i32* %26
%186 = sdiv i32 %184, %185
store i32 %186, i32* %35
%187 = load i8, i8* %14
%188 = zext i8 %187 to i32
%189 = load i32, i32* %35
%190 = sitofp i32 %189 to float
%191 = load float, float* %28
%192 = fmul float %190, %191
%193 = fptosi float %192 to i8
%194 = sext i8 %193 to i32
%195 = add nsw i32 %188, %194
%196 = trunc i32 %195 to i8
store i8 %196, i8* %31
%197 = load i8, i8* %31
%198 = load i8*, i8** %22
%199 = load i32, i32* %37
%200 = load i32, i32* %11
%201 = mul nsw i32 %199, %200
%202 = load i32, i32* %36
%203 = add nsw i32 %201, %202
%204 = sext i32 %203 to i64
%205 = getelementptr inbounds i8, i8* %198, i64 %204
store i8 %197, i8* %205
br label %206
206: ; preds = %183
%207 = load i32, i32* %36
%208 = add nsw i32 %207, 1
store i32 %208, i32* %36
br label %179
209: ; preds = %179
br label %210
210: ; preds = %209
%211 = load i32, i32* %37
%212 = add nsw i32 %211, 1
store i32 %212, i32* %37
br label %174
213: ; preds = %174
store i32 0, i32* %37
br label %214
214: ; preds = %250, %213
%215 = load i32, i32* %37
%216 = load i32, i32* %21
%217 = icmp slt i32 %215, %216
br i1 %217, label %218, label %253
218: ; preds = %214
store i32 0, i32* %36
br label %219
219: ; preds = %246, %218
%220 = load i32, i32* %36
%221 = load i32, i32* %20
%222 = icmp slt i32 %220, %221
br i1 %222, label %223, label %249
223: ; preds = %219
%224 = load i32, i32* %36
%225 = load i32, i32* %27
%226 = sdiv i32 %224, %225
store i32 %226, i32* %35
%227 = load i8, i8* %15
%228 = zext i8 %227 to i32
%229 = load i32, i32* %35
%230 = sitofp i32 %229 to float
%231 = load float, float* %29
%232 = fmul float %230, %231
%233 = fptosi float %232 to i8
%234 = sext i8 %233 to i32
%235 = add nsw i32 %228, %234
%236 = trunc i32 %235 to i8
store i8 %236, i8* %32
%237 = load i8, i8* %32
%238 = load i8*, i8** %23
%239 = load i32, i32* %37
%240 = load i32, i32* %20
%241 = mul nsw i32 %239, %240
%242 = load i32, i32* %36
%243 = add nsw i32 %241, %242
%244 = sext i32 %243 to i64
%245 = getelementptr inbounds i8, i8* %238, i64 %244
store i8 %237, i8* %245
br label %246
246: ; preds = %223
%247 = load i32, i32* %36
%248 = add nsw i32 %247, 1
store i32 %248, i32* %36
br label %219
249: ; preds = %219
br label %250
250: ; preds = %249
%251 = load i32, i32* %37
%252 = add nsw i32 %251, 1
store i32 %252, i32* %37
br label %214
253: ; preds = %214
store i32 0, i32* %37
br label %254
254: ; preds = %290, %253
%255 = load i32, i32* %37
%256 = load i32, i32* %21
%257 = icmp slt i32 %255, %256
br i1 %257, label %258, label %293
258: ; preds = %254
store i32 0, i32* %36
br label %259
259: ; preds = %286, %258
%260 = load i32, i32* %36
%261 = load i32, i32* %20
%262 = icmp slt i32 %260, %261
br i1 %262, label %263, label %289
263: ; preds = %259
%264 = load i32, i32* %36
%265 = load i32, i32* %27
%266 = sdiv i32 %264, %265
store i32 %266, i32* %35
%267 = load i8, i8* %16
%268 = zext i8 %267 to i32
%269 = load i32, i32* %35
%270 = sitofp i32 %269 to float
%271 = load float, float* %30
%272 = fmul float %270, %271
%273 = fptosi float %272 to i8
%274 = sext i8 %273 to i32
%275 = add nsw i32 %268, %274
%276 = trunc i32 %275 to i8
store i8 %276, i8* %33
%277 = load i8, i8* %33
%278 = load i8*, i8** %24
%279 = load i32, i32* %37
%280 = load i32, i32* %20
%281 = mul nsw i32 %279, %280
%282 = load i32, i32* %36
%283 = add nsw i32 %281, %282
%284 = sext i32 %283 to i64
%285 = getelementptr inbounds i8, i8* %278, i64 %284
store i8 %277, i8* %285
br label %286
286: ; preds = %263
%287 = load i32, i32* %36
%288 = add nsw i32 %287, 1
store i32 %288, i32* %36
br label %259
289: ; preds = %259
br label %290
290: ; preds = %289
%291 = load i32, i32* %37
%292 = add nsw i32 %291, 1
store i32 %292, i32* %37
br label %254
293: ; preds = %254
%294 = load i8*, i8** %22
%295 = load i32, i32* %11
%296 = load i32, i32* %12
%297 = mul nsw i32 %295, %296
%298 = load i32*, i32** %25
%299 = call i32 @fwrite(i8* %294, i32 %297, i32 1, i32* %298)
%300 = load i8*, i8** %23
%301 = load i32, i32* %20
%302 = load i32, i32* %21
%303 = mul nsw i32 %301, %302
%304 = load i32*, i32** %25
%305 = call i32 @fwrite(i8* %300, i32 %303, i32 1, i32* %304)
%306 = load i8*, i8** %24
%307 = load i32, i32* %20
%308 = load i32, i32* %21
%309 = mul nsw i32 %307, %308
%310 = load i32*, i32** %25
%311 = call i32 @fwrite(i8* %306, i32 %309, i32 1, i32* %310)
%312 = load i32*, i32** %25
%313 = call i32 @fclose(i32* %312)
%314 = load i8*, i8** %22
%315 = call i32 @free(i8* %314)
%316 = load i8*, i8** %23
%317 = call i32 @free(i8* %316)
%318 = load i8*, i8** %24
%319 = call i32 @free(i8* %318)
%320 = getelementptr inbounds [100 x i8], [100 x i8]* %34, i64 0, i64 0
%321 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* %320)
store i32 0, i32* %10
br label %322
322: ; preds = %293, %122
%323 = load i32, i32* %10
ret i32 %323
}

LLVM IR (-O2):
@.str.3 = [33 x i8] c"yuvgradientbar_%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, %3d, %3d\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_yuvgradient_bar(i32 %0, i32 %1, i32 %2, i8 zeroext %3, i8 zeroext %4, i8 zeroext %5, i8 zeroext %6, i8 zeroext %7, i8 zeroext %8) {
%10 = alloca [100 x i8]
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%12 = icmp slt i32 %0, 1
%13 = icmp slt i32 %1, 1
%14 = or i1 %12, %13
%15 = icmp slt i32 %2, 1
%16 = or i1 %14, %15
br i1 %16, label %17, label %20
17: ; preds = %9
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str.10, i64 0, i64 0))
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.11, i64 0, i64 0))
br label %20
20: ; preds = %9, %17
%21 = phi i32 [ 480, %17 ], [ %1, %9 ]
%22 = phi i32 [ 640, %17 ], [ %0, %9 ]
%23 = srem i32 %22, %2
%24 = sdiv i32 %22, %2
%25 = icmp eq i32 %23, 0
br i1 %25, label %28, label %26
26: ; preds = %20
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str.9, i64 0, i64 0))
br label %28
28: ; preds = %26, %20
%29 = lshr i32 %22, 1
%30 = lshr i32 %21, 1
%31 = mul nsw i32 %22, %21
%32 = tail call i64 @malloc(i32 %31)
%33 = inttoptr i64 %32 to i8*
%34 = mul nsw i32 %29, %30
%35 = tail call i64 @malloc(i32 %34)
%36 = inttoptr i64 %35 to i8*
%37 = tail call i64 @malloc(i32 %34)
%38 = inttoptr i64 %37 to i8*
%39 = udiv i32 %22, %29
%40 = sdiv i32 %24, %39
%41 = zext i8 %6 to i32
%42 = zext i8 %3 to i32
%43 = sub nsw i32 %41, %42
%44 = sitofp i32 %43 to float
%45 = add nsw i32 %2, -1
%46 = sitofp i32 %45 to float
%47 = fdiv float %44, %46
%48 = zext i8 %7 to i32
%49 = zext i8 %4 to i32
%50 = sub nsw i32 %48, %49
%51 = sitofp i32 %50 to float
%52 = fdiv float %51, %46
%53 = zext i8 %8 to i32
%54 = zext i8 %5 to i32
%55 = sub nsw i32 %53, %54
%56 = sitofp i32 %55 to float
%57 = fdiv float %56, %46
%58 = call i32 @sprintf(i8* %11, i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %22, i32 %21)
%59 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%60 = icmp eq i32* %59, null
br i1 %60, label %61, label %63
61: ; preds = %28
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %254
63: ; preds = %28
%64 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%65 = sdiv i32 %22, %24
%66 = icmp sgt i32 %65, 0
br i1 %66, label %78, label %69
67: ; preds = %78
%68 = icmp sgt i32 %21, 0
br i1 %68, label %69, label %100
69: ; preds = %63, %67
%70 = icmp sgt i32 %22, 0
%71 = sext i32 %22 to i64
%72 = zext i32 %21 to i64
%73 = zext i32 %22 to i64
%74 = and i64 %73, 1
%75 = icmp eq i32 %22, 1
%76 = and i64 %73, 4294967294
%77 = icmp eq i64 %74, 0
br label %96
78: ; preds = %63, %78
%79 = phi i32 [ %94, %78 ], [ 0, %63 ]
%80 = sitofp i32 %79 to float
%81 = fmul float %47, %80
%82 = fptosi float %81 to i8
%83 = add i8 %82, %3
%84 = fmul float %52, %80
%85 = fptosi float %84 to i8
%86 = add i8 %85, %4
%87 = fmul float %57, %80
%88 = fptosi float %87 to i8
%89 = add i8 %88, %5
%90 = zext i8 %83 to i32
%91 = zext i8 %86 to i32
%92 = zext i8 %89 to i32
%93 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i32 %90, i32 %91, i32 %92)
%94 = add nuw nsw i32 %79, 1
%95 = icmp eq i32 %94, %65
br i1 %95, label %67, label %78
96: ; preds = %69, %147
%97 = phi i64 [ 0, %69 ], [ %148, %147 ]
br i1 %70, label %98, label %147
98: ; preds = %96
%99 = mul nsw i64 %97, %71
br i1 %75, label %136, label %113
100: ; preds = %147, %67
%101 = icmp ult i32 %21, 2
br i1 %101, label %245, label %102
102: ; preds = %100
%103 = icmp ult i32 %22, 2
%104 = call i32 @llvm.umax.i32(i32 %29, i32 1)
%105 = call i32 @llvm.umax.i32(i32 %30, i32 1)
%106 = zext i32 %105 to i64
%107 = zext i32 %104 to i64
%108 = add nsw i64 %107, -1
%109 = and i64 %107, 1
%110 = icmp eq i64 %108, 0
%111 = and i64 %107, 2147483646
%112 = icmp eq i64 %109, 0
br label %150
113: ; preds = %98, %113
%114 = phi i64 [ %133, %113 ], [ 0, %98 ]
%115 = phi i64 [ %134, %113 ], [ 0, %98 ]
%116 = trunc i64 %114 to i32
%117 = sdiv i32 %116, %24
%118 = sitofp i32 %117 to float
%119 = fmul float %47, %118
%120 = fptosi float %119 to i8
%121 = add i8 %120, %3
%122 = add nsw i64 %114, %99
%123 = getelementptr inbounds i8, i8* %33, i64 %122
store i8 %121, i8* %123
%124 = or i64 %114, 1
%125 = trunc i64 %124 to i32
%126 = sdiv i32 %125, %24
%127 = sitofp i32 %126 to float
%128 = fmul float %47, %127
%129 = fptosi float %128 to i8
%130 = add i8 %129, %3
%131 = add nsw i64 %124, %99
%132 = getelementptr inbounds i8, i8* %33, i64 %131
store i8 %130, i8* %132
%133 = add nuw nsw i64 %114, 2
%134 = add i64 %115, 2
%135 = icmp eq i64 %134, %76
br i1 %135, label %136, label %113
136: ; preds = %113, %98
%137 = phi i64 [ 0, %98 ], [ %133, %113 ]
br i1 %77, label %147, label %138
138: ; preds = %136
%139 = trunc i64 %137 to i32
%140 = sdiv i32 %139, %24
%141 = sitofp i32 %140 to float
%142 = fmul float %47, %141
%143 = fptosi float %142 to i8
%144 = add i8 %143, %3
%145 = add nsw i64 %137, %99
%146 = getelementptr inbounds i8, i8* %33, i64 %145
store i8 %144, i8* %146
br label %147
147: ; preds = %138, %136, %96
%148 = add nuw nsw i64 %97, 1
%149 = icmp eq i64 %148, %72
br i1 %149, label %100, label %96
150: ; preds = %102, %199
%151 = phi i64 [ 0, %102 ], [ %200, %199 ]
br i1 %103, label %199, label %152
152: ; preds = %150
%153 = trunc i64 %151 to i32
%154 = mul nsw i32 %29, %153
%155 = zext i32 %154 to i64
br i1 %110, label %188, label %165
156: ; preds = %199
br i1 %101, label %245, label %157
157: ; preds = %156
%158 = icmp ult i32 %22, 2
%159 = call i32 @llvm.umax.i32(i32 %30, i32 1)
%160 = zext i32 %159 to i64
%161 = and i64 %107, 1
%162 = icmp eq i64 %108, 0
%163 = and i64 %107, 2147483646
%164 = icmp eq i64 %161, 0
br label %202
165: ; preds = %152, %165
%166 = phi i64 [ %185, %165 ], [ 0, %152 ]
%167 = phi i64 [ %186, %165 ], [ 0, %152 ]
%168 = trunc i64 %166 to i32
%169 = sdiv i32 %168, %40
%170 = sitofp i32 %169 to float
%171 = fmul float %52, %170
%172 = fptosi float %171 to i8
%173 = add i8 %172, %4
%174 = add nuw nsw i64 %166, %155
%175 = getelementptr inbounds i8, i8* %36, i64 %174
store i8 %173, i8* %175
%176 = or i64 %166, 1
%177 = trunc i64 %176 to i32
%178 = sdiv i32 %177, %40
%179 = sitofp i32 %178 to float
%180 = fmul float %52, %179
%181 = fptosi float %180 to i8
%182 = add i8 %181, %4
%183 = add nuw nsw i64 %176, %155
%184 = getelementptr inbounds i8, i8* %36, i64 %183
store i8 %182, i8* %184
%185 = add nuw nsw i64 %166, 2
%186 = add i64 %167, 2
%187 = icmp eq i64 %186, %111
br i1 %187, label %188, label %165
188: ; preds = %165, %152
%189 = phi i64 [ 0, %152 ], [ %185, %165 ]
br i1 %112, label %199, label %190
190: ; preds = %188
%191 = trunc i64 %189 to i32
%192 = sdiv i32 %191, %40
%193 = sitofp i32 %192 to float
%194 = fmul float %52, %193
%195 = fptosi float %194 to i8
%196 = add i8 %195, %4
%197 = add nuw nsw i64 %189, %155
%198 = getelementptr inbounds i8, i8* %36, i64 %197
store i8 %196, i8* %198
br label %199
199: ; preds = %190, %188, %150
%200 = add nuw nsw i64 %151, 1
%201 = icmp eq i64 %200, %106
br i1 %201, label %156, label %150
202: ; preds = %157, %242
%203 = phi i64 [ 0, %157 ], [ %243, %242 ]
br i1 %158, label %242, label %204
204: ; preds = %202
%205 = trunc i64 %203 to i32
%206 = mul nsw i32 %29, %205
%207 = zext i32 %206 to i64
br i1 %162, label %231, label %208
208: ; preds = %204, %208
%209 = phi i64 [ %228, %208 ], [ 0, %204 ]
%210 = phi i64 [ %229, %208 ], [ 0, %204 ]
%211 = trunc i64 %209 to i32
%212 = sdiv i32 %211, %40
%213 = sitofp i32 %212 to float
%214 = fmul float %57, %213
%215 = fptosi float %214 to i8
%216 = add i8 %215, %5
%217 = add nuw nsw i64 %209, %207
%218 = getelementptr inbounds i8, i8* %38, i64 %217
store i8 %216, i8* %218
%219 = or i64 %209, 1
%220 = trunc i64 %219 to i32
%221 = sdiv i32 %220, %40
%222 = sitofp i32 %221 to float
%223 = fmul float %57, %222
%224 = fptosi float %223 to i8
%225 = add i8 %224, %5
%226 = add nuw nsw i64 %219, %207
%227 = getelementptr inbounds i8, i8* %38, i64 %226
store i8 %225, i8* %227
%228 = add nuw nsw i64 %209, 2
%229 = add i64 %210, 2
%230 = icmp eq i64 %229, %163
br i1 %230, label %231, label %208
231: ; preds = %208, %204
%232 = phi i64 [ 0, %204 ], [ %228, %208 ]
br i1 %164, label %242, label %233
233: ; preds = %231
%234 = trunc i64 %232 to i32
%235 = sdiv i32 %234, %40
%236 = sitofp i32 %235 to float
%237 = fmul float %57, %236
%238 = fptosi float %237 to i8
%239 = add i8 %238, %5
%240 = add nuw nsw i64 %232, %207
%241 = getelementptr inbounds i8, i8* %38, i64 %240
store i8 %239, i8* %241
br label %242
242: ; preds = %233, %231, %202
%243 = add nuw nsw i64 %203, 1
%244 = icmp eq i64 %243, %160
br i1 %244, label %245, label %202
245: ; preds = %242, %100, %156
%246 = tail call i32 @fwrite(i8* %33, i32 %31, i32 1, i32* %59)
%247 = tail call i32 @fwrite(i8* %36, i32 %34, i32 1, i32* %59)
%248 = tail call i32 @fwrite(i8* %38, i32 %34, i32 1, i32* %59)
%249 = tail call i32 @fclose(i32* %59)
%250 = tail call i32 @free(i8* %33)
%251 = tail call i32 @free(i8* %36)
%252 = tail call i32 @free(i8* %38)
%253 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.8, i64 0, i64 0), i8* %11)
br label %254
254: ; preds = %245, %61
%255 = phi i32 [ -1, %61 ], [ 0, %245 ]
ret i32 %255
}