#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_rgb24_colorbar(int width, int height) {
  unsigned char *data = NULL;
  int barwidth;
  char filename[100] = {0};
  FILE *fp = NULL;
  int i = 0, j = 0;
  int lum;
  float r_coeff = 0.299, g_coeff = 0.587, b_coeff = 0.114;
  if (width <= 0 || height <= 0) {
    printf("Error: Width, Height cannot be 0 or negative number!\n");
    printf("Default Param is used.\n");
    width = 640;
    height = 480;
  }
  if (width % 8 != 0)
    printf(
        "Warning: Width cannot be divided by Bar Number without remainder!\n");
  data = (unsigned char *)malloc(width * height * 3);
  barwidth = width / 8;
  sprintf(filename, "colorbar_%dx%d_rgb24.rgb", width, height);
  if ((fp = fopen(filename, "wb+")) == NULL) {
    printf("Error: Cannot create file!");
    return -1;
  }
  printf("Luminance (Y) component value of colors from left to right:\n");
  lum = r_coeff * 255.0 + g_coeff * 255.0 + b_coeff * 255.0;
  printf("[White]  \tR,G,B=255,255,255\t Y=%.3f*R+%.3f*G+%.3f*B=%3d\n", r_coeff,
         g_coeff, b_coeff, lum);
  lum = r_coeff * 255.0 + g_coeff * 255.0 + b_coeff * 0.0;
  printf("[Yellow] \tR,G,B=255,255,  0\t Y=%.3f*R+%.3f*G+%.3f*B=%3d\n", r_coeff,
         g_coeff, b_coeff, lum);
  lum = r_coeff * 0.0 + g_coeff * 255.0 + b_coeff * 255.0;
  printf("[Cyan]   \tR,G,B=  0,255,255\t Y=%.3f*R+%.3f*G+%.3f*B=%3d\n", r_coeff,
         g_coeff, b_coeff, lum);
  lum = r_coeff * 0.0 + g_coeff * 255.0 + b_coeff * 0.0;
  printf("[Green]  \tR,G,B=  0,255,  0\t Y=%.3f*R+%.3f*G+%.3f*B=%3d\n", r_coeff,
         g_coeff, b_coeff, lum);
  lum = r_coeff * 255.0 + g_coeff * 0.0 + b_coeff * 255.0;
  printf("[Magenta]\tR,G,B=255,  0,255\t Y=%.3f*R+%.3f*G+%.3f*B=%3d\n", r_coeff,
         g_coeff, b_coeff, lum);
  lum = r_coeff * 255.0 + g_coeff * 0.0 + b_coeff * 0.0;
  printf("[Red]    \tR,G,B=255,  0,  0\t Y=%.3f*R+%.3f*G+%.3f*B=%3d\n", r_coeff,
         g_coeff, b_coeff, lum);
  lum = r_coeff * 0.0 + g_coeff * 0.0 + b_coeff * 255.0;
  printf("[Blue]   \tR,G,B=  0,  0,255\t Y=%.3f*R+%.3f*G+%.3f*B=%3d\n", r_coeff,
         g_coeff, b_coeff, lum);
  lum = r_coeff * 0.0 + g_coeff * 0.0 + b_coeff * 0.0;
  printf("[Black]  \tR,G,B=  0,  0,  0\t Y=%.3f*R+%.3f*G+%.3f*B=%3d\n", r_coeff,
         g_coeff, b_coeff, lum);
  for (j = 0; j < height; j++) {
    for (i = 0; i < width; i++) {
      int barnum = i / barwidth;
      switch (barnum) {
      case 0: {
        data[(j * width + i) * 3 + 0] = 255;
        data[(j * width + i) * 3 + 1] = 255;
        data[(j * width + i) * 3 + 2] = 255;
        break;
      }
      case 1: {
        data[(j * width + i) * 3 + 0] = 255;
        data[(j * width + i) * 3 + 1] = 255;
        data[(j * width + i) * 3 + 2] = 0;
        break;
      }
      case 2: {
        data[(j * width + i) * 3 + 0] = 0;
        data[(j * width + i) * 3 + 1] = 255;
        data[(j * width + i) * 3 + 2] = 255;
        break;
      }
      case 3: {
        data[(j * width + i) * 3 + 0] = 0;
        data[(j * width + i) * 3 + 1] = 255;
        data[(j * width + i) * 3 + 2] = 0;
        break;
      }
      case 4: {
        data[(j * width + i) * 3 + 0] = 255;
        data[(j * width + i) * 3 + 1] = 0;
        data[(j * width + i) * 3 + 2] = 255;
        break;
      }
      case 5: {
        data[(j * width + i) * 3 + 0] = 255;
        data[(j * width + i) * 3 + 1] = 0;
        data[(j * width + i) * 3 + 2] = 0;
        break;
      }
      case 6: {
        data[(j * width + i) * 3 + 0] = 0;
        data[(j * width + i) * 3 + 1] = 0;
        data[(j * width + i) * 3 + 2] = 255;
        break;
      }
      case 7: {
        data[(j * width + i) * 3 + 0] = 0;
        data[(j * width + i) * 3 + 1] = 0;
        data[(j * width + i) * 3 + 2] = 0;
        break;
      }
      }
    }
  }
  fwrite(data, width * height * 3, 1, fp);
  fclose(fp);
  free(data);
  printf("Finish generate %s!\n", filename);
  return 0;
}


x86 assembly (clang, -O0):
<gen_rgb24_colorbar>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1060 <memset@plt>
movq   $0x0,-0x88(%rbp)
movl   $0x0,-0x8c(%rbp)
movl   $0x0,-0x90(%rbp)
movss  0xe38(%rip),%xmm0
movss  %xmm0,-0x98(%rbp)
ff
movss  0xe24(%rip),%xmm0
movss  %xmm0,-0x9c(%rbp)
ff
movss  0xe10(%rip),%xmm0
movss  %xmm0,-0xa0(%rbp)
ff
cmpl   $0x0,-0x8(%rbp)
jle    120c <gen_rgb24_colorbar+0x8c>
cmpl   $0x0,-0xc(%rbp)
jg     1236 <gen_rgb24_colorbar+0xb6>
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x280,-0x8(%rbp)
movl   $0x1e0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1258 <gen_rgb24_colorbar+0xd8>
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
imul   $0x3,%eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe3f(%rip),%rsi
call   1090 <sprintf@plt>
lea    -0x80(%rbp),%rdi
lea    0xe48(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x88(%rbp)
cmp    $0x0,%rax
jne    12ca <gen_rgb24_colorbar+0x14a>
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1b58 <gen_rgb24_colorbar+0x9d8>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movss  -0x98(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm1
movss  -0x9c(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  0xd18(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  0xd0c(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movss  -0xa0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  0xcf0(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x94(%rbp)
movss  -0x98(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x9c(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0xa0(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
mov    -0x94(%rbp),%esi
lea    0xddb(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
movss  -0x98(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm1
movss  -0x9c(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  0xc86(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  0xc7a(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movss  -0xa0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
xorps  %xmm2,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x94(%rbp)
movss  -0x98(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x9c(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0xa0(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
mov    -0x94(%rbp),%esi
lea    0xd87(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
movss  -0x98(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm1
movss  -0x9c(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  0xbf9(%rip),%xmm2
mulsd  %xmm2,%xmm0
xorps  %xmm2,%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movss  -0xa0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  0xbd6(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x94(%rbp)
movss  -0x98(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x9c(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0xa0(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
mov    -0x94(%rbp),%esi
lea    0xd33(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
movss  -0x98(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm1
movss  -0x9c(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  0xb6c(%rip),%xmm2
mulsd  %xmm2,%xmm0
xorps  %xmm2,%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movss  -0xa0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
xorps  %xmm2,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x94(%rbp)
movss  -0x98(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x9c(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0xa0(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
mov    -0x94(%rbp),%esi
lea    0xce4(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
movss  -0x98(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm1
movss  -0x9c(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
xorps  %xmm2,%xmm2
mulsd  %xmm2,%xmm0
movsd  0xadd(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movss  -0xa0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  0xac1(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x94(%rbp)
movss  -0x98(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x9c(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0xa0(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
mov    -0x94(%rbp),%esi
lea    0xc90(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
movss  -0x98(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm1
movss  -0x9c(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
xorps  %xmm2,%xmm2
mulsd  %xmm2,%xmm0
movsd  0xa50(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movss  -0xa0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
xorps  %xmm2,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x94(%rbp)
movss  -0x98(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x9c(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0xa0(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
mov    -0x94(%rbp),%esi
lea    0xc41(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
movss  -0x98(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm1
movss  -0x9c(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
xorps  %xmm2,%xmm2
mulsd  %xmm2,%xmm0
xorps  %xmm2,%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movss  -0xa0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  0x9b1(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x94(%rbp)
movss  -0x98(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x9c(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0xa0(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
mov    -0x94(%rbp),%esi
lea    0xbf2(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
movss  -0x98(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm1
movss  -0x9c(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
xorps  %xmm2,%xmm2
mulsd  %xmm2,%xmm0
xorps  %xmm2,%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movss  -0xa0(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
xorps  %xmm2,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x94(%rbp)
movss  -0x98(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x9c(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0xa0(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
mov    -0x94(%rbp),%esi
lea    0xba8(%rip),%rdi
mov    $0x3,%al
call   1050 <printf@plt>
movl   $0x0,-0x90(%rbp)
mov    -0x90(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1b0b <gen_rgb24_colorbar+0x98b>
movl   $0x0,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1af2 <gen_rgb24_colorbar+0x972>
mov    -0x8c(%rbp),%eax
mov    -0x1c(%rbp),%ecx
cltd
idiv   %ecx
mov    %eax,-0xa4(%rbp)
mov    -0xa4(%rbp),%eax
mov    %rax,-0xb0(%rbp)
sub    $0x7,%rax
ja     1ad9 <gen_rgb24_colorbar+0x959>
mov    -0xb0(%rbp),%rax
lea    0x883(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movb   $0xff,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0xff,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movb   $0xff,(%rax,%rcx,1)
jmp    1ad9 <gen_rgb24_colorbar+0x959>
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movb   $0xff,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0xff,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1ad9 <gen_rgb24_colorbar+0x959>
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0xff,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movb   $0xff,(%rax,%rcx,1)
jmp    1ad9 <gen_rgb24_colorbar+0x959>
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0xff,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1ad9 <gen_rgb24_colorbar+0x959>
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movb   $0xff,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movb   $0xff,(%rax,%rcx,1)
jmp    1ad9 <gen_rgb24_colorbar+0x959>
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movb   $0xff,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1ad9 <gen_rgb24_colorbar+0x959>
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movb   $0xff,(%rax,%rcx,1)
jmp    1ad9 <gen_rgb24_colorbar+0x959>
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x90(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x8c(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1ade <gen_rgb24_colorbar+0x95e>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    174f <gen_rgb24_colorbar+0x5cf>
jmp    1af7 <gen_rgb24_colorbar+0x977>
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    1736 <gen_rgb24_colorbar+0x5b6>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
imul   $0x3,%eax,%esi
mov    -0x88(%rbp),%rcx
mov    $0x1,%edx
call   10a0 <fwrite@plt>
mov    -0x88(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
lea    -0x80(%rbp),%rsi
lea    0x7bc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_rgb24_colorbar>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x70(%rsp)
test   %edi,%edi
jle    11d4 <gen_rgb24_colorbar+0x54>
mov    %esi,%r13d
test   %esi,%esi
jle    11d4 <gen_rgb24_colorbar+0x54>
mov    %edi,%r15d
test   $0x7,%r15b
je     11f8 <gen_rgb24_colorbar+0x78>
lea    0x1097(%rip),%rdi
jmp    11f3 <gen_rgb24_colorbar+0x73>
lea    0x10d0(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1e0,%r13d
mov    $0x280,%r15d
lea    0x10ed(%rip),%rdi
call   1040 <puts@plt>
mov    %r15d,%eax
imul   %r13d,%eax
lea    (%rax,%rax,2),%ebp
mov    %ebp,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
lea    0xe05(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15d,%edx
mov    %r13d,%ecx
call   1090 <sprintf@plt>
lea    0xe04(%rip),%rsi
mov    %rbx,%rdi
call   1080 <fopen@plt>
test   %rax,%rax
je     147d <gen_rgb24_colorbar+0x2fd>
mov    %rax,%r12
mov    %ebp,0x4(%rsp)
mov    %r15d,%ebx
shr    $0x3,%ebx
lea    0xfdb(%rip),%rdi
call   1040 <puts@plt>
lea    0xdf2(%rip),%rdi
movsd  0xd9a(%rip),%xmm0
movsd  0xd9a(%rip),%xmm1
movsd  0xd9a(%rip),%xmm2
mov    $0xff,%esi
mov    $0x3,%al
call   1060 <printf@plt>
lea    0xe00(%rip),%rdi
movsd  0xd6f(%rip),%xmm0
movsd  0xd6f(%rip),%xmm1
movsd  0xd6f(%rip),%xmm2
mov    $0xe1,%esi
mov    $0x3,%al
call   1060 <printf@plt>
lea    0xe0e(%rip),%rdi
movsd  0xd44(%rip),%xmm0
movsd  0xd44(%rip),%xmm1
movsd  0xd44(%rip),%xmm2
mov    $0xb2,%esi
mov    $0x3,%al
call   1060 <printf@plt>
lea    0xe1c(%rip),%rdi
movsd  0xd19(%rip),%xmm0
movsd  0xd19(%rip),%xmm1
movsd  0xd19(%rip),%xmm2
mov    $0x95,%esi
mov    $0x3,%al
call   1060 <printf@plt>
lea    0xe2a(%rip),%rdi
movsd  0xcee(%rip),%xmm0
movsd  0xcee(%rip),%xmm1
movsd  0xcee(%rip),%xmm2
mov    $0x69,%esi
mov    $0x3,%al
call   1060 <printf@plt>
lea    0xe38(%rip),%rdi
movsd  0xcc3(%rip),%xmm0
movsd  0xcc3(%rip),%xmm1
movsd  0xcc3(%rip),%xmm2
mov    $0x4c,%esi
mov    $0x3,%al
call   1060 <printf@plt>
lea    0xe46(%rip),%rdi
movsd  0xc98(%rip),%xmm0
movsd  0xc98(%rip),%xmm1
movsd  0xc98(%rip),%xmm2
mov    $0x1d,%esi
mov    $0x3,%al
call   1060 <printf@plt>
lea    0xe54(%rip),%rdi
mov    %r14,%rbp
xor    %r14d,%r14d
movsd  0xc67(%rip),%xmm0
movsd  0xc67(%rip),%xmm1
movsd  0xc67(%rip),%xmm2
xor    %esi,%esi
mov    $0x3,%al
call   1060 <printf@plt>
mov    %r15d,%edi
mov    %r13d,%r8d
mov    %rbp,0x8(%rsp)
mov    %rbp,%r10
add    $0x2,%r10
lea    (%rdi,%rdi,2),%r9
movabs $0xffff0000ffff,%r11
movabs $0xff00ff00ff00ff,%r15
jmp    13ec <gen_rgb24_colorbar+0x26c>
xchg   %ax,%ax
add    $0x1,%r14
add    %r9,%r10
cmp    %r8,%r14
je     143d <gen_rgb24_colorbar+0x2bd>
mov    %r10,%rbp
xor    %esi,%esi
jmp    140d <gen_rgb24_colorbar+0x28d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rsi
add    $0x3,%rbp
cmp    %rsi,%rdi
je     13e0 <gen_rgb24_colorbar+0x260>
mov    %esi,%eax
xor    %edx,%edx
div    %ebx
cmp    $0x7,%eax
ja     1400 <gen_rgb24_colorbar+0x280>
mov    %eax,%ecx
shl    $0x3,%ecx
mov    %r11,%rax
shr    %cl,%rax
mov    $0xffffffff,%edx
shr    %cl,%rdx
mov    %r15,%r13
shr    %cl,%r13
mov    %al,-0x2(%rbp)
mov    %dl,-0x1(%rbp)
mov    %r13b,0x0(%rbp)
jmp    1400 <gen_rgb24_colorbar+0x280>
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    0x4(%rsp),%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   10a0 <fwrite@plt>
mov    %r12,%rdi
call   1050 <fclose@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xdab(%rip),%rdi
xor    %ebx,%ebx
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1490 <gen_rgb24_colorbar+0x310>
lea    0xbb1(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [54 x i8] c"Error: Width, Height 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 = [25 x i8] c"colorbar_%dx%d_rgb24.rgb\00"
@.str.4 = [4 x i8] c"wb+\00"
@.str.5 = [27 x i8] c"Error: Cannot create file!\00"
@.str.6 = [61 x i8] c"Luminance (Y) component value of colors from left to right:\0A\00"
@.str.7 = [57 x i8] c"[White] \09R,G,B=255,255,255\09 Y=%.3f*R+%.3f*G+%.3f*B=%3d\0A\00"
@.str.8 = [57 x i8] c"[Yellow] \09R,G,B=255,255, 0\09 Y=%.3f*R+%.3f*G+%.3f*B=%3d\0A\00"
@.str.9 = [57 x i8] c"[Cyan] \09R,G,B= 0,255,255\09 Y=%.3f*R+%.3f*G+%.3f*B=%3d\0A\00"
@.str.10 = [57 x i8] c"[Green] \09R,G,B= 0,255, 0\09 Y=%.3f*R+%.3f*G+%.3f*B=%3d\0A\00"
@.str.11 = [57 x i8] c"[Magenta]\09R,G,B=255, 0,255\09 Y=%.3f*R+%.3f*G+%.3f*B=%3d\0A\00"
@.str.12 = [57 x i8] c"[Red] \09R,G,B=255, 0, 0\09 Y=%.3f*R+%.3f*G+%.3f*B=%3d\0A\00"
@.str.13 = [57 x i8] c"[Blue] \09R,G,B= 0, 0,255\09 Y=%.3f*R+%.3f*G+%.3f*B=%3d\0A\00"
@.str.14 = [57 x i8] c"[Black] \09R,G,B= 0, 0, 0\09 Y=%.3f*R+%.3f*G+%.3f*B=%3d\0A\00"
@.str.15 = [21 x i8] c"Finish generate %s!\0A\00"
define i32 @gen_rgb24_colorbar(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca [100 x i8]
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* null, i8** %6
%17 = bitcast [100 x i8]* %8 to i8*
store i32* null, i32** %9
store i32 0, i32* %10
store i32 0, i32* %11
store float 0x3FD322D0E0000000, float* %13
store float 0x3FE2C8B440000000, float* %14
store float 0x3FBD2F1AA0000000, float* %15
%18 = load i32, i32* %4
%19 = icmp sle i32 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %2
%21 = load i32, i32* %5
%22 = icmp sle i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %20, %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
store i32 640, i32* %4
store i32 480, i32* %5
br label %26
26: ; preds = %23, %20
%27 = load i32, i32* %4
%28 = srem i32 %27, 8
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.2, i64 0, i64 0))
br label %32
32: ; preds = %30, %26
%33 = load i32, i32* %4
%34 = load i32, i32* %5
%35 = mul nsw i32 %33, %34
%36 = mul nsw i32 %35, 3
%37 = call i64 @malloc(i32 %36)
%38 = inttoptr i64 %37 to i8*
store i8* %38, i8** %6
%39 = load i32, i32* %4
%40 = sdiv i32 %39, 8
store i32 %40, i32* %7
%41 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%42 = load i32, i32* %4
%43 = load i32, i32* %5
%44 = call i32 @sprintf(i8* %41, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %42, i32 %43)
%45 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%46 = call i32* @fopen(i8* %45, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
store i32* %46, i32** %9
%47 = icmp eq i32* %46, null
br i1 %47, label %48, label %50
48: ; preds = %32
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %3
br label %480
50: ; preds = %32
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.6, i64 0, i64 0))
%52 = load float, float* %13
%53 = fpext float %52 to double
%54 = load float, float* %14
%55 = fpext float %54 to double
%56 = fmul double %55, 2.550000e+02
%57 = call double @llvm.fmuladd.f64(double %53, double 2.550000e+02, double %56)
%58 = load float, float* %15
%59 = fpext float %58 to double
%60 = call double @llvm.fmuladd.f64(double %59, double 2.550000e+02, double %57)
%61 = fptosi double %60 to i32
store i32 %61, i32* %12
%62 = load float, float* %13
%63 = fpext float %62 to double
%64 = load float, float* %14
%65 = fpext float %64 to double
%66 = load float, float* %15
%67 = fpext float %66 to double
%68 = load i32, i32* %12
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.7, i64 0, i64 0), double %63, double %65, double %67, i32 %68)
%70 = load float, float* %13
%71 = fpext float %70 to double
%72 = load float, float* %14
%73 = fpext float %72 to double
%74 = fmul double %73, 2.550000e+02
%75 = call double @llvm.fmuladd.f64(double %71, double 2.550000e+02, double %74)
%76 = load float, float* %15
%77 = fpext float %76 to double
%78 = call double @llvm.fmuladd.f64(double %77, double 0.000000e+00, double %75)
%79 = fptosi double %78 to i32
store i32 %79, i32* %12
%80 = load float, float* %13
%81 = fpext float %80 to double
%82 = load float, float* %14
%83 = fpext float %82 to double
%84 = load float, float* %15
%85 = fpext float %84 to double
%86 = load i32, i32* %12
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.8, i64 0, i64 0), double %81, double %83, double %85, i32 %86)
%88 = load float, float* %13
%89 = fpext float %88 to double
%90 = load float, float* %14
%91 = fpext float %90 to double
%92 = fmul double %91, 2.550000e+02
%93 = call double @llvm.fmuladd.f64(double %89, double 0.000000e+00, double %92)
%94 = load float, float* %15
%95 = fpext float %94 to double
%96 = call double @llvm.fmuladd.f64(double %95, double 2.550000e+02, double %93)
%97 = fptosi double %96 to i32
store i32 %97, i32* %12
%98 = load float, float* %13
%99 = fpext float %98 to double
%100 = load float, float* %14
%101 = fpext float %100 to double
%102 = load float, float* %15
%103 = fpext float %102 to double
%104 = load i32, i32* %12
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.9, i64 0, i64 0), double %99, double %101, double %103, i32 %104)
%106 = load float, float* %13
%107 = fpext float %106 to double
%108 = load float, float* %14
%109 = fpext float %108 to double
%110 = fmul double %109, 2.550000e+02
%111 = call double @llvm.fmuladd.f64(double %107, double 0.000000e+00, double %110)
%112 = load float, float* %15
%113 = fpext float %112 to double
%114 = call double @llvm.fmuladd.f64(double %113, double 0.000000e+00, double %111)
%115 = fptosi double %114 to i32
store i32 %115, i32* %12
%116 = load float, float* %13
%117 = fpext float %116 to double
%118 = load float, float* %14
%119 = fpext float %118 to double
%120 = load float, float* %15
%121 = fpext float %120 to double
%122 = load i32, i32* %12
%123 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.10, i64 0, i64 0), double %117, double %119, double %121, i32 %122)
%124 = load float, float* %13
%125 = fpext float %124 to double
%126 = load float, float* %14
%127 = fpext float %126 to double
%128 = fmul double %127, 0.000000e+00
%129 = call double @llvm.fmuladd.f64(double %125, double 2.550000e+02, double %128)
%130 = load float, float* %15
%131 = fpext float %130 to double
%132 = call double @llvm.fmuladd.f64(double %131, double 2.550000e+02, double %129)
%133 = fptosi double %132 to i32
store i32 %133, i32* %12
%134 = load float, float* %13
%135 = fpext float %134 to double
%136 = load float, float* %14
%137 = fpext float %136 to double
%138 = load float, float* %15
%139 = fpext float %138 to double
%140 = load i32, i32* %12
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.11, i64 0, i64 0), double %135, double %137, double %139, i32 %140)
%142 = load float, float* %13
%143 = fpext float %142 to double
%144 = load float, float* %14
%145 = fpext float %144 to double
%146 = fmul double %145, 0.000000e+00
%147 = call double @llvm.fmuladd.f64(double %143, double 2.550000e+02, double %146)
%148 = load float, float* %15
%149 = fpext float %148 to double
%150 = call double @llvm.fmuladd.f64(double %149, double 0.000000e+00, double %147)
%151 = fptosi double %150 to i32
store i32 %151, i32* %12
%152 = load float, float* %13
%153 = fpext float %152 to double
%154 = load float, float* %14
%155 = fpext float %154 to double
%156 = load float, float* %15
%157 = fpext float %156 to double
%158 = load i32, i32* %12
%159 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.12, i64 0, i64 0), double %153, double %155, double %157, i32 %158)
%160 = load float, float* %13
%161 = fpext float %160 to double
%162 = load float, float* %14
%163 = fpext float %162 to double
%164 = fmul double %163, 0.000000e+00
%165 = call double @llvm.fmuladd.f64(double %161, double 0.000000e+00, double %164)
%166 = load float, float* %15
%167 = fpext float %166 to double
%168 = call double @llvm.fmuladd.f64(double %167, double 2.550000e+02, double %165)
%169 = fptosi double %168 to i32
store i32 %169, i32* %12
%170 = load float, float* %13
%171 = fpext float %170 to double
%172 = load float, float* %14
%173 = fpext float %172 to double
%174 = load float, float* %15
%175 = fpext float %174 to double
%176 = load i32, i32* %12
%177 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.13, i64 0, i64 0), double %171, double %173, double %175, i32 %176)
%178 = load float, float* %13
%179 = fpext float %178 to double
%180 = load float, float* %14
%181 = fpext float %180 to double
%182 = fmul double %181, 0.000000e+00
%183 = call double @llvm.fmuladd.f64(double %179, double 0.000000e+00, double %182)
%184 = load float, float* %15
%185 = fpext float %184 to double
%186 = call double @llvm.fmuladd.f64(double %185, double 0.000000e+00, double %183)
%187 = fptosi double %186 to i32
store i32 %187, i32* %12
%188 = load float, float* %13
%189 = fpext float %188 to double
%190 = load float, float* %14
%191 = fpext float %190 to double
%192 = load float, float* %15
%193 = fpext float %192 to double
%194 = load i32, i32* %12
%195 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.14, i64 0, i64 0), double %189, double %191, double %193, i32 %194)
store i32 0, i32* %11
br label %196
196: ; preds = %463, %50
%197 = load i32, i32* %11
%198 = load i32, i32* %5
%199 = icmp slt i32 %197, %198
br i1 %199, label %200, label %466
200: ; preds = %196
store i32 0, i32* %10
br label %201
201: ; preds = %459, %200
%202 = load i32, i32* %10
%203 = load i32, i32* %4
%204 = icmp slt i32 %202, %203
br i1 %204, label %205, label %462
205: ; preds = %201
%206 = load i32, i32* %10
%207 = load i32, i32* %7
%208 = sdiv i32 %206, %207
store i32 %208, i32* %16
%209 = load i32, i32* %16
switch i32 %209, label %458 [
i32 0, label %210
i32 1, label %241
i32 2, label %272
i32 3, label %303
i32 4, label %334
i32 5, label %365
i32 6, label %396
i32 7, label %427
]
210: ; preds = %205
%211 = load i8*, i8** %6
%212 = load i32, i32* %11
%213 = load i32, i32* %4
%214 = mul nsw i32 %212, %213
%215 = load i32, i32* %10
%216 = add nsw i32 %214, %215
%217 = mul nsw i32 %216, 3
%218 = add nsw i32 %217, 0
%219 = sext i32 %218 to i64
%220 = getelementptr inbounds i8, i8* %211, i64 %219
store i8 -1, i8* %220
%221 = load i8*, i8** %6
%222 = load i32, i32* %11
%223 = load i32, i32* %4
%224 = mul nsw i32 %222, %223
%225 = load i32, i32* %10
%226 = add nsw i32 %224, %225
%227 = mul nsw i32 %226, 3
%228 = add nsw i32 %227, 1
%229 = sext i32 %228 to i64
%230 = getelementptr inbounds i8, i8* %221, i64 %229
store i8 -1, i8* %230
%231 = load i8*, i8** %6
%232 = load i32, i32* %11
%233 = load i32, i32* %4
%234 = mul nsw i32 %232, %233
%235 = load i32, i32* %10
%236 = add nsw i32 %234, %235
%237 = mul nsw i32 %236, 3
%238 = add nsw i32 %237, 2
%239 = sext i32 %238 to i64
%240 = getelementptr inbounds i8, i8* %231, i64 %239
store i8 -1, i8* %240
br label %458
241: ; preds = %205
%242 = load i8*, i8** %6
%243 = load i32, i32* %11
%244 = load i32, i32* %4
%245 = mul nsw i32 %243, %244
%246 = load i32, i32* %10
%247 = add nsw i32 %245, %246
%248 = mul nsw i32 %247, 3
%249 = add nsw i32 %248, 0
%250 = sext i32 %249 to i64
%251 = getelementptr inbounds i8, i8* %242, i64 %250
store i8 -1, i8* %251
%252 = load i8*, i8** %6
%253 = load i32, i32* %11
%254 = load i32, i32* %4
%255 = mul nsw i32 %253, %254
%256 = load i32, i32* %10
%257 = add nsw i32 %255, %256
%258 = mul nsw i32 %257, 3
%259 = add nsw i32 %258, 1
%260 = sext i32 %259 to i64
%261 = getelementptr inbounds i8, i8* %252, i64 %260
store i8 -1, i8* %261
%262 = load i8*, i8** %6
%263 = load i32, i32* %11
%264 = load i32, i32* %4
%265 = mul nsw i32 %263, %264
%266 = load i32, i32* %10
%267 = add nsw i32 %265, %266
%268 = mul nsw i32 %267, 3
%269 = add nsw i32 %268, 2
%270 = sext i32 %269 to i64
%271 = getelementptr inbounds i8, i8* %262, i64 %270
store i8 0, i8* %271
br label %458
272: ; preds = %205
%273 = load i8*, i8** %6
%274 = load i32, i32* %11
%275 = load i32, i32* %4
%276 = mul nsw i32 %274, %275
%277 = load i32, i32* %10
%278 = add nsw i32 %276, %277
%279 = mul nsw i32 %278, 3
%280 = add nsw i32 %279, 0
%281 = sext i32 %280 to i64
%282 = getelementptr inbounds i8, i8* %273, i64 %281
store i8 0, i8* %282
%283 = load i8*, i8** %6
%284 = load i32, i32* %11
%285 = load i32, i32* %4
%286 = mul nsw i32 %284, %285
%287 = load i32, i32* %10
%288 = add nsw i32 %286, %287
%289 = mul nsw i32 %288, 3
%290 = add nsw i32 %289, 1
%291 = sext i32 %290 to i64
%292 = getelementptr inbounds i8, i8* %283, i64 %291
store i8 -1, i8* %292
%293 = load i8*, i8** %6
%294 = load i32, i32* %11
%295 = load i32, i32* %4
%296 = mul nsw i32 %294, %295
%297 = load i32, i32* %10
%298 = add nsw i32 %296, %297
%299 = mul nsw i32 %298, 3
%300 = add nsw i32 %299, 2
%301 = sext i32 %300 to i64
%302 = getelementptr inbounds i8, i8* %293, i64 %301
store i8 -1, i8* %302
br label %458
303: ; preds = %205
%304 = load i8*, i8** %6
%305 = load i32, i32* %11
%306 = load i32, i32* %4
%307 = mul nsw i32 %305, %306
%308 = load i32, i32* %10
%309 = add nsw i32 %307, %308
%310 = mul nsw i32 %309, 3
%311 = add nsw i32 %310, 0
%312 = sext i32 %311 to i64
%313 = getelementptr inbounds i8, i8* %304, i64 %312
store i8 0, i8* %313
%314 = load i8*, i8** %6
%315 = load i32, i32* %11
%316 = load i32, i32* %4
%317 = mul nsw i32 %315, %316
%318 = load i32, i32* %10
%319 = add nsw i32 %317, %318
%320 = mul nsw i32 %319, 3
%321 = add nsw i32 %320, 1
%322 = sext i32 %321 to i64
%323 = getelementptr inbounds i8, i8* %314, i64 %322
store i8 -1, i8* %323
%324 = load i8*, i8** %6
%325 = load i32, i32* %11
%326 = load i32, i32* %4
%327 = mul nsw i32 %325, %326
%328 = load i32, i32* %10
%329 = add nsw i32 %327, %328
%330 = mul nsw i32 %329, 3
%331 = add nsw i32 %330, 2
%332 = sext i32 %331 to i64
%333 = getelementptr inbounds i8, i8* %324, i64 %332
store i8 0, i8* %333
br label %458
334: ; preds = %205
%335 = load i8*, i8** %6
%336 = load i32, i32* %11
%337 = load i32, i32* %4
%338 = mul nsw i32 %336, %337
%339 = load i32, i32* %10
%340 = add nsw i32 %338, %339
%341 = mul nsw i32 %340, 3
%342 = add nsw i32 %341, 0
%343 = sext i32 %342 to i64
%344 = getelementptr inbounds i8, i8* %335, i64 %343
store i8 -1, i8* %344
%345 = load i8*, i8** %6
%346 = load i32, i32* %11
%347 = load i32, i32* %4
%348 = mul nsw i32 %346, %347
%349 = load i32, i32* %10
%350 = add nsw i32 %348, %349
%351 = mul nsw i32 %350, 3
%352 = add nsw i32 %351, 1
%353 = sext i32 %352 to i64
%354 = getelementptr inbounds i8, i8* %345, i64 %353
store i8 0, i8* %354
%355 = load i8*, i8** %6
%356 = load i32, i32* %11
%357 = load i32, i32* %4
%358 = mul nsw i32 %356, %357
%359 = load i32, i32* %10
%360 = add nsw i32 %358, %359
%361 = mul nsw i32 %360, 3
%362 = add nsw i32 %361, 2
%363 = sext i32 %362 to i64
%364 = getelementptr inbounds i8, i8* %355, i64 %363
store i8 -1, i8* %364
br label %458
365: ; preds = %205
%366 = load i8*, i8** %6
%367 = load i32, i32* %11
%368 = load i32, i32* %4
%369 = mul nsw i32 %367, %368
%370 = load i32, i32* %10
%371 = add nsw i32 %369, %370
%372 = mul nsw i32 %371, 3
%373 = add nsw i32 %372, 0
%374 = sext i32 %373 to i64
%375 = getelementptr inbounds i8, i8* %366, i64 %374
store i8 -1, i8* %375
%376 = load i8*, i8** %6
%377 = load i32, i32* %11
%378 = load i32, i32* %4
%379 = mul nsw i32 %377, %378
%380 = load i32, i32* %10
%381 = add nsw i32 %379, %380
%382 = mul nsw i32 %381, 3
%383 = add nsw i32 %382, 1
%384 = sext i32 %383 to i64
%385 = getelementptr inbounds i8, i8* %376, i64 %384
store i8 0, i8* %385
%386 = load i8*, i8** %6
%387 = load i32, i32* %11
%388 = load i32, i32* %4
%389 = mul nsw i32 %387, %388
%390 = load i32, i32* %10
%391 = add nsw i32 %389, %390
%392 = mul nsw i32 %391, 3
%393 = add nsw i32 %392, 2
%394 = sext i32 %393 to i64
%395 = getelementptr inbounds i8, i8* %386, i64 %394
store i8 0, i8* %395
br label %458
396: ; preds = %205
%397 = load i8*, i8** %6
%398 = load i32, i32* %11
%399 = load i32, i32* %4
%400 = mul nsw i32 %398, %399
%401 = load i32, i32* %10
%402 = add nsw i32 %400, %401
%403 = mul nsw i32 %402, 3
%404 = add nsw i32 %403, 0
%405 = sext i32 %404 to i64
%406 = getelementptr inbounds i8, i8* %397, i64 %405
store i8 0, i8* %406
%407 = load i8*, i8** %6
%408 = load i32, i32* %11
%409 = load i32, i32* %4
%410 = mul nsw i32 %408, %409
%411 = load i32, i32* %10
%412 = add nsw i32 %410, %411
%413 = mul nsw i32 %412, 3
%414 = add nsw i32 %413, 1
%415 = sext i32 %414 to i64
%416 = getelementptr inbounds i8, i8* %407, i64 %415
store i8 0, i8* %416
%417 = load i8*, i8** %6
%418 = load i32, i32* %11
%419 = load i32, i32* %4
%420 = mul nsw i32 %418, %419
%421 = load i32, i32* %10
%422 = add nsw i32 %420, %421
%423 = mul nsw i32 %422, 3
%424 = add nsw i32 %423, 2
%425 = sext i32 %424 to i64
%426 = getelementptr inbounds i8, i8* %417, i64 %425
store i8 -1, i8* %426
br label %458
427: ; preds = %205
%428 = load i8*, i8** %6
%429 = load i32, i32* %11
%430 = load i32, i32* %4
%431 = mul nsw i32 %429, %430
%432 = load i32, i32* %10
%433 = add nsw i32 %431, %432
%434 = mul nsw i32 %433, 3
%435 = add nsw i32 %434, 0
%436 = sext i32 %435 to i64
%437 = getelementptr inbounds i8, i8* %428, i64 %436
store i8 0, i8* %437
%438 = load i8*, i8** %6
%439 = load i32, i32* %11
%440 = load i32, i32* %4
%441 = mul nsw i32 %439, %440
%442 = load i32, i32* %10
%443 = add nsw i32 %441, %442
%444 = mul nsw i32 %443, 3
%445 = add nsw i32 %444, 1
%446 = sext i32 %445 to i64
%447 = getelementptr inbounds i8, i8* %438, i64 %446
store i8 0, i8* %447
%448 = load i8*, i8** %6
%449 = load i32, i32* %11
%450 = load i32, i32* %4
%451 = mul nsw i32 %449, %450
%452 = load i32, i32* %10
%453 = add nsw i32 %451, %452
%454 = mul nsw i32 %453, 3
%455 = add nsw i32 %454, 2
%456 = sext i32 %455 to i64
%457 = getelementptr inbounds i8, i8* %448, i64 %456
store i8 0, i8* %457
br label %458
458: ; preds = %205, %427, %396, %365, %334, %303, %272, %241, %210
br label %459
459: ; preds = %458
%460 = load i32, i32* %10
%461 = add nsw i32 %460, 1
store i32 %461, i32* %10
br label %201
462: ; preds = %201
br label %463
463: ; preds = %462
%464 = load i32, i32* %11
%465 = add nsw i32 %464, 1
store i32 %465, i32* %11
br label %196
466: ; preds = %196
%467 = load i8*, i8** %6
%468 = load i32, i32* %4
%469 = load i32, i32* %5
%470 = mul nsw i32 %468, %469
%471 = mul nsw i32 %470, 3
%472 = load i32*, i32** %9
%473 = call i32 @fwrite(i8* %467, i32 %471, i32 1, i32* %472)
%474 = load i32*, i32** %9
%475 = call i32 @fclose(i32* %474)
%476 = load i8*, i8** %6
%477 = call i32 @free(i8* %476)
%478 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%479 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i8* %478)
store i32 0, i32* %3
br label %480
480: ; preds = %466, %48
%481 = load i32, i32* %3
ret i32 %481
}

LLVM IR (-O2):
@.str.3 = [25 x i8] c"colorbar_%dx%d_rgb24.rgb\00"
@.str.4 = [4 x i8] c"wb+\00"
@.str.5 = [27 x i8] c"Error: Cannot create file!\00"
@.str.7 = [57 x i8] c"[White] \09R,G,B=255,255,255\09 Y=%.3f*R+%.3f*G+%.3f*B=%3d\0A\00"
@.str.8 = [57 x i8] c"[Yellow] \09R,G,B=255,255, 0\09 Y=%.3f*R+%.3f*G+%.3f*B=%3d\0A\00"
@.str.9 = [57 x i8] c"[Cyan] \09R,G,B= 0,255,255\09 Y=%.3f*R+%.3f*G+%.3f*B=%3d\0A\00"
@.str.10 = [57 x i8] c"[Green] \09R,G,B= 0,255, 0\09 Y=%.3f*R+%.3f*G+%.3f*B=%3d\0A\00"
@.str.11 = [57 x i8] c"[Magenta]\09R,G,B=255, 0,255\09 Y=%.3f*R+%.3f*G+%.3f*B=%3d\0A\00"
@.str.12 = [57 x i8] c"[Red] \09R,G,B=255, 0, 0\09 Y=%.3f*R+%.3f*G+%.3f*B=%3d\0A\00"
@.str.13 = [57 x i8] c"[Blue] \09R,G,B= 0, 0,255\09 Y=%.3f*R+%.3f*G+%.3f*B=%3d\0A\00"
@.str.14 = [57 x i8] c"[Black] \09R,G,B= 0, 0, 0\09 Y=%.3f*R+%.3f*G+%.3f*B=%3d\0A\00"
@.str.15 = [21 x i8] c"Finish generate %s!\0A\00"
@str = [60 x i8] c"Luminance (Y) component value of colors from left to right:\00"
@str.16 = [66 x i8] c"Warning: Width cannot be divided by Bar Number without remainder!\00"
@str.17 = [53 x i8] c"Error: Width, Height cannot be 0 or negative number!\00"
@str.18 = [23 x i8] c"Default Param is used.\00"
define i32 @gen_rgb24_colorbar(i32 %0, i32 %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 1
%6 = icmp slt i32 %1, 1
%7 = or i1 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.17, i64 0, i64 0))
br label %13
10: ; preds = %2
%11 = and i32 %0, 7
%12 = icmp eq i32 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %10, %8
%14 = phi i8* [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.18, i64 0, i64 0), %8 ], [ getelementptr inbounds ([66 x i8], [66 x i8]* @str.16, i64 0, i64 0), %10 ]
%15 = phi i32 [ 640, %8 ], [ %0, %10 ]
%16 = phi i32 [ 480, %8 ], [ %1, %10 ]
%17 = tail call i32 @puts(i8* dereferenceable(1) %14)
br label %18
18: ; preds = %13, %10
%19 = phi i32 [ %0, %10 ], [ %15, %13 ]
%20 = phi i32 [ %1, %10 ], [ %16, %13 ]
%21 = mul i32 %19, 3
%22 = mul i32 %21, %20
%23 = tail call i64 @malloc(i32 %22)
%24 = inttoptr i64 %23 to i8*
%25 = lshr i32 %19, 3
%26 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %19, i32 %20)
%27 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %31
29: ; preds = %18
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %83
31: ; preds = %18
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str, i64 0, i64 0))
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.7, i64 0, i64 0), double 0x3FD322D0E0000000, double 0x3FE2C8B440000000, double 0x3FBD2F1AA0000000, i32 255)
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.8, i64 0, i64 0), double 0x3FD322D0E0000000, double 0x3FE2C8B440000000, double 0x3FBD2F1AA0000000, i32 225)
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.9, i64 0, i64 0), double 0x3FD322D0E0000000, double 0x3FE2C8B440000000, double 0x3FBD2F1AA0000000, i32 178)
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.10, i64 0, i64 0), double 0x3FD322D0E0000000, double 0x3FE2C8B440000000, double 0x3FBD2F1AA0000000, i32 149)
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.11, i64 0, i64 0), double 0x3FD322D0E0000000, double 0x3FE2C8B440000000, double 0x3FBD2F1AA0000000, i32 105)
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.12, i64 0, i64 0), double 0x3FD322D0E0000000, double 0x3FE2C8B440000000, double 0x3FBD2F1AA0000000, i32 76)
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.13, i64 0, i64 0), double 0x3FD322D0E0000000, double 0x3FE2C8B440000000, double 0x3FBD2F1AA0000000, i32 29)
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.14, i64 0, i64 0), double 0x3FD322D0E0000000, double 0x3FE2C8B440000000, double 0x3FBD2F1AA0000000, i32 0)
%41 = zext i32 %19 to i64
%42 = zext i32 %20 to i64
%43 = zext i32 %19 to i64
br label %44
44: ; preds = %31, %75
%45 = phi i64 [ 0, %31 ], [ %76, %75 ]
%46 = mul nsw i64 %45, %41
br label %47
47: ; preds = %44, %72
%48 = phi i64 [ 0, %44 ], [ %73, %72 ]
%49 = trunc i64 %48 to i32
%50 = udiv i32 %49, %25
%51 = icmp ult i32 %50, 8
br i1 %51, label %52, label %72
52: ; preds = %47
%53 = zext i32 %50 to i64
%54 = shl nuw nsw i64 %53, 3
%55 = lshr i64 281470681808895, %54
%56 = trunc i64 %55 to i8
%57 = zext i32 %50 to i64
%58 = shl nuw nsw i64 %57, 3
%59 = lshr i64 4294967295, %58
%60 = trunc i64 %59 to i8
%61 = zext i32 %50 to i64
%62 = shl nuw nsw i64 %61, 3
%63 = lshr i64 71777214294589695, %62
%64 = trunc i64 %63 to i8
%65 = add nuw nsw i64 %48, %46
%66 = mul nsw i64 %65, 3
%67 = getelementptr inbounds i8, i8* %24, i64 %66
store i8 %56, i8* %67
%68 = add nuw nsw i64 %66, 1
%69 = getelementptr inbounds i8, i8* %24, i64 %68
store i8 %60, i8* %69
%70 = add nuw nsw i64 %66, 2
%71 = getelementptr inbounds i8, i8* %24, i64 %70
store i8 %64, i8* %71
br label %72
72: ; preds = %47, %52
%73 = add nuw nsw i64 %48, 1
%74 = icmp eq i64 %73, %43
br i1 %74, label %75, label %47
75: ; preds = %72
%76 = add nuw nsw i64 %45, 1
%77 = icmp eq i64 %76, %42
br i1 %77, label %78, label %44
78: ; preds = %75
%79 = tail call i32 @fwrite(i8* %24, i32 %22, i32 1, i32* %27)
%80 = tail call i32 @fclose(i32* %27)
%81 = tail call i32 @free(i8* %24)
%82 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.15, i64 0, i64 0), i8* %4)
br label %83
83: ; preds = %78, %29
%84 = phi i32 [ -1, %29 ], [ 0, %78 ]
ret i32 %84
}