#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 size_t u_char;

/* Variables and functions */
int O_CREAT;
int /*<<< orphan*/ O_RDONLY;
int O_RDWR;
int O_TRUNC;
int STDERR_FILENO;
int STDIN_FILENO;
int STDOUT_FILENO;
scalar_t__ WEXITSTATUS(int);
scalar_t__ WIFEXITED(int);
int /*<<< orphan*/ analize(int, int, int, size_t *);
int /*<<< orphan*/ close(int);
int getopt(int, char *const *, char *);
int inic(int *, int *, int *, int *, int);
char *malloc(int);
int open(char *, int, ...);
int /*<<< orphan*/ perror(char *);
int read(int, size_t *, int);
int setpointer(int, char *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ wait(int *);
int /*<<< orphan*/ write(int, ...);
int main(int argc, char *const argv[]) {
  int red[2], green[2], blue[2], ret[2];
  int id, leido, opcion, channel = 0;
  int inputfd = STDIN_FILENO, outfd = STDOUT_FILENO;
  u_char buff[768] = {};
  char *inputfile = NULL;
  char *outputfile = NULL;
  char *header = NULL;
  extern char *optarg;
  extern int optind, opterr, optopt;
  while ((opcion = getopt(argc, argv, "hc:a:o:")) >= 0) {
    switch (opcion) {
    case 'h':
      write(STDOUT_FILENO,
            "Usage: hist [OPTION...]\n  -h, 			     show this "
            "help and exit\n  -a <ppm-file>,	     use ppm-file file\n  -c "
            "<rojo/verde/azul>,	     show only the result for selected "
            "colour\n  -o <file-name>,	     create a file named file-name and "
            "stores the results\n",
            249);
      return 0;
      break;
    case 'o':
      if ((outfd = open(optarg, O_CREAT | O_RDWR | O_TRUNC, 0640)) == -1) {
        perror("open");
        return -3;
      }
      outputfile = malloc(sizeof(char) * strlen(optarg));
      strcpy(outputfile, optarg);
      break;
    case 'a':
      if ((inputfd = open(optarg, O_RDONLY)) == -1) {
        perror("open");
        return -3;
      }
      inputfd = setpointer(inputfd, optarg);
      inputfile = malloc(sizeof(char) * strlen(optarg));
      strcpy(inputfile, optarg);
      break;
    case 'c':
      if (!strcmp("rojo", optarg))
        channel = 1;
      else if (!strcmp("verde", optarg))
        channel = 2;
      else if (!strcmp("azul", optarg))
        channel = 3;
      else {
        write(STDERR_FILENO, "Wrong argument\n", 15);
        return -3;
      }
      break;
    case '?':
      write(STDERR_FILENO, "Missing argument\n", 17);
      return -2;
      break;
    }
  }
  if (inputfd == STDIN_FILENO) {
    write(STDERR_FILENO, "No input file\n", 14);
    return -4;
  }
  header = malloc(sizeof(char) * 256);
  sprintf(header, "File read: %s\n", inputfile);
  if (outputfile != NULL)
    sprintf(header, "%sOutput file: %s\n", header, outputfile);
  if (channel == 0)
    sprintf(header, "%sChannels analized: all\n\n", header);
  if (channel == 1)
    sprintf(header, "%sChannel analized: red\n\n", header);
  if (channel == 2)
    sprintf(header, "%sChannel analized: green\n\n", header);
  if (channel == 3)
    sprintf(header, "%sChannel analized: blue\n\n", header);
  write(outfd, header, strlen(header));
  id = inic(red, green, blue, ret, channel);
  switch (id) {
  case 1:
    while ((leido = read(red[0], buff, 768)) > 0) {
      if (analize(1, ret[1], leido, buff) != 0)
        return -1;
    }
    return 0;
    break;
  case 2:
    while ((leido = read(green[0], buff, 768)) > 0) {
      if (analize(2, ret[1], leido, buff) != 0)
        return -1;
    }
    return 0;
    break;
  case 3:
    while ((leido = read(blue[0], buff, 768)) > 0) {
      if (analize(3, ret[1], leido, buff) != 0)
        return -1;
    }
    return 0;
    break;
  }
  u_char r[257];
  char outTxt[50];
  int pix[3][256], i, j, status;
  for (i = 0; i < 3; i++)
    for (j = 0; j < 256; j++)
      pix[i][j] = 0;
  while ((leido = read(inputfd, buff, 768)) > 0) {
    if (leido == -1) {
      perror("read");
      return -9;
    }
    if (channel == 1 || channel == 0)
      write(red[1], buff, leido);
    if (channel == 2 || channel == 0)
      write(green[1], buff, leido);
    if (channel == 3 || channel == 0)
      write(blue[1], buff, leido);
    for (j = 0; j < 3; j++) {
      if (channel != 0)
        j += 2;
      leido = read(ret[0], r, 257);
      for (i = 1; i < 257; i++) {
        pix[r[0]][i - 1] += (int)r[i];
      }
    }
  }
  if (channel == 1 || channel == 0)
    close(red[1]);
  if (channel == 2 || channel == 0)
    close(green[1]);
  if (channel == 3 || channel == 0)
    close(blue[1]);
  for (i = 0; i < 2; i++) {
    if (channel != 0)
      i += 2;
    wait(&status);
    if (WIFEXITED(status)) {
      if (WEXITSTATUS(status) != 0)
        write(STDERR_FILENO, "Child ended with error\n", 23);
    } else
      write(STDERR_FILENO, "Child ended signalized\n", 17);
  }
  switch (channel) {
  case 0:
    for (i = 0; i < 256; i++) {
      sprintf(outTxt, "red[%3d]=%d\t\tgreen[%3d]=%d\t\tblue[%3d]=%d\n", i,
              pix[0][i], i, pix[1][i], i, pix[2][i]);
      write(outfd, outTxt, strlen(outTxt));
    }
    break;
  case 1:
    for (i = 0; i < 256; i++) {
      sprintf(outTxt, "red[%3d]=%d\n", i, pix[0][i]);
      write(outfd, outTxt, strlen(outTxt));
    }
    break;
  case 2:
    for (i = 0; i < 256; i++) {
      sprintf(outTxt, "green[%3d]=%d\n", i, pix[1][i]);
      write(outfd, outTxt, strlen(outTxt));
    }
    break;
  case 3:
    for (i = 0; i < 256; i++) {
      sprintf(outTxt, "blue[%3d]=%d\n", i, pix[2][i]);
      write(outfd, outTxt, strlen(outTxt));
    }
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2d40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x40(%rbp)
mov    0x2d61(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    0x2d8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
lea    -0x1850(%rbp),%rdi
xor    %esi,%esi
mov    $0x1800,%edx
call   1060 <memset@plt>
movq   $0x0,-0x1858(%rbp)
movq   $0x0,-0x1860(%rbp)
movq   $0x0,-0x1868(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe3a(%rip),%rdx
call   10f0 <getopt@plt>
mov    %eax,-0x3c(%rbp)
cmp    $0x0,%eax
jl     150b <main+0x2eb>
mov    -0x3c(%rbp),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x2cc8(%rbp)
sub    $0x30,%eax
ja     1506 <main+0x2e6>
mov    -0x2cc8(%rbp),%rax
lea    0xd3f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2cff(%rip),%rax
mov    (%rax),%edi
lea    0xdf2(%rip),%rsi
mov    $0xf9,%edx
mov    $0x0,%al
call   1040 <write@plt>
movl   $0x0,-0x4(%rbp)
jmp    1dc2 <main+0xba2>
mov    0x2caf(%rip),%rax
mov    (%rax),%rdi
mov    0x2ce5(%rip),%rax
mov    (%rax),%esi
mov    0x2cb4(%rip),%rax
or     (%rax),%esi
mov    0x2ccb(%rip),%rax
or     (%rax),%esi
mov    $0x1a0,%edx
mov    $0x0,%al
call   10d0 <open@plt>
mov    %eax,-0x48(%rbp)
cmp    $0xffffffff,%eax
jne    1357 <main+0x137>
lea    0xe8f(%rip),%rdi
call   10e0 <perror@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    1dc2 <main+0xba2>
mov    0x2c5a(%rip),%rax
mov    (%rax),%rdi
call   1050 <strlen@plt>
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x1860(%rbp)
mov    -0x1860(%rbp),%rdi
mov    0x2c30(%rip),%rax
mov    (%rax),%rsi
call   1030 <strcpy@plt>
jmp    1506 <main+0x2e6>
mov    0x2c1c(%rip),%rax
mov    (%rax),%rdi
mov    0x2c22(%rip),%rax
mov    (%rax),%esi
mov    $0x0,%al
call   10d0 <open@plt>
mov    %eax,-0x44(%rbp)
cmp    $0xffffffff,%eax
jne    13d3 <main+0x1b3>
lea    0xe13(%rip),%rdi
call   10e0 <perror@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    1dc2 <main+0xba2>
mov    -0x44(%rbp),%edi
mov    0x2bdb(%rip),%rax
mov    (%rax),%rsi
call   1080 <setpointer@plt>
mov    %eax,-0x44(%rbp)
mov    0x2bc9(%rip),%rax
mov    (%rax),%rdi
call   1050 <strlen@plt>
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x1858(%rbp)
mov    -0x1858(%rbp),%rdi
mov    0x2b9f(%rip),%rax
mov    (%rax),%rsi
call   1030 <strcpy@plt>
jmp    1506 <main+0x2e6>
mov    0x2b8b(%rip),%rax
mov    (%rax),%rsi
lea    0xda3(%rip),%rdi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
jne    1451 <main+0x231>
movl   $0x1,-0x40(%rbp)
jmp    14d9 <main+0x2b9>
mov    0x2b60(%rip),%rax
mov    (%rax),%rsi
lea    0xd7d(%rip),%rdi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
jne    147c <main+0x25c>
movl   $0x2,-0x40(%rbp)
jmp    14d4 <main+0x2b4>
mov    0x2b35(%rip),%rax
mov    (%rax),%rsi
lea    0xd58(%rip),%rdi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
jne    14a7 <main+0x287>
movl   $0x3,-0x40(%rbp)
jmp    14cf <main+0x2af>
mov    0x2b02(%rip),%rax
mov    (%rax),%edi
lea    0xd33(%rip),%rsi
mov    $0xf,%edx
mov    $0x0,%al
call   1040 <write@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    1dc2 <main+0xba2>
jmp    14d4 <main+0x2b4>
jmp    14d9 <main+0x2b9>
jmp    1506 <main+0x2e6>
mov    0x2acb(%rip),%rax
mov    (%rax),%edi
lea    0xd0c(%rip),%rsi
mov    $0x11,%edx
mov    $0x0,%al
call   1040 <write@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    1dc2 <main+0xba2>
jmp    128c <main+0x6c>
mov    -0x44(%rbp),%eax
mov    0x2a93(%rip),%rcx
cmp    (%rcx),%eax
jne    1545 <main+0x325>
mov    0x2a8c(%rip),%rax
mov    (%rax),%edi
lea    0xcdf(%rip),%rsi
mov    $0xe,%edx
mov    $0x0,%al
call   1040 <write@plt>
movl   $0xfffffffc,-0x4(%rbp)
jmp    1dc2 <main+0xba2>
mov    $0x100,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x1868(%rbp)
mov    -0x1868(%rbp),%rdi
mov    -0x1858(%rbp),%rdx
lea    0xcb0(%rip),%rsi
mov    $0x0,%al
call   1110 <sprintf@plt>
cmpq   $0x0,-0x1860(%rbp)
je     15a3 <main+0x383>
mov    -0x1868(%rbp),%rdi
mov    -0x1868(%rbp),%rdx
mov    -0x1860(%rbp),%rcx
lea    0xc8e(%rip),%rsi
mov    $0x0,%al
call   1110 <sprintf@plt>
cmpl   $0x0,-0x40(%rbp)
jne    15c9 <main+0x3a9>
mov    -0x1868(%rbp),%rdi
mov    -0x1868(%rbp),%rdx
lea    0xc7b(%rip),%rsi
mov    $0x0,%al
call   1110 <sprintf@plt>
cmpl   $0x1,-0x40(%rbp)
jne    15ef <main+0x3cf>
mov    -0x1868(%rbp),%rdi
mov    -0x1868(%rbp),%rdx
lea    0xc70(%rip),%rsi
mov    $0x0,%al
call   1110 <sprintf@plt>
cmpl   $0x2,-0x40(%rbp)
jne    1615 <main+0x3f5>
mov    -0x1868(%rbp),%rdi
mov    -0x1868(%rbp),%rdx
lea    0xc64(%rip),%rsi
mov    $0x0,%al
call   1110 <sprintf@plt>
cmpl   $0x3,-0x40(%rbp)
jne    163b <main+0x41b>
mov    -0x1868(%rbp),%rdi
mov    -0x1868(%rbp),%rdx
lea    0xc5a(%rip),%rsi
mov    $0x0,%al
call   1110 <sprintf@plt>
mov    -0x48(%rbp),%eax
mov    %eax,-0x2cdc(%rbp)
mov    -0x1868(%rbp),%rdi
mov    %rdi,-0x2cd8(%rbp)
call   1050 <strlen@plt>
mov    -0x2cdc(%rbp),%edi
mov    -0x2cd8(%rbp),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <write@plt>
mov    -0x40(%rbp),%r8d
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x30(%rbp),%rcx
call   1140 <inic@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x2ccc(%rbp)
sub    $0x1,%eax
je     16c8 <main+0x4a8>
jmp    16a0 <main+0x480>
mov    -0x2ccc(%rbp),%eax
sub    $0x2,%eax
je     172a <main+0x50a>
jmp    16b4 <main+0x494>
mov    -0x2ccc(%rbp),%eax
sub    $0x3,%eax
je     178c <main+0x56c>
jmp    17ee <main+0x5ce>
jmp    16cd <main+0x4ad>
mov    -0x18(%rbp),%edi
lea    -0x1850(%rbp),%rsi
mov    $0x300,%edx
call   1090 <read@plt>
mov    %eax,-0x38(%rbp)
cmp    $0x0,%eax
jle    171e <main+0x4fe>
mov    -0x2c(%rbp),%esi
mov    -0x38(%rbp),%edx
lea    -0x1850(%rbp),%rcx
mov    $0x1,%edi
call   1120 <analize@plt>
cmp    $0x0,%eax
je     1719 <main+0x4f9>
movl   $0xffffffff,-0x4(%rbp)
jmp    1dc2 <main+0xba2>
jmp    16cd <main+0x4ad>
movl   $0x0,-0x4(%rbp)
jmp    1dc2 <main+0xba2>
jmp    172f <main+0x50f>
mov    -0x20(%rbp),%edi
lea    -0x1850(%rbp),%rsi
mov    $0x300,%edx
call   1090 <read@plt>
mov    %eax,-0x38(%rbp)
cmp    $0x0,%eax
jle    1780 <main+0x560>
mov    -0x2c(%rbp),%esi
mov    -0x38(%rbp),%edx
lea    -0x1850(%rbp),%rcx
mov    $0x2,%edi
call   1120 <analize@plt>
cmp    $0x0,%eax
je     177b <main+0x55b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1dc2 <main+0xba2>
jmp    172f <main+0x50f>
movl   $0x0,-0x4(%rbp)
jmp    1dc2 <main+0xba2>
jmp    1791 <main+0x571>
mov    -0x28(%rbp),%edi
lea    -0x1850(%rbp),%rsi
mov    $0x300,%edx
call   1090 <read@plt>
mov    %eax,-0x38(%rbp)
cmp    $0x0,%eax
jle    17e2 <main+0x5c2>
mov    -0x2c(%rbp),%esi
mov    -0x38(%rbp),%edx
lea    -0x1850(%rbp),%rcx
mov    $0x3,%edi
call   1120 <analize@plt>
cmp    $0x0,%eax
je     17dd <main+0x5bd>
movl   $0xffffffff,-0x4(%rbp)
jmp    1dc2 <main+0xba2>
jmp    1791 <main+0x571>
movl   $0x0,-0x4(%rbp)
jmp    1dc2 <main+0xba2>
movl   $0x0,-0x2cb4(%rbp)
cmpl   $0x3,-0x2cb4(%rbp)
jge    186f <main+0x64f>
movl   $0x0,-0x2cb8(%rbp)
cmpl   $0x100,-0x2cb8(%rbp)
jge    1856 <main+0x636>
movslq -0x2cb4(%rbp),%rcx
lea    -0x2cb0(%rbp),%rax
shl    $0xa,%rcx
add    %rcx,%rax
movslq -0x2cb8(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x2cb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2cb8(%rbp)
jmp    180f <main+0x5ef>
jmp    185b <main+0x63b>
mov    -0x2cb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2cb4(%rbp)
jmp    17f8 <main+0x5d8>
jmp    1874 <main+0x654>
mov    -0x44(%rbp),%edi
lea    -0x1850(%rbp),%rsi
mov    $0x300,%edx
call   1090 <read@plt>
mov    %eax,-0x38(%rbp)
cmp    $0x0,%eax
jle    19f9 <main+0x7d9>
cmpl   $0xffffffff,-0x38(%rbp)
jne    18b6 <main+0x696>
lea    0xa04(%rip),%rdi
call   10e0 <perror@plt>
movl   $0xfffffff7,-0x4(%rbp)
jmp    1dc2 <main+0xba2>
cmpl   $0x1,-0x40(%rbp)
je     18ca <main+0x6aa>
cmpl   $0x0,-0x40(%rbp)
jne    18de <main+0x6be>
mov    -0x14(%rbp),%edi
lea    -0x1850(%rbp),%rsi
mov    -0x38(%rbp),%edx
mov    $0x0,%al
call   1040 <write@plt>
cmpl   $0x2,-0x40(%rbp)
je     18f2 <main+0x6d2>
cmpl   $0x0,-0x40(%rbp)
jne    1906 <main+0x6e6>
mov    -0x1c(%rbp),%edi
lea    -0x1850(%rbp),%rsi
mov    -0x38(%rbp),%edx
mov    $0x0,%al
call   1040 <write@plt>
cmpl   $0x3,-0x40(%rbp)
je     191a <main+0x6fa>
cmpl   $0x0,-0x40(%rbp)
jne    192e <main+0x70e>
mov    -0x24(%rbp),%edi
lea    -0x1850(%rbp),%rsi
mov    -0x38(%rbp),%edx
mov    $0x0,%al
call   1040 <write@plt>
movl   $0x0,-0x2cb8(%rbp)
cmpl   $0x3,-0x2cb8(%rbp)
jge    19f4 <main+0x7d4>
cmpl   $0x0,-0x40(%rbp)
je     195e <main+0x73e>
mov    -0x2cb8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x2cb8(%rbp)
mov    -0x30(%rbp),%edi
lea    -0x2070(%rbp),%rsi
mov    $0x101,%edx
call   1090 <read@plt>
mov    %eax,-0x38(%rbp)
movl   $0x1,-0x2cb4(%rbp)
cmpl   $0x101,-0x2cb4(%rbp)
jge    19db <main+0x7bb>
movslq -0x2cb4(%rbp),%rax
mov    -0x2070(%rbp,%rax,8),%rax
ff
mov    %eax,%edx
mov    -0x2070(%rbp),%rcx
lea    -0x2cb0(%rbp),%rax
shl    $0xa,%rcx
add    %rcx,%rax
mov    -0x2cb4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
add    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x2cb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2cb4(%rbp)
jmp    197f <main+0x75f>
jmp    19e0 <main+0x7c0>
mov    -0x2cb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2cb8(%rbp)
jmp    1938 <main+0x718>
jmp    1874 <main+0x654>
cmpl   $0x1,-0x40(%rbp)
je     1a0d <main+0x7ed>
cmpl   $0x0,-0x40(%rbp)
jne    1a15 <main+0x7f5>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
cmpl   $0x2,-0x40(%rbp)
je     1a29 <main+0x809>
cmpl   $0x0,-0x40(%rbp)
jne    1a31 <main+0x811>
mov    -0x1c(%rbp),%edi
call   1070 <close@plt>
cmpl   $0x3,-0x40(%rbp)
je     1a45 <main+0x825>
cmpl   $0x0,-0x40(%rbp)
jne    1a4d <main+0x82d>
mov    -0x24(%rbp),%edi
call   1070 <close@plt>
movl   $0x0,-0x2cb4(%rbp)
cmpl   $0x2,-0x2cb4(%rbp)
jge    1b09 <main+0x8e9>
cmpl   $0x0,-0x40(%rbp)
je     1a7d <main+0x85d>
mov    -0x2cb4(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x2cb4(%rbp)
lea    -0x2cbc(%rbp),%rdi
call   1130 <wait@plt>
mov    -0x2cbc(%rbp),%edi
call   1100 <WIFEXITED@plt>
cmp    $0x0,%rax
je     1ad4 <main+0x8b4>
mov    -0x2cbc(%rbp),%edi
call   10c0 <WEXITSTATUS@plt>
cmp    $0x0,%rax
je     1acf <main+0x8af>
mov    0x24f6(%rip),%rax
mov    (%rax),%edi
lea    0x7eb(%rip),%rsi
mov    $0x17,%edx
mov    $0x0,%al
call   1040 <write@plt>
jmp    1af0 <main+0x8d0>
mov    0x24d5(%rip),%rax
mov    (%rax),%edi
lea    0x7e2(%rip),%rsi
mov    $0x11,%edx
mov    $0x0,%al
call   1040 <write@plt>
jmp    1af5 <main+0x8d5>
mov    -0x2cb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2cb4(%rbp)
jmp    1a57 <main+0x837>
mov    -0x40(%rbp),%eax
mov    %rax,-0x2ce8(%rbp)
sub    $0x3,%rax
ja     1dbb <main+0xb9b>
mov    -0x2ce8(%rbp),%rax
lea    0x4d5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x2cb4(%rbp)
cmpl   $0x100,-0x2cb4(%rbp)
jge    1bf7 <main+0x9d7>
lea    -0x20b0(%rbp),%rdi
mov    -0x2cb4(%rbp),%edx
movslq -0x2cb4(%rbp),%rax
mov    -0x2cb0(%rbp,%rax,4),%ecx
mov    -0x2cb4(%rbp),%r8d
movslq -0x2cb4(%rbp),%rax
mov    -0x28b0(%rbp,%rax,4),%r9d
ff
mov    -0x2cb4(%rbp),%r10d
movslq -0x2cb4(%rbp),%rax
mov    -0x24b0(%rbp,%rax,4),%eax
lea    0x743(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1110 <sprintf@plt>
mov    -0x48(%rbp),%eax
mov    %eax,-0x2cf4(%rbp)
lea    -0x20b0(%rbp),%rax
mov    %rax,-0x2cf0(%rbp)
lea    -0x20b0(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x2cf4(%rbp),%edi
mov    -0x2cf0(%rbp),%rsi
mov    %eax,%edx
mov    $0x0,%al
call   1040 <write@plt>
mov    -0x2cb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2cb4(%rbp)
jmp    1b3e <main+0x91e>
jmp    1dbb <main+0xb9b>
movl   $0x0,-0x2cb4(%rbp)
cmpl   $0x100,-0x2cb4(%rbp)
jge    1c8c <main+0xa6c>
lea    -0x20b0(%rbp),%rdi
mov    -0x2cb4(%rbp),%edx
movslq -0x2cb4(%rbp),%rax
mov    -0x2cb0(%rbp,%rax,4),%ecx
lea    0x6d0(%rip),%rsi
mov    $0x0,%al
call   1110 <sprintf@plt>
mov    -0x48(%rbp),%eax
mov    %eax,-0x2d04(%rbp)
lea    -0x20b0(%rbp),%rax
mov    %rax,-0x2d00(%rbp)
lea    -0x20b0(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x2d04(%rbp),%edi
mov    -0x2d00(%rbp),%rsi
mov    %eax,%edx
mov    $0x0,%al
call   1040 <write@plt>
mov    -0x2cb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2cb4(%rbp)
jmp    1c06 <main+0x9e6>
jmp    1dbb <main+0xb9b>
movl   $0x0,-0x2cb4(%rbp)
cmpl   $0x100,-0x2cb4(%rbp)
jge    1d21 <main+0xb01>
lea    -0x20b0(%rbp),%rdi
mov    -0x2cb4(%rbp),%edx
movslq -0x2cb4(%rbp),%rax
mov    -0x28b0(%rbp,%rax,4),%ecx
lea    0x648(%rip),%rsi
mov    $0x0,%al
call   1110 <sprintf@plt>
mov    -0x48(%rbp),%eax
mov    %eax,-0x2d14(%rbp)
lea    -0x20b0(%rbp),%rax
mov    %rax,-0x2d10(%rbp)
lea    -0x20b0(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x2d14(%rbp),%edi
mov    -0x2d10(%rbp),%rsi
mov    %eax,%edx
mov    $0x0,%al
call   1040 <write@plt>
mov    -0x2cb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2cb4(%rbp)
jmp    1c9b <main+0xa7b>
jmp    1dbb <main+0xb9b>
movl   $0x0,-0x2cb4(%rbp)
cmpl   $0x100,-0x2cb4(%rbp)
jge    1db6 <main+0xb96>
lea    -0x20b0(%rbp),%rdi
mov    -0x2cb4(%rbp),%edx
movslq -0x2cb4(%rbp),%rax
mov    -0x24b0(%rbp,%rax,4),%ecx
lea    0x598(%rip),%rsi
mov    $0x0,%al
call   1110 <sprintf@plt>
mov    -0x48(%rbp),%eax
mov    %eax,-0x2d24(%rbp)
lea    -0x20b0(%rbp),%rax
mov    %rax,-0x2d20(%rbp)
lea    -0x20b0(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x2d24(%rbp),%edi
mov    -0x2d20(%rbp),%rsi
mov    %eax,%edx
mov    $0x0,%al
call   1040 <write@plt>
mov    -0x2cb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2cb4(%rbp)
jmp    1d30 <main+0xb10>
jmp    1dbb <main+0xb9b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2d40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2ca8,%rsp
mov    %rsi,%r12
mov    %edi,%r15d
mov    0x2d6a(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x2d95(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
lea    0x14a0(%rsp),%rdi
xor    %r13d,%r13d
mov    $0x1800,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0xe75(%rip),%rdx
mov    %r15d,%edi
mov    %r12,%rsi
call   10f0 <getopt@plt>
test   %eax,%eax
js     13fe <main+0x1de>
lea    0xe5b(%rip),%r14
lea    0xd70(%rip),%rbp
mov    0x2d21(%rip),%rbx
xor    %ecx,%ecx
mov    %rcx,0x30(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x28(%rsp)
xor    %r13d,%r13d
mov    %r12,0x20(%rsp)
jmp    12d1 <main+0xb1>
nop
mov    (%rbx),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %r15d,%edi
mov    %r12,%rsi
mov    %r14,%rdx
call   10f0 <getopt@plt>
test   %eax,%eax
js     140c <main+0x1ec>
add    $0xffffffc1,%eax
cmp    $0x30,%eax
ja     12bb <main+0x9b>
movslq 0x0(%rbp,%rax,4),%rax
add    %rbp,%rax
jmp    *%rax
mov    (%rbx),%rdi
mov    0x2cdb(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
call   10d0 <open@plt>
cmp    $0xffffffff,%eax
je     1a30 <main+0x810>
mov    (%rbx),%rsi
mov    %eax,%edi
call   1080 <setpointer@plt>
mov    %eax,0xc(%rsp)
mov    (%rbx),%rdi
call   1050 <strlen@plt>
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,%rcx
mov    %rax,0x28(%rsp)
jmp    12b0 <main+0x90>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%r12
mov    (%rbx),%rbx
lea    0xead(%rip),%rdi
mov    %rbx,%rsi
call   10a0 <strcmp@plt>
test   %eax,%eax
je     13e3 <main+0x1c3>
lea    0xe9b(%rip),%rdi
mov    %rbx,%rsi
call   10a0 <strcmp@plt>
test   %eax,%eax
je     13eb <main+0x1cb>
lea    0xe8a(%rip),%rdi
mov    %rbx,%rsi
call   10a0 <strcmp@plt>
mov    $0x3,%r13d
test   %eax,%eax
mov    %r12,%rbx
mov    0x20(%rsp),%r12
je     12bb <main+0x9b>
jmp    1907 <main+0x6e7>
xchg   %ax,%ax
mov    (%rbx),%rdi
mov    0x2c36(%rip),%rax
mov    (%rax),%esi
mov    0x2c55(%rip),%rax
or     (%rax),%esi
mov    0x2c44(%rip),%rax
or     (%rax),%esi
mov    $0x1a0,%edx
xor    %eax,%eax
call   10d0 <open@plt>
mov    %eax,0x10(%rsp)
cmp    $0xffffffff,%eax
je     1a30 <main+0x810>
mov    (%rbx),%rdi
call   1050 <strlen@plt>
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,%rcx
mov    %rax,0x30(%rsp)
jmp    12b0 <main+0x90>
mov    $0x1,%r13d
jmp    13f1 <main+0x1d1>
mov    $0x2,%r13d
mov    %r12,%rbx
mov    0x20(%rsp),%r12
jmp    12bb <main+0x9b>
xor    %eax,%eax
mov    %rax,0x28(%rsp)
xor    %eax,%eax
mov    %rax,0x30(%rsp)
mov    0xc(%rsp),%eax
mov    0x2b91(%rip),%rcx
cmp    (%rcx),%eax
jne    1441 <main+0x221>
mov    0x2b8e(%rip),%rax
mov    (%rax),%edi
lea    0xdf1(%rip),%rsi
mov    $0xe,%edx
xor    %eax,%eax
call   1040 <write@plt>
mov    $0xfffffffc,%ebx
jmp    1a1c <main+0x7fc>
mov    $0x100,%edi
call   10b0 <malloc@plt>
mov    %rax,%rbp
lea    0xdd6(%rip),%rsi
mov    %rax,%rdi
mov    0x28(%rsp),%rdx
xor    %eax,%eax
call   1110 <sprintf@plt>
mov    0x30(%rsp),%rcx
test   %rcx,%rcx
je     1482 <main+0x262>
lea    0xdc5(%rip),%rsi
mov    %rbp,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1110 <sprintf@plt>
cmp    $0x3,%r13d
mov    0x10(%rsp),%ebx
ja     14aa <main+0x28a>
movslq %r13d,%rax
lea    0xc3e(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
mov    %rbp,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1110 <sprintf@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <write@plt>
lea    0x48(%rsp),%rdi
lea    0x40(%rsp),%rsi
lea    0x38(%rsp),%rdx
lea    0x18(%rsp),%rcx
mov    %r13d,%r8d
call   1140 <inic@plt>
cmp    $0x1,%eax
je     157e <main+0x35e>
cmp    $0x2,%eax
je     15c2 <main+0x3a2>
cmp    $0x3,%eax
jne    160a <main+0x3ea>
lea    0x14a0(%rsp),%rbx
nop
mov    0x38(%rsp),%edi
mov    %rbx,%rsi
mov    $0x300,%edx
call   1090 <read@plt>
test   %eax,%eax
jle    1a1a <main+0x7fa>
mov    0x1c(%rsp),%esi
mov    $0x3,%edi
mov    %eax,%edx
mov    %rbx,%rcx
call   1120 <analize@plt>
test   %eax,%eax
je     1500 <main+0x2e0>
jmp    1600 <main+0x3e0>
mov    0x2a74(%rip),%rax
mov    (%rax),%edi
lea    0xcc5(%rip),%rsi
mov    $0x11,%edx
xor    %eax,%eax
call   1040 <write@plt>
mov    $0xfffffffe,%ebx
jmp    1a1c <main+0x7fc>
mov    0x2a7e(%rip),%rax
mov    (%rax),%edi
lea    0xb81(%rip),%rsi
xor    %ebx,%ebx
mov    $0xf9,%edx
xor    %eax,%eax
call   1040 <write@plt>
jmp    1a1c <main+0x7fc>
lea    0x14a0(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    0x48(%rsp),%edi
mov    %rbx,%rsi
mov    $0x300,%edx
call   1090 <read@plt>
test   %eax,%eax
jle    1a1a <main+0x7fa>
mov    0x1c(%rsp),%esi
mov    $0x1,%edi
mov    %eax,%edx
mov    %rbx,%rcx
call   1120 <analize@plt>
test   %eax,%eax
je     1590 <main+0x370>
jmp    1600 <main+0x3e0>
lea    0x14a0(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    0x40(%rsp),%edi
mov    %rbx,%rsi
mov    $0x300,%edx
call   1090 <read@plt>
test   %eax,%eax
jle    1a1a <main+0x7fa>
mov    0x1c(%rsp),%esi
mov    $0x2,%edi
mov    %eax,%edx
mov    %rbx,%rcx
call   1120 <analize@plt>
test   %eax,%eax
je     15d0 <main+0x3b0>
mov    $0xffffffff,%ebx
jmp    1a1c <main+0x7fc>
lea    0x8a0(%rsp),%rdi
mov    $0xc00,%edx
xor    %esi,%esi
call   1060 <memset@plt>
lea    0x14a0(%rsp),%rsi
mov    0xc(%rsp),%edi
mov    $0x300,%edx
call   1090 <read@plt>
test   %eax,%eax
jle    17b8 <main+0x598>
mov    %eax,%r12d
lea    0x8b8(%rsp),%r15
lea    0x14a0(%rsp),%rbx
lea    0x90(%rsp),%r14
nopw   0x0(%rax,%rax,1)
cmp    $0x1,%r13d
ja     16a0 <main+0x480>
mov    0x4c(%rsp),%edi
mov    %rbx,%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   1040 <write@plt>
test   $0xfffffffd,%r13d
jne    16a9 <main+0x489>
mov    0x44(%rsp),%edi
mov    %rbx,%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   1040 <write@plt>
cmp    $0x3,%r13d
jne    16af <main+0x48f>
jmp    16b4 <main+0x494>
nopl   0x0(%rax)
test   $0xfffffffd,%r13d
je     1680 <main+0x460>
cmp    $0x3,%r13d
je     16b4 <main+0x494>
test   %r13d,%r13d
jne    16c5 <main+0x4a5>
mov    0x3c(%rsp),%edi
mov    %rbx,%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   1040 <write@plt>
mov    %rbx,%r12
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
lea    0x2(%rbx),%ebp
mov    0x18(%rsp),%edi
mov    %r14,%rsi
mov    $0x101,%edx
call   1090 <read@plt>
mov    0x90(%rsp),%rax
shl    $0xa,%rax
add    %r15,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movdqu 0x98(%rsp,%rcx,8),%xmm0
movdqu 0xa8(%rsp,%rcx,8),%xmm1
pshufd $0xe8,%xmm0,%xmm0
pshufd $0xe8,%xmm1,%xmm1
movq   -0x18(%rax,%rcx,4),%xmm2
paddd  %xmm0,%xmm2
movq   -0x10(%rax,%rcx,4),%xmm0
paddd  %xmm1,%xmm0
movq   %xmm2,-0x18(%rax,%rcx,4)
movq   %xmm0,-0x10(%rax,%rcx,4)
movdqu 0xb8(%rsp,%rcx,8),%xmm0
movdqu 0xc8(%rsp,%rcx,8),%xmm1
pshufd $0xe8,%xmm0,%xmm0
pshufd $0xe8,%xmm1,%xmm1
movq   -0x8(%rax,%rcx,4),%xmm2
paddd  %xmm0,%xmm2
movq   (%rax,%rcx,4),%xmm0
paddd  %xmm1,%xmm0
movq   %xmm2,-0x8(%rax,%rcx,4)
movq   %xmm0,(%rax,%rcx,4)
add    $0x8,%rcx
cmp    $0x100,%rcx
jne    1700 <main+0x4e0>
test   %r13d,%r13d
cmove  %ebx,%ebp
lea    0x1(%rbp),%ebx
cmp    $0x2,%ebp
jl     16d0 <main+0x4b0>
mov    0xc(%rsp),%edi
mov    %r12,%rbx
mov    %r12,%rsi
mov    $0x300,%edx
call   1090 <read@plt>
mov    %eax,%r12d
test   %eax,%eax
jg     1660 <main+0x440>
cmp    $0x1,%r13d
ja     17e1 <main+0x5c1>
mov    0x4c(%rsp),%edi
call   1070 <close@plt>
test   $0xfffffffd,%r13d
jne    17ea <main+0x5ca>
mov    0x44(%rsp),%edi
call   1070 <close@plt>
cmp    $0x3,%r13d
jne    17f0 <main+0x5d0>
jmp    17f5 <main+0x5d5>
test   $0xfffffffd,%r13d
je     17d0 <main+0x5b0>
cmp    $0x3,%r13d
je     17f5 <main+0x5d5>
test   %r13d,%r13d
jne    17fe <main+0x5de>
mov    0x3c(%rsp),%edi
call   1070 <close@plt>
lea    0x14(%rsp),%rbp
mov    0x27a6(%rip),%r15
lea    0xac0(%rip),%r14
lea    0xaa1(%rip),%r12
xor    %eax,%eax
jmp    1839 <main+0x619>
nopl   0x0(%rax)
mov    (%r15),%edi
mov    %r14,%rsi
mov    $0x11,%edx
xor    %eax,%eax
call   1040 <write@plt>
lea    0x1(%rbx),%eax
test   %ebx,%ebx
jg     1873 <main+0x653>
lea    0x2(%rax),%ebx
test   %r13d,%r13d
cmove  %eax,%ebx
mov    %rbp,%rdi
call   1130 <wait@plt>
mov    0x14(%rsp),%edi
call   1100 <WIFEXITED@plt>
test   %rax,%rax
je     1820 <main+0x600>
mov    0x14(%rsp),%edi
call   10c0 <WEXITSTATUS@plt>
test   %rax,%rax
je     1832 <main+0x612>
mov    (%r15),%edi
mov    %r12,%rsi
mov    $0x17,%edx
jmp    182b <main+0x60b>
cmp    $0x3,%r13d
mov    0x10(%rsp),%r12d
ja     1a1a <main+0x7fa>
mov    %r13d,%eax
lea    0x838(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xa4d(%rip),%r14
lea    0x50(%rsp),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x8a0(%rsp,%rbx,4),%ecx
mov    0xca0(%rsp,%rbx,4),%r9d
mov    0x10a0(%rsp,%rbx,4),%ebp
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
mov    %ebx,%r8d
xor    %eax,%eax
push   %rbp
push   %rbx
call   1110 <sprintf@plt>
add    $0x10,%rsp
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    %r12d,%edi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <write@plt>
add    $0x1,%rbx
cmp    $0x100,%rbx
jne    18b0 <main+0x690>
jmp    1a1a <main+0x7fa>
mov    0x26a2(%rip),%rax
mov    (%rax),%edi
lea    0x8e3(%rip),%rsi
mov    $0xf,%edx
xor    %eax,%eax
call   1040 <write@plt>
mov    $0xfffffffd,%ebx
jmp    1a1c <main+0x7fc>
lea    0x9df(%rip),%r14
lea    0x50(%rsp),%rbp
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    0x8a0(%rsp,%rbx,4),%ecx
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1110 <sprintf@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %r12d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <write@plt>
add    $0x1,%rbx
cmp    $0x100,%rbx
jne    1940 <main+0x720>
jmp    1a1a <main+0x7fa>
lea    0x99a(%rip),%r14
lea    0x50(%rsp),%rbp
xor    %ebx,%ebx
nopl   (%rax)
mov    0xca0(%rsp,%rbx,4),%ecx
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1110 <sprintf@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %r12d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <write@plt>
add    $0x1,%rbx
cmp    $0x100,%rbx
jne    1990 <main+0x770>
jmp    1a1a <main+0x7fa>
lea    0x932(%rip),%r14
lea    0x50(%rsp),%rbp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    0x10a0(%rsp,%rbx,4),%ecx
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1110 <sprintf@plt>
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %r12d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <write@plt>
add    $0x1,%rbx
cmp    $0x100,%rbx
jne    19e0 <main+0x7c0>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x2ca8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x7ae(%rip),%rdi
call   10e0 <perror@plt>
mov    $0xfffffffd,%ebx
jmp    1a1c <main+0x7fc>

LLVM IR (-O0):
@STDIN_FILENO = global i32 0
@STDOUT_FILENO = global i32 0
@.str = [8 x i8] c"hc:a:o:\00"
@.str.1 = [249 x i8] c"Usage: hist [OPTION...]\0A -h, \09\09\09 show this help and exit\0A -a <ppm-file>,\09 use ppm-file file\0A -c <rojo/verde/azul>,\09 show only the result for selected colour\0A -o <file-name>,\09 create a file named file-name and stores the results\0A\00"
@optarg = external global i8*
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@O_TRUNC = global i32 0
@.str.2 = [5 x i8] c"open\00"
@O_RDONLY = global i32 0
@.str.3 = [5 x i8] c"rojo\00"
@.str.4 = [6 x i8] c"verde\00"
@.str.5 = [5 x i8] c"azul\00"
@STDERR_FILENO = global i32 0
@.str.6 = [16 x i8] c"Wrong argument\0A\00"
@.str.7 = [18 x i8] c"Missing argument\0A\00"
@.str.8 = [15 x i8] c"No input file\0A\00"
@.str.9 = [15 x i8] c"File read: %s\0A\00"
@.str.10 = [19 x i8] c"%sOutput file: %s\0A\00"
@.str.11 = [27 x i8] c"%sChannels analized: all\0A\0A\00"
@.str.12 = [26 x i8] c"%sChannel analized: red\0A\0A\00"
@.str.13 = [28 x i8] c"%sChannel analized: green\0A\0A\00"
@.str.14 = [27 x i8] c"%sChannel analized: blue\0A\0A\00"
@.str.15 = [5 x i8] c"read\00"
@.str.16 = [24 x i8] c"Child ended with error\0A\00"
@.str.17 = [24 x i8] c"Child ended signalized\0A\00"
@.str.18 = [42 x i8] c"red[%3d]=%d\09\09green[%3d]=%d\09\09blue[%3d]=%d\0A\00"
@.str.19 = [13 x i8] c"red[%3d]=%d\0A\00"
@.str.20 = [15 x i8] c"green[%3d]=%d\0A\00"
@.str.21 = [14 x i8] c"blue[%3d]=%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2 x i32]
%7 = alloca [2 x i32]
%8 = alloca [2 x i32]
%9 = alloca [2 x i32]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca [768 x i64]
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca [257 x i64]
%21 = alloca [50 x i8]
%22 = alloca [3 x [256 x i32]]
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %13
%26 = load i32, i32* @STDIN_FILENO
store i32 %26, i32* %14
%27 = load i32, i32* @STDOUT_FILENO
store i32 %27, i32* %15
%28 = bitcast [768 x i64]* %16 to i8*
store i8* null, i8** %17
store i8* null, i8** %18
store i8* null, i8** %19
br label %29
29: ; preds = %104, %2
%30 = load i32, i32* %4
%31 = load i8**, i8*** %5
%32 = call i32 @getopt(i32 %30, i8** %31, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32 %32, i32* %12
%33 = icmp sge i32 %32, 0
br i1 %33, label %34, label %105
34: ; preds = %29
%35 = load i32, i32* %12
switch i32 %35, label %104 [
i32 104, label %36
i32 111, label %39
i32 97, label %60
i32 99, label %80
i32 63, label %101
]
36: ; preds = %34
%37 = load i32, i32* @STDOUT_FILENO
%38 = call i32 (i32, ...) @write(i32 %37, i8* getelementptr inbounds ([249 x i8], [249 x i8]* @.str.1, i64 0, i64 0), i32 249)
store i32 0, i32* %3
br label %489
39: ; preds = %34
%40 = load i8*, i8** @optarg
%41 = load i32, i32* @O_CREAT
%42 = load i32, i32* @O_RDWR
%43 = or i32 %41, %42
%44 = load i32, i32* @O_TRUNC
%45 = or i32 %43, %44
%46 = call i32 (i8*, i32, ...) @open(i8* %40, i32 %45, i32 416)
store i32 %46, i32* %15
%47 = icmp eq i32 %46, -1
br i1 %47, label %48, label %50
48: ; preds = %39
%49 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store i32 -3, i32* %3
br label %489
50: ; preds = %39
%51 = load i8*, i8** @optarg
%52 = call i32 @strlen(i8* %51)
%53 = sext i32 %52 to i64
%54 = mul i64 1, %53
%55 = trunc i64 %54 to i32
%56 = call i8* @malloc(i32 %55)
store i8* %56, i8** %18
%57 = load i8*, i8** %18
%58 = load i8*, i8** @optarg
%59 = call i32 @strcpy(i8* %57, i8* %58)
br label %104
60: ; preds = %34
%61 = load i8*, i8** @optarg
%62 = load i32, i32* @O_RDONLY
%63 = call i32 (i8*, i32, ...) @open(i8* %61, i32 %62)
store i32 %63, i32* %14
%64 = icmp eq i32 %63, -1
br i1 %64, label %65, label %67
65: ; preds = %60
%66 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store i32 -3, i32* %3
br label %489
67: ; preds = %60
%68 = load i32, i32* %14
%69 = load i8*, i8** @optarg
%70 = call i32 @setpointer(i32 %68, i8* %69)
store i32 %70, i32* %14
%71 = load i8*, i8** @optarg
%72 = call i32 @strlen(i8* %71)
%73 = sext i32 %72 to i64
%74 = mul i64 1, %73
%75 = trunc i64 %74 to i32
%76 = call i8* @malloc(i32 %75)
store i8* %76, i8** %17
%77 = load i8*, i8** %17
%78 = load i8*, i8** @optarg
%79 = call i32 @strcpy(i8* %77, i8* %78)
br label %104
80: ; preds = %34
%81 = load i8*, i8** @optarg
%82 = call i32 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %81)
%83 = icmp ne i32 %82, 0
br i1 %83, label %85, label %84
84: ; preds = %80
store i32 1, i32* %13
br label %100
85: ; preds = %80
%86 = load i8*, i8** @optarg
%87 = call i32 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %86)
%88 = icmp ne i32 %87, 0
br i1 %88, label %90, label %89
89: ; preds = %85
store i32 2, i32* %13
br label %99
90: ; preds = %85
%91 = load i8*, i8** @optarg
%92 = call i32 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %91)
%93 = icmp ne i32 %92, 0
br i1 %93, label %95, label %94
94: ; preds = %90
store i32 3, i32* %13
br label %98
95: ; preds = %90
%96 = load i32, i32* @STDERR_FILENO
%97 = call i32 (i32, ...) @write(i32 %96, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i32 15)
store i32 -3, i32* %3
br label %489
98: ; preds = %94
br label %99
99: ; preds = %98, %89
br label %100
100: ; preds = %99, %84
br label %104
101: ; preds = %34
%102 = load i32, i32* @STDERR_FILENO
%103 = call i32 (i32, ...) @write(i32 %102, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 17)
store i32 -2, i32* %3
br label %489
104: ; preds = %34, %100, %67, %50
br label %29
105: ; preds = %29
%106 = load i32, i32* %14
%107 = load i32, i32* @STDIN_FILENO
%108 = icmp eq i32 %106, %107
br i1 %108, label %109, label %112
109: ; preds = %105
%110 = load i32, i32* @STDERR_FILENO
%111 = call i32 (i32, ...) @write(i32 %110, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i32 14)
store i32 -4, i32* %3
br label %489
112: ; preds = %105
%113 = call i8* @malloc(i32 256)
store i8* %113, i8** %19
%114 = load i8*, i8** %19
%115 = load i8*, i8** %17
%116 = call i32 (i8*, i8*, ...) @sprintf(i8* %114, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* %115)
%117 = load i8*, i8** %18
%118 = icmp ne i8* %117, null
br i1 %118, label %119, label %124
119: ; preds = %112
%120 = load i8*, i8** %19
%121 = load i8*, i8** %19
%122 = load i8*, i8** %18
%123 = call i32 (i8*, i8*, ...) @sprintf(i8* %120, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i8* %121, i8* %122)
br label %124
124: ; preds = %119, %112
%125 = load i32, i32* %13
%126 = icmp eq i32 %125, 0
br i1 %126, label %127, label %131
127: ; preds = %124
%128 = load i8*, i8** %19
%129 = load i8*, i8** %19
%130 = call i32 (i8*, i8*, ...) @sprintf(i8* %128, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0), i8* %129)
br label %131
131: ; preds = %127, %124
%132 = load i32, i32* %13
%133 = icmp eq i32 %132, 1
br i1 %133, label %134, label %138
134: ; preds = %131
%135 = load i8*, i8** %19
%136 = load i8*, i8** %19
%137 = call i32 (i8*, i8*, ...) @sprintf(i8* %135, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0), i8* %136)
br label %138
138: ; preds = %134, %131
%139 = load i32, i32* %13
%140 = icmp eq i32 %139, 2
br i1 %140, label %141, label %145
141: ; preds = %138
%142 = load i8*, i8** %19
%143 = load i8*, i8** %19
%144 = call i32 (i8*, i8*, ...) @sprintf(i8* %142, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.13, i64 0, i64 0), i8* %143)
br label %145
145: ; preds = %141, %138
%146 = load i32, i32* %13
%147 = icmp eq i32 %146, 3
br i1 %147, label %148, label %152
148: ; preds = %145
%149 = load i8*, i8** %19
%150 = load i8*, i8** %19
%151 = call i32 (i8*, i8*, ...) @sprintf(i8* %149, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.14, i64 0, i64 0), i8* %150)
br label %152
152: ; preds = %148, %145
%153 = load i32, i32* %15
%154 = load i8*, i8** %19
%155 = load i8*, i8** %19
%156 = call i32 @strlen(i8* %155)
%157 = call i32 (i32, ...) @write(i32 %153, i8* %154, i32 %156)
%158 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%159 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%160 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%161 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%162 = load i32, i32* %13
%163 = call i32 @inic(i32* %158, i32* %159, i32* %160, i32* %161, i32 %162)
store i32 %163, i32* %10
%164 = load i32, i32* %10
switch i32 %164, label %216 [
i32 1, label %165
i32 2, label %182
i32 3, label %199
]
165: ; preds = %152
br label %166
166: ; preds = %180, %165
%167 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%168 = load i32, i32* %167
%169 = getelementptr inbounds [768 x i64], [768 x i64]* %16, i64 0, i64 0
%170 = call i32 @read(i32 %168, i64* %169, i32 768)
store i32 %170, i32* %11
%171 = icmp sgt i32 %170, 0
br i1 %171, label %172, label %181
172: ; preds = %166
%173 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
%174 = load i32, i32* %173
%175 = load i32, i32* %11
%176 = getelementptr inbounds [768 x i64], [768 x i64]* %16, i64 0, i64 0
%177 = call i32 @analize(i32 1, i32 %174, i32 %175, i64* %176)
%178 = icmp ne i32 %177, 0
br i1 %178, label %179, label %180
179: ; preds = %172
store i32 -1, i32* %3
br label %489
180: ; preds = %172
br label %166
181: ; preds = %166
store i32 0, i32* %3
br label %489
182: ; preds = %152
br label %183
183: ; preds = %197, %182
%184 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%185 = load i32, i32* %184
%186 = getelementptr inbounds [768 x i64], [768 x i64]* %16, i64 0, i64 0
%187 = call i32 @read(i32 %185, i64* %186, i32 768)
store i32 %187, i32* %11
%188 = icmp sgt i32 %187, 0
br i1 %188, label %189, label %198
189: ; preds = %183
%190 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
%191 = load i32, i32* %190
%192 = load i32, i32* %11
%193 = getelementptr inbounds [768 x i64], [768 x i64]* %16, i64 0, i64 0
%194 = call i32 @analize(i32 2, i32 %191, i32 %192, i64* %193)
%195 = icmp ne i32 %194, 0
br i1 %195, label %196, label %197
196: ; preds = %189
store i32 -1, i32* %3
br label %489
197: ; preds = %189
br label %183
198: ; preds = %183
store i32 0, i32* %3
br label %489
199: ; preds = %152
br label %200
200: ; preds = %214, %199
%201 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%202 = load i32, i32* %201
%203 = getelementptr inbounds [768 x i64], [768 x i64]* %16, i64 0, i64 0
%204 = call i32 @read(i32 %202, i64* %203, i32 768)
store i32 %204, i32* %11
%205 = icmp sgt i32 %204, 0
br i1 %205, label %206, label %215
206: ; preds = %200
%207 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
%208 = load i32, i32* %207
%209 = load i32, i32* %11
%210 = getelementptr inbounds [768 x i64], [768 x i64]* %16, i64 0, i64 0
%211 = call i32 @analize(i32 3, i32 %208, i32 %209, i64* %210)
%212 = icmp ne i32 %211, 0
br i1 %212, label %213, label %214
213: ; preds = %206
store i32 -1, i32* %3
br label %489
214: ; preds = %206
br label %200
215: ; preds = %200
store i32 0, i32* %3
br label %489
216: ; preds = %152
store i32 0, i32* %23
br label %217
217: ; preds = %235, %216
%218 = load i32, i32* %23
%219 = icmp slt i32 %218, 3
br i1 %219, label %220, label %238
220: ; preds = %217
store i32 0, i32* %24
br label %221
221: ; preds = %231, %220
%222 = load i32, i32* %24
%223 = icmp slt i32 %222, 256
br i1 %223, label %224, label %234
224: ; preds = %221
%225 = load i32, i32* %23
%226 = sext i32 %225 to i64
%227 = getelementptr inbounds [3 x [256 x i32]], [3 x [256 x i32]]* %22, i64 0, i64 %226
%228 = load i32, i32* %24
%229 = sext i32 %228 to i64
%230 = getelementptr inbounds [256 x i32], [256 x i32]* %227, i64 0, i64 %229
store i32 0, i32* %230
br label %231
231: ; preds = %224
%232 = load i32, i32* %24
%233 = add nsw i32 %232, 1
store i32 %233, i32* %24
br label %221
234: ; preds = %221
br label %235
235: ; preds = %234
%236 = load i32, i32* %23
%237 = add nsw i32 %236, 1
store i32 %237, i32* %23
br label %217
238: ; preds = %217
br label %239
239: ; preds = %325, %238
%240 = load i32, i32* %14
%241 = getelementptr inbounds [768 x i64], [768 x i64]* %16, i64 0, i64 0
%242 = call i32 @read(i32 %240, i64* %241, i32 768)
store i32 %242, i32* %11
%243 = icmp sgt i32 %242, 0
br i1 %243, label %244, label %326
244: ; preds = %239
%245 = load i32, i32* %11
%246 = icmp eq i32 %245, -1
br i1 %246, label %247, label %249
247: ; preds = %244
%248 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
store i32 -9, i32* %3
br label %489
249: ; preds = %244
%250 = load i32, i32* %13
%251 = icmp eq i32 %250, 1
br i1 %251, label %255, label %252
252: ; preds = %249
%253 = load i32, i32* %13
%254 = icmp eq i32 %253, 0
br i1 %254, label %255, label %261
255: ; preds = %252, %249
%256 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%257 = load i32, i32* %256
%258 = getelementptr inbounds [768 x i64], [768 x i64]* %16, i64 0, i64 0
%259 = load i32, i32* %11
%260 = call i32 (i32, ...) @write(i32 %257, i64* %258, i32 %259)
br label %261
261: ; preds = %255, %252
%262 = load i32, i32* %13
%263 = icmp eq i32 %262, 2
br i1 %263, label %267, label %264
264: ; preds = %261
%265 = load i32, i32* %13
%266 = icmp eq i32 %265, 0
br i1 %266, label %267, label %273
267: ; preds = %264, %261
%268 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%269 = load i32, i32* %268
%270 = getelementptr inbounds [768 x i64], [768 x i64]* %16, i64 0, i64 0
%271 = load i32, i32* %11
%272 = call i32 (i32, ...) @write(i32 %269, i64* %270, i32 %271)
br label %273
273: ; preds = %267, %264
%274 = load i32, i32* %13
%275 = icmp eq i32 %274, 3
br i1 %275, label %279, label %276
276: ; preds = %273
%277 = load i32, i32* %13
%278 = icmp eq i32 %277, 0
br i1 %278, label %279, label %285
279: ; preds = %276, %273
%280 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%281 = load i32, i32* %280
%282 = getelementptr inbounds [768 x i64], [768 x i64]* %16, i64 0, i64 0
%283 = load i32, i32* %11
%284 = call i32 (i32, ...) @write(i32 %281, i64* %282, i32 %283)
br label %285
285: ; preds = %279, %276
store i32 0, i32* %24
br label %286
286: ; preds = %322, %285
%287 = load i32, i32* %24
%288 = icmp slt i32 %287, 3
br i1 %288, label %289, label %325
289: ; preds = %286
%290 = load i32, i32* %13
%291 = icmp ne i32 %290, 0
br i1 %291, label %292, label %295
292: ; preds = %289
%293 = load i32, i32* %24
%294 = add nsw i32 %293, 2
store i32 %294, i32* %24
br label %295
295: ; preds = %292, %289
%296 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%297 = load i32, i32* %296
%298 = getelementptr inbounds [257 x i64], [257 x i64]* %20, i64 0, i64 0
%299 = call i32 @read(i32 %297, i64* %298, i32 257)
store i32 %299, i32* %11
store i32 1, i32* %23
br label %300
300: ; preds = %318, %295
%301 = load i32, i32* %23
%302 = icmp slt i32 %301, 257
br i1 %302, label %303, label %321
303: ; preds = %300
%304 = load i32, i32* %23
%305 = sext i32 %304 to i64
%306 = getelementptr inbounds [257 x i64], [257 x i64]* %20, i64 0, i64 %305
%307 = load i64, i64* %306
%308 = trunc i64 %307 to i32
%309 = getelementptr inbounds [257 x i64], [257 x i64]* %20, i64 0, i64 0
%310 = load i64, i64* %309
%311 = getelementptr inbounds [3 x [256 x i32]], [3 x [256 x i32]]* %22, i64 0, i64 %310
%312 = load i32, i32* %23
%313 = sub nsw i32 %312, 1
%314 = sext i32 %313 to i64
%315 = getelementptr inbounds [256 x i32], [256 x i32]* %311, i64 0, i64 %314
%316 = load i32, i32* %315
%317 = add nsw i32 %316, %308
store i32 %317, i32* %315
br label %318
318: ; preds = %303
%319 = load i32, i32* %23
%320 = add nsw i32 %319, 1
store i32 %320, i32* %23
br label %300
321: ; preds = %300
br label %322
322: ; preds = %321
%323 = load i32, i32* %24
%324 = add nsw i32 %323, 1
store i32 %324, i32* %24
br label %286
325: ; preds = %286
br label %239
326: ; preds = %239
%327 = load i32, i32* %13
%328 = icmp eq i32 %327, 1
br i1 %328, label %332, label %329
329: ; preds = %326
%330 = load i32, i32* %13
%331 = icmp eq i32 %330, 0
br i1 %331, label %332, label %336
332: ; preds = %329, %326
%333 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%334 = load i32, i32* %333
%335 = call i32 @close(i32 %334)
br label %336
336: ; preds = %332, %329
%337 = load i32, i32* %13
%338 = icmp eq i32 %337, 2
br i1 %338, label %342, label %339
339: ; preds = %336
%340 = load i32, i32* %13
%341 = icmp eq i32 %340, 0
br i1 %341, label %342, label %346
342: ; preds = %339, %336
%343 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%344 = load i32, i32* %343
%345 = call i32 @close(i32 %344)
br label %346
346: ; preds = %342, %339
%347 = load i32, i32* %13
%348 = icmp eq i32 %347, 3
br i1 %348, label %352, label %349
349: ; preds = %346
%350 = load i32, i32* %13
%351 = icmp eq i32 %350, 0
br i1 %351, label %352, label %356
352: ; preds = %349, %346
%353 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%354 = load i32, i32* %353
%355 = call i32 @close(i32 %354)
br label %356
356: ; preds = %352, %349
store i32 0, i32* %23
br label %357
357: ; preds = %383, %356
%358 = load i32, i32* %23
%359 = icmp slt i32 %358, 2
br i1 %359, label %360, label %386
360: ; preds = %357
%361 = load i32, i32* %13
%362 = icmp ne i32 %361, 0
br i1 %362, label %363, label %366
363: ; preds = %360
%364 = load i32, i32* %23
%365 = add nsw i32 %364, 2
store i32 %365, i32* %23
br label %366
366: ; preds = %363, %360
%367 = call i32 @wait(i32* %25)
%368 = load i32, i32* %25
%369 = call i64 @WIFEXITED(i32 %368)
%370 = icmp ne i64 %369, 0
br i1 %370, label %371, label %379
371: ; preds = %366
%372 = load i32, i32* %25
%373 = call i64 @WEXITSTATUS(i32 %372)
%374 = icmp ne i64 %373, 0
br i1 %374, label %375, label %378
375: ; preds = %371
%376 = load i32, i32* @STDERR_FILENO
%377 = call i32 (i32, ...) @write(i32 %376, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.16, i64 0, i64 0), i32 23)
br label %378
378: ; preds = %375, %371
br label %382
379: ; preds = %366
%380 = load i32, i32* @STDERR_FILENO
%381 = call i32 (i32, ...) @write(i32 %380, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.17, i64 0, i64 0), i32 17)
br label %382
382: ; preds = %379, %378
br label %383
383: ; preds = %382
%384 = load i32, i32* %23
%385 = add nsw i32 %384, 1
store i32 %385, i32* %23
br label %357
386: ; preds = %357
%387 = load i32, i32* %13
switch i32 %387, label %488 [
i32 0, label %388
i32 1, label %422
i32 2, label %444
i32 3, label %466
]
388: ; preds = %386
store i32 0, i32* %23
br label %389
389: ; preds = %418, %388
%390 = load i32, i32* %23
%391 = icmp slt i32 %390, 256
br i1 %391, label %392, label %421
392: ; preds = %389
%393 = getelementptr inbounds [50 x i8], [50 x i8]* %21, i64 0, i64 0
%394 = load i32, i32* %23
%395 = getelementptr inbounds [3 x [256 x i32]], [3 x [256 x i32]]* %22, i64 0, i64 0
%396 = load i32, i32* %23
%397 = sext i32 %396 to i64
%398 = getelementptr inbounds [256 x i32], [256 x i32]* %395, i64 0, i64 %397
%399 = load i32, i32* %398
%400 = load i32, i32* %23
%401 = getelementptr inbounds [3 x [256 x i32]], [3 x [256 x i32]]* %22, i64 0, i64 1
%402 = load i32, i32* %23
%403 = sext i32 %402 to i64
%404 = getelementptr inbounds [256 x i32], [256 x i32]* %401, i64 0, i64 %403
%405 = load i32, i32* %404
%406 = load i32, i32* %23
%407 = getelementptr inbounds [3 x [256 x i32]], [3 x [256 x i32]]* %22, i64 0, i64 2
%408 = load i32, i32* %23
%409 = sext i32 %408 to i64
%410 = getelementptr inbounds [256 x i32], [256 x i32]* %407, i64 0, i64 %409
%411 = load i32, i32* %410
%412 = call i32 (i8*, i8*, ...) @sprintf(i8* %393, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.18, i64 0, i64 0), i32 %394, i32 %399, i32 %400, i32 %405, i32 %406, i32 %411)
%413 = load i32, i32* %15
%414 = getelementptr inbounds [50 x i8], [50 x i8]* %21, i64 0, i64 0
%415 = getelementptr inbounds [50 x i8], [50 x i8]* %21, i64 0, i64 0
%416 = call i32 @strlen(i8* %415)
%417 = call i32 (i32, ...) @write(i32 %413, i8* %414, i32 %416)
br label %418
418: ; preds = %392
%419 = load i32, i32* %23
%420 = add nsw i32 %419, 1
store i32 %420, i32* %23
br label %389
421: ; preds = %389
br label %488
422: ; preds = %386
store i32 0, i32* %23
br label %423
423: ; preds = %440, %422
%424 = load i32, i32* %23
%425 = icmp slt i32 %424, 256
br i1 %425, label %426, label %443
426: ; preds = %423
%427 = getelementptr inbounds [50 x i8], [50 x i8]* %21, i64 0, i64 0
%428 = load i32, i32* %23
%429 = getelementptr inbounds [3 x [256 x i32]], [3 x [256 x i32]]* %22, i64 0, i64 0
%430 = load i32, i32* %23
%431 = sext i32 %430 to i64
%432 = getelementptr inbounds [256 x i32], [256 x i32]* %429, i64 0, i64 %431
%433 = load i32, i32* %432
%434 = call i32 (i8*, i8*, ...) @sprintf(i8* %427, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.19, i64 0, i64 0), i32 %428, i32 %433)
%435 = load i32, i32* %15
%436 = getelementptr inbounds [50 x i8], [50 x i8]* %21, i64 0, i64 0
%437 = getelementptr inbounds [50 x i8], [50 x i8]* %21, i64 0, i64 0
%438 = call i32 @strlen(i8* %437)
%439 = call i32 (i32, ...) @write(i32 %435, i8* %436, i32 %438)
br label %440
440: ; preds = %426
%441 = load i32, i32* %23
%442 = add nsw i32 %441, 1
store i32 %442, i32* %23
br label %423
443: ; preds = %423
br label %488
444: ; preds = %386
store i32 0, i32* %23
br label %445
445: ; preds = %462, %444
%446 = load i32, i32* %23
%447 = icmp slt i32 %446, 256
br i1 %447, label %448, label %465
448: ; preds = %445
%449 = getelementptr inbounds [50 x i8], [50 x i8]* %21, i64 0, i64 0
%450 = load i32, i32* %23
%451 = getelementptr inbounds [3 x [256 x i32]], [3 x [256 x i32]]* %22, i64 0, i64 1
%452 = load i32, i32* %23
%453 = sext i32 %452 to i64
%454 = getelementptr inbounds [256 x i32], [256 x i32]* %451, i64 0, i64 %453
%455 = load i32, i32* %454
%456 = call i32 (i8*, i8*, ...) @sprintf(i8* %449, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.20, i64 0, i64 0), i32 %450, i32 %455)
%457 = load i32, i32* %15
%458 = getelementptr inbounds [50 x i8], [50 x i8]* %21, i64 0, i64 0
%459 = getelementptr inbounds [50 x i8], [50 x i8]* %21, i64 0, i64 0
%460 = call i32 @strlen(i8* %459)
%461 = call i32 (i32, ...) @write(i32 %457, i8* %458, i32 %460)
br label %462
462: ; preds = %448
%463 = load i32, i32* %23
%464 = add nsw i32 %463, 1
store i32 %464, i32* %23
br label %445
465: ; preds = %445
br label %488
466: ; preds = %386
store i32 0, i32* %23
br label %467
467: ; preds = %484, %466
%468 = load i32, i32* %23
%469 = icmp slt i32 %468, 256
br i1 %469, label %470, label %487
470: ; preds = %467
%471 = getelementptr inbounds [50 x i8], [50 x i8]* %21, i64 0, i64 0
%472 = load i32, i32* %23
%473 = getelementptr inbounds [3 x [256 x i32]], [3 x [256 x i32]]* %22, i64 0, i64 2
%474 = load i32, i32* %23
%475 = sext i32 %474 to i64
%476 = getelementptr inbounds [256 x i32], [256 x i32]* %473, i64 0, i64 %475
%477 = load i32, i32* %476
%478 = call i32 (i8*, i8*, ...) @sprintf(i8* %471, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.21, i64 0, i64 0), i32 %472, i32 %477)
%479 = load i32, i32* %15
%480 = getelementptr inbounds [50 x i8], [50 x i8]* %21, i64 0, i64 0
%481 = getelementptr inbounds [50 x i8], [50 x i8]* %21, i64 0, i64 0
%482 = call i32 @strlen(i8* %481)
%483 = call i32 (i32, ...) @write(i32 %479, i8* %480, i32 %482)
br label %484
484: ; preds = %470
%485 = load i32, i32* %23
%486 = add nsw i32 %485, 1
store i32 %486, i32* %23
br label %467
487: ; preds = %467
br label %488
488: ; preds = %386, %487, %465, %443, %421
store i32 0, i32* %3
br label %489
489: ; preds = %488, %247, %215, %213, %198, %196, %181, %179, %109, %101, %95, %65, %48, %36
%490 = load i32, i32* %3
ret i32 %490
}

LLVM IR (-O2):
@STDIN_FILENO = global i32 0
@STDOUT_FILENO = global i32 0
@.str = [8 x i8] c"hc:a:o:\00"
@.str.1 = [249 x i8] c"Usage: hist [OPTION...]\0A -h, \09\09\09 show this help and exit\0A -a <ppm-file>,\09 use ppm-file file\0A -c <rojo/verde/azul>,\09 show only the result for selected colour\0A -o <file-name>,\09 create a file named file-name and stores the results\0A\00"
@optarg = external global i8*
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@O_TRUNC = global i32 0
@.str.2 = [5 x i8] c"open\00"
@O_RDONLY = global i32 0
@.str.3 = [5 x i8] c"rojo\00"
@.str.4 = [6 x i8] c"verde\00"
@.str.5 = [5 x i8] c"azul\00"
@STDERR_FILENO = global i32 0
@.str.6 = [16 x i8] c"Wrong argument\0A\00"
@.str.7 = [18 x i8] c"Missing argument\0A\00"
@.str.8 = [15 x i8] c"No input file\0A\00"
@.str.9 = [15 x i8] c"File read: %s\0A\00"
@.str.10 = [19 x i8] c"%sOutput file: %s\0A\00"
@.str.11 = [27 x i8] c"%sChannels analized: all\0A\0A\00"
@.str.12 = [26 x i8] c"%sChannel analized: red\0A\0A\00"
@.str.13 = [28 x i8] c"%sChannel analized: green\0A\0A\00"
@.str.14 = [27 x i8] c"%sChannel analized: blue\0A\0A\00"
@.str.16 = [24 x i8] c"Child ended with error\0A\00"
@.str.17 = [24 x i8] c"Child ended signalized\0A\00"
@.str.18 = [42 x i8] c"red[%3d]=%d\09\09green[%3d]=%d\09\09blue[%3d]=%d\0A\00"
@.str.19 = [13 x i8] c"red[%3d]=%d\0A\00"
@.str.20 = [15 x i8] c"green[%3d]=%d\0A\00"
@.str.21 = [14 x i8] c"blue[%3d]=%d\0A\00"
@reltable.main = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([27 x i8]* @.str.11 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @.str.12 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([28 x i8]* @.str.13 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([27 x i8]* @.str.14 to i64), i64 ptrtoint ([4 x i32]* @reltable.main to i64)) to i32)]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [2 x i32]
%4 = alloca [2 x i32]
%5 = alloca [2 x i32]
%6 = alloca [2 x i32]
%7 = alloca [768 x i64]
%8 = alloca [257 x i64]
%9 = alloca [50 x i8]
%10 = alloca [3 x [256 x i32]]
%11 = bitcast [3 x [256 x i32]]* %10 to i8*
%12 = alloca i32
%13 = bitcast [2 x i32]* %3 to i8*
%14 = bitcast [2 x i32]* %4 to i8*
%15 = bitcast [2 x i32]* %5 to i8*
%16 = bitcast [2 x i32]* %6 to i8*
%17 = load i32, i32* @STDIN_FILENO
%18 = load i32, i32* @STDOUT_FILENO
%19 = bitcast [768 x i64]* %7 to i8*
%20 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%21 = icmp sgt i32 %20, -1
br i1 %21, label %22, label %92
22: ; preds = %2, %84
%23 = phi i32 [ %90, %84 ], [ %20, %2 ]
%24 = phi i8* [ %89, %84 ], [ null, %2 ]
%25 = phi i8* [ %88, %84 ], [ null, %2 ]
%26 = phi i32 [ %87, %84 ], [ %18, %2 ]
%27 = phi i32 [ %86, %84 ], [ %17, %2 ]
%28 = phi i32 [ %85, %84 ], [ 0, %2 ]
switch i32 %23, label %84 [
i32 104, label %29
i32 111, label %32
i32 97, label %47
i32 99, label %60
i32 63, label %73
]
29: ; preds = %22
%30 = load i32, i32* @STDOUT_FILENO
%31 = tail call i32 (i32, ...) @write(i32 %30, i8* getelementptr inbounds ([249 x i8], [249 x i8]* @.str.1, i64 0, i64 0), i32 249)
br label %330
32: ; preds = %22
%33 = load i8*, i8** @optarg
%34 = load i32, i32* @O_CREAT
%35 = load i32, i32* @O_RDWR
%36 = or i32 %35, %34
%37 = load i32, i32* @O_TRUNC
%38 = or i32 %36, %37
%39 = tail call i32 (i8*, i32, ...) @open(i8* %33, i32 %38, i32 416)
%40 = icmp eq i32 %39, -1
br i1 %40, label %41, label %43
41: ; preds = %32
%42 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %330
43: ; preds = %32
%44 = load i8*, i8** @optarg
%45 = tail call i32 @strlen(i8* %44)
%46 = tail call i8* @malloc(i32 %45)
br label %76
47: ; preds = %22
%48 = load i8*, i8** @optarg
%49 = load i32, i32* @O_RDONLY
%50 = tail call i32 (i8*, i32, ...) @open(i8* %48, i32 %49)
%51 = icmp eq i32 %50, -1
br i1 %51, label %52, label %54
52: ; preds = %47
%53 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %330
54: ; preds = %47
%55 = load i8*, i8** @optarg
%56 = tail call i32 @setpointer(i32 %50, i8* %55)
%57 = load i8*, i8** @optarg
%58 = tail call i32 @strlen(i8* %57)
%59 = tail call i8* @malloc(i32 %58)
br label %76
60: ; preds = %22
%61 = load i8*, i8** @optarg
%62 = tail call i32 @strcmp(i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* dereferenceable(1) %61)
%63 = icmp eq i32 %62, 0
br i1 %63, label %84, label %64
64: ; preds = %60
%65 = tail call i32 @strcmp(i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* dereferenceable(1) %61)
%66 = icmp eq i32 %65, 0
br i1 %66, label %84, label %67
67: ; preds = %64
%68 = tail call i32 @strcmp(i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* dereferenceable(1) %61)
%69 = icmp eq i32 %68, 0
br i1 %69, label %84, label %70
70: ; preds = %67
%71 = load i32, i32* @STDERR_FILENO
%72 = tail call i32 (i32, ...) @write(i32 %71, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i32 15)
br label %330
73: ; preds = %22
%74 = load i32, i32* @STDERR_FILENO
%75 = tail call i32 (i32, ...) @write(i32 %74, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 17)
br label %330
76: ; preds = %43, %54
%77 = phi i8* [ %59, %54 ], [ %46, %43 ]
%78 = phi i32 [ %56, %54 ], [ %27, %43 ]
%79 = phi i32 [ %26, %54 ], [ %39, %43 ]
%80 = phi i8* [ %59, %54 ], [ %25, %43 ]
%81 = phi i8* [ %24, %54 ], [ %46, %43 ]
%82 = load i8*, i8** @optarg
%83 = tail call i32 @strcpy(i8* %77, i8* %82)
br label %84
84: ; preds = %76, %67, %64, %60, %22
%85 = phi i32 [ %28, %22 ], [ 1, %60 ], [ 2, %64 ], [ 3, %67 ], [ %28, %76 ]
%86 = phi i32 [ %27, %22 ], [ %27, %60 ], [ %27, %64 ], [ %27, %67 ], [ %78, %76 ]
%87 = phi i32 [ %26, %22 ], [ %26, %60 ], [ %26, %64 ], [ %26, %67 ], [ %79, %76 ]
%88 = phi i8* [ %25, %22 ], [ %25, %60 ], [ %25, %64 ], [ %25, %67 ], [ %80, %76 ]
%89 = phi i8* [ %24, %22 ], [ %24, %60 ], [ %24, %64 ], [ %24, %67 ], [ %81, %76 ]
%90 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%91 = icmp sgt i32 %90, -1
br i1 %91, label %22, label %92
92: ; preds = %84, %2
%93 = phi i32 [ 0, %2 ], [ %85, %84 ]
%94 = phi i32 [ %17, %2 ], [ %86, %84 ]
%95 = phi i32 [ %18, %2 ], [ %87, %84 ]
%96 = phi i8* [ null, %2 ], [ %88, %84 ]
%97 = phi i8* [ null, %2 ], [ %89, %84 ]
%98 = load i32, i32* @STDIN_FILENO
%99 = icmp eq i32 %94, %98
br i1 %99, label %100, label %103
100: ; preds = %92
%101 = load i32, i32* @STDERR_FILENO
%102 = tail call i32 (i32, ...) @write(i32 %101, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i32 14)
br label %330
103: ; preds = %92
%104 = tail call dereferenceable_or_null(256) i8* @malloc(i32 256)
%105 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %104, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* %96)
%106 = icmp eq i8* %97, null
br i1 %106, label %109, label %107
107: ; preds = %103
%108 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %104, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i8* %104, i8* %97)
br label %109
109: ; preds = %107, %103
%110 = icmp ult i32 %93, 4
br i1 %110, label %111, label %116
111: ; preds = %109
%112 = sext i32 %93 to i64
%113 = shl i64 %112, 2
%114 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.main to i8*), i64 %113)
%115 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %104, i8* dereferenceable(1) %114, i8* %104)
br label %116
116: ; preds = %109, %111
%117 = tail call i32 @strlen(i8* %104)
%118 = tail call i32 (i32, ...) @write(i32 %95, i8* %104, i32 %117)
%119 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%120 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%121 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%122 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%123 = call i32 @inic(i32* %119, i32* %120, i32* %121, i32* %122, i32 %93)
switch i32 %123, label %157 [
i32 1, label %130
i32 2, label %127
i32 3, label %124
]
124: ; preds = %116
%125 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%126 = getelementptr inbounds [768 x i64], [768 x i64]* %7, i64 0, i64 0
br label %149
127: ; preds = %116
%128 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%129 = getelementptr inbounds [768 x i64], [768 x i64]* %7, i64 0, i64 0
br label %141
130: ; preds = %116
%131 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%132 = getelementptr inbounds [768 x i64], [768 x i64]* %7, i64 0, i64 0
br label %133
133: ; preds = %130, %137
%134 = load i32, i32* %119
%135 = call i32 @read(i32 %134, i64* %132, i32 768)
%136 = icmp sgt i32 %135, 0
br i1 %136, label %137, label %330
137: ; preds = %133
%138 = load i32, i32* %131
%139 = call i32 @analize(i32 1, i32 %138, i32 %135, i64* %132)
%140 = icmp eq i32 %139, 0
br i1 %140, label %133, label %330
141: ; preds = %127, %145
%142 = load i32, i32* %120
%143 = call i32 @read(i32 %142, i64* %129, i32 768)
%144 = icmp sgt i32 %143, 0
br i1 %144, label %145, label %330
145: ; preds = %141
%146 = load i32, i32* %128
%147 = call i32 @analize(i32 2, i32 %146, i32 %143, i64* %129)
%148 = icmp eq i32 %147, 0
br i1 %148, label %141, label %330
149: ; preds = %124, %153
%150 = load i32, i32* %121
%151 = call i32 @read(i32 %150, i64* %126, i32 768)
%152 = icmp sgt i32 %151, 0
br i1 %152, label %153, label %330
153: ; preds = %149
%154 = load i32, i32* %125
%155 = call i32 @analize(i32 3, i32 %154, i32 %151, i64* %126)
%156 = icmp eq i32 %155, 0
br i1 %156, label %149, label %330
157: ; preds = %116
%158 = bitcast [257 x i64]* %8 to i8*
%159 = getelementptr inbounds [50 x i8], [50 x i8]* %9, i64 0, i64 0
%160 = bitcast i32* %12 to i8*
%161 = getelementptr inbounds [768 x i64], [768 x i64]* %7, i64 0, i64 0
%162 = call i32 @read(i32 %94, i64* %161, i32 768)
%163 = icmp sgt i32 %162, 0
br i1 %163, label %164, label %243
164: ; preds = %157
%165 = icmp ult i32 %93, 2
%166 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%167 = and i32 %93, -3
%168 = icmp eq i32 %167, 0
%169 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%170 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
%171 = icmp eq i32 %93, 0
%172 = getelementptr inbounds [257 x i64], [257 x i64]* %8, i64 0, i64 0
br label %176
173: ; preds = %239
%174 = call i32 @read(i32 %94, i64* %161, i32 768)
%175 = icmp sgt i32 %174, 0
br i1 %175, label %176, label %243
176: ; preds = %164, %173
%177 = phi i32 [ %162, %164 ], [ %174, %173 ]
br i1 %165, label %178, label %181
178: ; preds = %176
%179 = load i32, i32* %166
%180 = call i32 (i32, ...) @write(i32 %179, i64* %161, i32 %177)
br label %181
181: ; preds = %176, %178
br i1 %168, label %182, label %185
182: ; preds = %181
%183 = load i32, i32* %169
%184 = call i32 (i32, ...) @write(i32 %183, i64* %161, i32 %177)
br label %185
185: ; preds = %181, %182
switch i32 %93, label %189 [
i32 3, label %186
i32 0, label %186
]
186: ; preds = %185, %185
%187 = load i32, i32* %170
%188 = call i32 (i32, ...) @write(i32 %187, i64* %161, i32 %177)
br label %189
189: ; preds = %185, %186
br label %190
190: ; preds = %189, %239
%191 = phi i32 [ %241, %239 ], [ 0, %189 ]
%192 = add nsw i32 %191, 2
%193 = load i32, i32* %122
%194 = call i32 @read(i32 %193, i64* %172, i32 257)
%195 = load i64, i64* %172
br label %196
196: ; preds = %196, %190
%197 = phi i64 [ 0, %190 ], [ %237, %196 ]
%198 = or i64 %197, 1
%199 = getelementptr inbounds [257 x i64], [257 x i64]* %8, i64 0, i64 %198
%200 = bitcast i64* %199 to <2 x i64>*
%201 = load <2 x i64>, <2 x i64>* %200
%202 = getelementptr inbounds i64, i64* %199, i64 2
%203 = bitcast i64* %202 to <2 x i64>*
%204 = load <2 x i64>, <2 x i64>* %203
%205 = trunc <2 x i64> %201 to <2 x i32>
%206 = trunc <2 x i64> %204 to <2 x i32>
%207 = getelementptr inbounds [3 x [256 x i32]], [3 x [256 x i32]]* %10, i64 0, i64 %195, i64 %197
%208 = bitcast i32* %207 to <2 x i32>*
%209 = load <2 x i32>, <2 x i32>* %208
%210 = getelementptr inbounds i32, i32* %207, i64 2
%211 = bitcast i32* %210 to <2 x i32>*
%212 = load <2 x i32>, <2 x i32>* %211
%213 = add nsw <2 x i32> %209, %205
%214 = add nsw <2 x i32> %212, %206
%215 = bitcast i32* %207 to <2 x i32>*
store <2 x i32> %213, <2 x i32>* %215
%216 = bitcast i32* %210 to <2 x i32>*
store <2 x i32> %214, <2 x i32>* %216
%217 = or i64 %197, 4
%218 = or i64 %197, 5
%219 = getelementptr inbounds [257 x i64], [257 x i64]* %8, i64 0, i64 %218
%220 = bitcast i64* %219 to <2 x i64>*
%221 = load <2 x i64>, <2 x i64>* %220
%222 = getelementptr inbounds i64, i64* %219, i64 2
%223 = bitcast i64* %222 to <2 x i64>*
%224 = load <2 x i64>, <2 x i64>* %223
%225 = trunc <2 x i64> %221 to <2 x i32>
%226 = trunc <2 x i64> %224 to <2 x i32>
%227 = getelementptr inbounds [3 x [256 x i32]], [3 x [256 x i32]]* %10, i64 0, i64 %195, i64 %217
%228 = bitcast i32* %227 to <2 x i32>*
%229 = load <2 x i32>, <2 x i32>* %228
%230 = getelementptr inbounds i32, i32* %227, i64 2
%231 = bitcast i32* %230 to <2 x i32>*
%232 = load <2 x i32>, <2 x i32>* %231
%233 = add nsw <2 x i32> %229, %225
%234 = add nsw <2 x i32> %232, %226
%235 = bitcast i32* %227 to <2 x i32>*
store <2 x i32> %233, <2 x i32>* %235
%236 = bitcast i32* %230 to <2 x i32>*
store <2 x i32> %234, <2 x i32>* %236
%237 = add nuw nsw i64 %197, 8
%238 = icmp eq i64 %237, 256
br i1 %238, label %239, label %196
239: ; preds = %196
%240 = select i1 %171, i32 %191, i32 %192
%241 = add nsw i32 %240, 1
%242 = icmp slt i32 %240, 2
br i1 %242, label %190, label %173
243: ; preds = %173, %157
%244 = icmp ult i32 %93, 2
br i1 %244, label %245, label %249
245: ; preds = %243
%246 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%247 = load i32, i32* %246
%248 = call i32 @close(i32 %247)
br label %249
249: ; preds = %243, %245
%250 = and i32 %93, -3
%251 = icmp eq i32 %250, 0
br i1 %251, label %252, label %256
252: ; preds = %249
%253 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%254 = load i32, i32* %253
%255 = call i32 @close(i32 %254)
br label %256
256: ; preds = %249, %252
switch i32 %93, label %261 [
i32 3, label %257
i32 0, label %257
]
257: ; preds = %256, %256
%258 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
%259 = load i32, i32* %258
%260 = call i32 @close(i32 %259)
br label %261
261: ; preds = %256, %257
%262 = icmp eq i32 %93, 0
br label %263
263: ; preds = %261, %281
%264 = phi i32 [ 0, %261 ], [ %282, %281 ]
%265 = add nsw i32 %264, 2
%266 = select i1 %262, i32 %264, i32 %265
%267 = call i32 @wait(i32* %12)
%268 = load i32, i32* %12
%269 = call i64 @WIFEXITED(i32 %268)
%270 = icmp eq i64 %269, 0
br i1 %270, label %278, label %271
271: ; preds = %263
%272 = load i32, i32* %12
%273 = call i64 @WEXITSTATUS(i32 %272)
%274 = icmp eq i64 %273, 0
br i1 %274, label %281, label %275
275: ; preds = %271
%276 = load i32, i32* @STDERR_FILENO
%277 = call i32 (i32, ...) @write(i32 %276, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.16, i64 0, i64 0), i32 23)
br label %281
278: ; preds = %263
%279 = load i32, i32* @STDERR_FILENO
%280 = call i32 (i32, ...) @write(i32 %279, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.17, i64 0, i64 0), i32 17)
br label %281
281: ; preds = %278, %275, %271
%282 = add nsw i32 %266, 1
%283 = icmp slt i32 %266, 1
br i1 %283, label %263, label %284
284: ; preds = %281
switch i32 %93, label %329 [
i32 0, label %285
i32 1, label %299
i32 2, label %309
i32 3, label %319
]
285: ; preds = %284, %285
%286 = phi i64 [ %297, %285 ], [ 0, %284 ]
%287 = getelementptr inbounds [3 x [256 x i32]], [3 x [256 x i32]]* %10, i64 0, i64 0, i64 %286
%288 = load i32, i32* %287
%289 = getelementptr inbounds [3 x [256 x i32]], [3 x [256 x i32]]* %10, i64 0, i64 1, i64 %286
%290 = load i32, i32* %289
%291 = getelementptr inbounds [3 x [256 x i32]], [3 x [256 x i32]]* %10, i64 0, i64 2, i64 %286
%292 = load i32, i32* %291
%293 = trunc i64 %286 to i32
%294 = call i32 (i8*, i8*, ...) @sprintf(i8* %159, i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.18, i64 0, i64 0), i32 %293, i32 %288, i32 %293, i32 %290, i32 %293, i32 %292)
%295 = call i32 @strlen(i8* %159)
%296 = call i32 (i32, ...) @write(i32 %95, i8* %159, i32 %295)
%297 = add nuw nsw i64 %286, 1
%298 = icmp eq i64 %297, 256
br i1 %298, label %329, label %285
299: ; preds = %284, %299
%300 = phi i64 [ %307, %299 ], [ 0, %284 ]
%301 = getelementptr inbounds [3 x [256 x i32]], [3 x [256 x i32]]* %10, i64 0, i64 0, i64 %300
%302 = load i32, i32* %301
%303 = trunc i64 %300 to i32
%304 = call i32 (i8*, i8*, ...) @sprintf(i8* %159, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.19, i64 0, i64 0), i32 %303, i32 %302)
%305 = call i32 @strlen(i8* %159)
%306 = call i32 (i32, ...) @write(i32 %95, i8* %159, i32 %305)
%307 = add nuw nsw i64 %300, 1
%308 = icmp eq i64 %307, 256
br i1 %308, label %329, label %299
309: ; preds = %284, %309
%310 = phi i64 [ %317, %309 ], [ 0, %284 ]
%311 = getelementptr inbounds [3 x [256 x i32]], [3 x [256 x i32]]* %10, i64 0, i64 1, i64 %310
%312 = load i32, i32* %311
%313 = trunc i64 %310 to i32
%314 = call i32 (i8*, i8*, ...) @sprintf(i8* %159, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.20, i64 0, i64 0), i32 %313, i32 %312)
%315 = call i32 @strlen(i8* %159)
%316 = call i32 (i32, ...) @write(i32 %95, i8* %159, i32 %315)
%317 = add nuw nsw i64 %310, 1
%318 = icmp eq i64 %317, 256
br i1 %318, label %329, label %309
319: ; preds = %284, %319
%320 = phi i64 [ %327, %319 ], [ 0, %284 ]
%321 = getelementptr inbounds [3 x [256 x i32]], [3 x [256 x i32]]* %10, i64 0, i64 2, i64 %320
%322 = load i32, i32* %321
%323 = trunc i64 %320 to i32
%324 = call i32 (i8*, i8*, ...) @sprintf(i8* %159, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.21, i64 0, i64 0), i32 %323, i32 %322)
%325 = call i32 @strlen(i8* %159)
%326 = call i32 (i32, ...) @write(i32 %95, i8* %159, i32 %325)
%327 = add nuw nsw i64 %320, 1
%328 = icmp eq i64 %327, 256
br i1 %328, label %329, label %319
329: ; preds = %319, %309, %299, %285, %284
br label %330
330: ; preds = %149, %153, %141, %145, %133, %137, %329, %100, %73, %70, %52, %41, %29
%331 = phi i32 [ -2, %73 ], [ -3, %70 ], [ -3, %52 ], [ -3, %41 ], [ 0, %29 ], [ -4, %100 ], [ 0, %329 ], [ 0, %133 ], [ -1, %137 ], [ 0, %141 ], [ -1, %145 ], [ 0, %149 ], [ -1, %153 ]
ret i32 %331
}