#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*/ optbuf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int atoi(char *);
int bl_u_pocpx(int, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(unsigned char *);
int fscanf(int /*<<< orphan*/ *, char *, int *, ...);
char getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ izvadi_blok(int, int, int, unsigned char *, unsigned char *);
int /*<<< orphan*/ izvadi_blok_px(int, unsigned char *, unsigned char *);
double mad(unsigned char *, unsigned char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ ungetc(char, int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  FILE *in1 = fopen("lenna1.pgm", "r");
  FILE *in2 = fopen("lenna.pgm", "r");
  unsigned char *buf1;
  unsigned char *buf2;
  char optbuf[16];
  char c;
  unsigned char *blok1 =
      (unsigned char *)malloc(16 * 16 * sizeof(unsigned char));
  unsigned char *blok2 =
      (unsigned char *)malloc(16 * 16 * sizeof(unsigned char));
  int m, n;
  int comp;
  int i;
  int j;
  int blok_x = atoi(argv[1]);
  double razlika_min;
  int prviput = 1;
  int najsl;
  if (argc != 2) {
    printf("Neispravan poziv programa\n");
    return 1;
  }
  if (!in1) {
    printf("Nije moguce otvoriti sliku lenna1.pgm\n");
    return 1;
  }
  if (!in2) {
    printf("Nije moguce otvoriti sliku lenna.pgm\n");
    return 1;
  }
  fgets(optbuf, sizeof(optbuf), in1);
  if (optbuf[0] != 'P' || optbuf[1] != '5') {
    printf("Format mora biti P5\n");
    return 1;
  }
  fgets(optbuf, sizeof(optbuf), in2);
  if (optbuf[0] != 'P' || optbuf[1] != '5') {
    printf("Format mora biti P5\n");
    return 1;
  }
  c = getc(in1);
  while (c == '#') {
    while (getc(in1) != '\n')
      ;
    c = getc(in1);
  }
  ungetc(c, in1);
  c = getc(in2);
  while (c == '#') {
    while (getc(in2) != '\n')
      ;
    c = getc(in2);
  }
  ungetc(c, in2);
  if (fscanf(in1, "%d %d", &m, &n) != 2) {
    printf("Nepravilna velicina slike\n");
    return 1;
  }
  buf1 = (unsigned char *)malloc(m * n * sizeof(unsigned char));
  if (fscanf(in2, "%d %d", &m, &n) != 2) {
    printf("Nepravilna velicina slike\n");
    return 1;
  }
  buf2 = (unsigned char *)malloc(m * n * sizeof(unsigned char));
  if (fscanf(in1, "%d", &comp) != 1) {
    printf("Nemoguce ucitati dubinu komponente\n");
    return 1;
  }
  if (comp != 255) {
    printf("Nepravilna dubina komponente\n");
    return 1;
  }
  if (fscanf(in2, "%d", &comp) != 1) {
    printf("Nemoguce ucitati dubinu komponente\n");
    return 1;
  }
  if (comp != 255) {
    printf("Nepravilna dubina komponente\n");
    return 1;
  }
  fscanf(in1, "%d", &comp);
  fscanf(in2, "%d", &comp);
  fread(buf1, m, n, in1);
  fread(buf2, m, n, in2);
  izvadi_blok(blok_x, m, n, buf1, blok1);
  for (i = -16; i <= 16; i++) {
    for (j = -16; j <= 16; j++) {
      double razlika;
      int poc = bl_u_pocpx(blok_x, m);
      int za_usporedbu = poc + i * m + j;
      if (za_usporedbu < 0)
        continue;
      izvadi_blok_px(za_usporedbu, buf2, blok2);
      if (prviput) {
        prviput = !prviput;
        razlika_min = mad(blok1, blok2);
        najsl = poc + i * m + j;
      }
      razlika = mad(blok1, blok2);
      if (razlika < razlika_min) {
        razlika_min = razlika;
        najsl = poc + i * m + j;
      }
    }
  }
  printf("v_p: (%d, %d)\n", najsl % m - bl_u_pocpx(blok_x, m) % m,
         najsl / m - bl_u_pocpx(blok_x, m) / m);
  fclose(in1);
  fclose(in2);
  free(buf1);
  free(buf2);
  free(blok1);
  free(blok2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xdf0(%rip),%rdi
lea    0xdf4(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    0xde6(%rip),%rdi
lea    0xddd(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    $0x100,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    $0x100,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1100 <atoi@plt>
mov    %eax,-0x70(%rbp)
movl   $0x1,-0x7c(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     128e <main+0x9e>
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17ad <main+0x5bd>
cmpq   $0x0,-0x18(%rbp)
jne    12b3 <main+0xc3>
lea    0xd92(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17ad <main+0x5bd>
cmpq   $0x0,-0x20(%rbp)
jne    12d8 <main+0xe8>
lea    0xd94(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17ad <main+0x5bd>
lea    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x10,%esi
call   10b0 <fgets@plt>
movsbl -0x40(%rbp),%eax
cmp    $0x50,%eax
jne    1304 <main+0x114>
movsbl -0x3f(%rbp),%eax
cmp    $0x35,%eax
je     131e <main+0x12e>
lea    0xd74(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17ad <main+0x5bd>
lea    -0x40(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    $0x10,%esi
call   10b0 <fgets@plt>
movsbl -0x40(%rbp),%eax
cmp    $0x50,%eax
jne    134a <main+0x15a>
movsbl -0x3f(%rbp),%eax
cmp    $0x35,%eax
je     1364 <main+0x174>
lea    0xd2e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17ad <main+0x5bd>
mov    -0x18(%rbp),%rdi
call   1110 <getc@plt>
mov    %al,-0x41(%rbp)
movsbl -0x41(%rbp),%eax
cmp    $0x23,%eax
jne    13ad <main+0x1bd>
jmp    1382 <main+0x192>
mov    -0x18(%rbp),%rdi
call   1110 <getc@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     139c <main+0x1ac>
jmp    1382 <main+0x192>
mov    -0x18(%rbp),%rdi
call   1110 <getc@plt>
mov    %al,-0x41(%rbp)
jmp    1370 <main+0x180>
mov    -0x41(%rbp),%al
mov    -0x18(%rbp),%rsi
movsbl %al,%edi
call   10e0 <ungetc@plt>
mov    -0x20(%rbp),%rdi
call   1110 <getc@plt>
mov    %al,-0x41(%rbp)
movsbl -0x41(%rbp),%eax
cmp    $0x23,%eax
jne    1405 <main+0x215>
jmp    13da <main+0x1ea>
mov    -0x20(%rbp),%rdi
call   1110 <getc@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     13f4 <main+0x204>
jmp    13da <main+0x1ea>
mov    -0x20(%rbp),%rdi
call   1110 <getc@plt>
mov    %al,-0x41(%rbp)
jmp    13c8 <main+0x1d8>
mov    -0x41(%rbp),%al
mov    -0x20(%rbp),%rsi
movsbl %al,%edi
call   10e0 <ungetc@plt>
mov    -0x18(%rbp),%rdi
lea    0xc75(%rip),%rsi
lea    -0x5c(%rbp),%rdx
lea    -0x60(%rbp),%rcx
mov    $0x0,%al
call   10a0 <fscanf@plt>
cmp    $0x2,%eax
je     1451 <main+0x261>
lea    0xc5c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17ad <main+0x5bd>
mov    -0x5c(%rbp),%eax
imul   -0x60(%rbp),%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xc20(%rip),%rsi
lea    -0x5c(%rbp),%rdx
lea    -0x60(%rbp),%rcx
mov    $0x0,%al
call   10a0 <fscanf@plt>
cmp    $0x2,%eax
je     14a6 <main+0x2b6>
lea    0xc07(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17ad <main+0x5bd>
mov    -0x5c(%rbp),%eax
imul   -0x60(%rbp),%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xbce(%rip),%rsi
lea    -0x64(%rbp),%rdx
mov    $0x0,%al
call   10a0 <fscanf@plt>
cmp    $0x1,%eax
je     14f7 <main+0x307>
lea    0xbd1(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17ad <main+0x5bd>
cmpl   $0xff,-0x64(%rbp)
je     151e <main+0x32e>
lea    0xbce(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17ad <main+0x5bd>
mov    -0x20(%rbp),%rdi
lea    0xb6e(%rip),%rsi
lea    -0x64(%rbp),%rdx
mov    $0x0,%al
call   10a0 <fscanf@plt>
cmp    $0x1,%eax
je     1557 <main+0x367>
lea    0xb71(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17ad <main+0x5bd>
cmpl   $0xff,-0x64(%rbp)
je     157e <main+0x38e>
lea    0xb6e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    17ad <main+0x5bd>
mov    -0x18(%rbp),%rdi
lea    0xb0e(%rip),%rsi
lea    -0x64(%rbp),%rdx
mov    $0x0,%al
call   10a0 <fscanf@plt>
mov    -0x20(%rbp),%rdi
lea    0xaf8(%rip),%rsi
lea    -0x64(%rbp),%rdx
mov    $0x0,%al
call   10a0 <fscanf@plt>
mov    -0x28(%rbp),%rdi
mov    -0x5c(%rbp),%esi
mov    -0x60(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1050 <fread@plt>
mov    -0x30(%rbp),%rdi
mov    -0x5c(%rbp),%esi
mov    -0x60(%rbp),%edx
mov    -0x20(%rbp),%rcx
call   1050 <fread@plt>
mov    -0x70(%rbp),%edi
mov    -0x5c(%rbp),%esi
mov    -0x60(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x50(%rbp),%r8
call   10c0 <izvadi_blok@plt>
movl   $0xfffffff0,-0x68(%rbp)
cmpl   $0x10,-0x68(%rbp)
jg     170c <main+0x51c>
movl   $0xfffffff0,-0x6c(%rbp)
cmpl   $0x10,-0x6c(%rbp)
jg     16f9 <main+0x509>
mov    -0x70(%rbp),%edi
mov    -0x5c(%rbp),%esi
call   1040 <bl_u_pocpx@plt>
mov    %eax,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
mov    -0x68(%rbp),%ecx
imul   -0x5c(%rbp),%ecx
add    %ecx,%eax
add    -0x6c(%rbp),%eax
mov    %eax,-0x90(%rbp)
cmpl   $0x0,-0x90(%rbp)
jge    1643 <main+0x453>
jmp    16eb <main+0x4fb>
mov    -0x90(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    -0x58(%rbp),%rdx
call   1090 <izvadi_blok_px@plt>
cmpl   $0x0,-0x7c(%rbp)
je     1698 <main+0x4a8>
cmpl   $0x0,-0x7c(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x7c(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
call   1080 <mad@plt>
movsd  %xmm0,-0x78(%rbp)
mov    -0x8c(%rbp),%eax
mov    -0x68(%rbp),%ecx
imul   -0x5c(%rbp),%ecx
add    %ecx,%eax
add    -0x6c(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
call   1080 <mad@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x78(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    16e6 <main+0x4f6>
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x78(%rbp)
mov    -0x8c(%rbp),%eax
mov    -0x68(%rbp),%ecx
imul   -0x5c(%rbp),%ecx
add    %ecx,%eax
add    -0x6c(%rbp),%eax
mov    %eax,-0x80(%rbp)
jmp    16eb <main+0x4fb>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    15fe <main+0x40e>
jmp    16fe <main+0x50e>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    15ed <main+0x3fd>
mov    -0x80(%rbp),%eax
cltd
idivl  -0x5c(%rbp)
mov    %edx,-0x9c(%rbp)
mov    -0x70(%rbp),%edi
mov    -0x5c(%rbp),%esi
call   1040 <bl_u_pocpx@plt>
cltd
idivl  -0x5c(%rbp)
mov    %edx,%eax
mov    -0x9c(%rbp),%edx
sub    %eax,%edx
mov    %edx,-0x98(%rbp)
mov    -0x80(%rbp),%eax
cltd
idivl  -0x5c(%rbp)
mov    %eax,-0x94(%rbp)
mov    -0x70(%rbp),%edi
mov    -0x5c(%rbp),%esi
call   1040 <bl_u_pocpx@plt>
mov    -0x98(%rbp),%esi
cltd
idivl  -0x5c(%rbp)
mov    -0x94(%rbp),%edx
sub    %eax,%edx
lea    0x98e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x20(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%rbx
mov    %edi,%r14d
lea    0xe17(%rip),%rdi
lea    0xdde(%rip),%rbp
mov    %rbp,%rsi
call   1100 <fopen@plt>
mov    %rax,%r12
lea    0xe24(%rip),%rdi
mov    %rbp,%rsi
call   1100 <fopen@plt>
mov    %rax,%rbp
mov    $0x100,%edi
call   10e0 <malloc@plt>
mov    %rax,%r15
mov    $0x100,%edi
call   10e0 <malloc@plt>
mov    %rax,%r13
mov    0x8(%rbx),%rdi
call   1110 <atoi@plt>
cmp    $0x2,%r14d
jne    12da <main+0xda>
test   %r12,%r12
je     12e6 <main+0xe6>
test   %rbp,%rbp
je     12fe <main+0xfe>
mov    %eax,%ebx
lea    0x20(%rsp),%rdi
mov    $0x10,%esi
mov    %r12,%rdx
call   10c0 <fgets@plt>
cmpb   $0x50,0x20(%rsp)
jne    12f2 <main+0xf2>
cmpb   $0x35,0x21(%rsp)
jne    12f2 <main+0xf2>
lea    0x20(%rsp),%rdi
mov    $0x10,%esi
mov    %rbp,%rdx
call   10c0 <fgets@plt>
cmpb   $0x50,0x20(%rsp)
jne    12f2 <main+0xf2>
cmpb   $0x35,0x21(%rsp)
jne    12f2 <main+0xf2>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1120 <getc@plt>
cmp    $0x23,%al
jne    130a <main+0x10a>
mov    %r12,%rdi
call   1120 <getc@plt>
cmp    $0xa,%al
jne    12cc <main+0xcc>
jmp    12c0 <main+0xc0>
lea    0xdef(%rip),%rdi
jmp    14b6 <main+0x2b6>
lea    0xd2a(%rip),%rdi
jmp    14b6 <main+0x2b6>
lea    0xdc3(%rip),%rdi
jmp    14b6 <main+0x2b6>
lea    0xd38(%rip),%rdi
jmp    14b6 <main+0x2b6>
movsbl %al,%edi
mov    %r12,%rsi
call   10f0 <ungetc@plt>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbp,%rdi
call   1120 <getc@plt>
cmp    $0x23,%al
jne    133a <main+0x13a>
mov    %rbp,%rdi
call   1120 <getc@plt>
cmp    $0xa,%al
jne    132c <main+0x12c>
jmp    1320 <main+0x120>
movsbl %al,%edi
mov    %rbp,%rsi
call   10f0 <ungetc@plt>
lea    0xcb6(%rip),%rsi
lea    0x8(%rsp),%rdx
lea    0xc(%rsp),%rcx
mov    %r12,%rdi
xor    %eax,%eax
call   10b0 <fscanf@plt>
cmp    $0x2,%eax
jne    14af <main+0x2af>
mov    0xc(%rsp),%edi
imul   0x8(%rsp),%edi
call   10e0 <malloc@plt>
mov    %rax,%r14
lea    0xc81(%rip),%rsi
lea    0x8(%rsp),%rdx
lea    0xc(%rsp),%rcx
mov    %rbp,%rdi
xor    %eax,%eax
call   10b0 <fscanf@plt>
cmp    $0x2,%eax
jne    14af <main+0x2af>
mov    %r14,0x38(%rsp)
mov    0xc(%rsp),%edi
imul   0x8(%rsp),%edi
call   10e0 <malloc@plt>
mov    %rax,%r14
lea    0xc4a(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    %r12,%rdi
xor    %eax,%eax
call   10b0 <fscanf@plt>
cmp    $0x1,%eax
jne    1590 <main+0x390>
mov    %r14,0x18(%rsp)
cmpl   $0xff,0x10(%rsp)
jne    159c <main+0x39c>
lea    0xc18(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    %rbp,%rdi
xor    %eax,%eax
call   10b0 <fscanf@plt>
cmp    $0x1,%eax
jne    1590 <main+0x390>
cmpl   $0xff,0x10(%rsp)
jne    159c <main+0x39c>
mov    %r13,0x40(%rsp)
mov    0x38(%rsp),%r13
lea    0xbe1(%rip),%r14
mov    %ebx,0x14(%rsp)
lea    0x10(%rsp),%rbx
mov    %r12,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10b0 <fscanf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    0x14(%rsp),%ebx
xor    %eax,%eax
call   10b0 <fscanf@plt>
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
mov    %r13,%rdi
mov    %r12,0x60(%rsp)
mov    %r12,%rcx
call   1060 <fread@plt>
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
mov    0x18(%rsp),%rdi
mov    %rbp,0x58(%rsp)
mov    %rbp,%rcx
call   1060 <fread@plt>
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
mov    %ebx,%edi
mov    %r13,%rcx
mov    %r15,0x48(%rsp)
mov    %r15,%r8
call   10d0 <izvadi_blok@plt>
mov    $0x1,%r12d
mov    $0xfffffff0,%r15d
mov    0x8(%rsp),%esi
jmp    14df <main+0x2df>
lea    0xbec(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
add    $0x1,%r15d
cmp    $0x11,%r15d
je     15a8 <main+0x3a8>
mov    $0xfffffff0,%ebp
jmp    1532 <main+0x332>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r12,%rsi
call   1090 <mad@plt>
mov    0x8(%rsp),%esi
mov    %r15d,%eax
imul   %esi,%eax
add    %eax,%r14d
add    %ebp,%r14d
movsd  0x50(%rsp),%xmm1
ucomisd %xmm0,%xmm1
minsd  %xmm1,%xmm0
cmova  %r14d,%r13d
xor    %r12d,%r12d
movsd  %xmm0,0x50(%rsp)
mov    0x14(%rsp),%ebx
add    $0x1,%ebp
cmp    $0x11,%ebp
je     14d1 <main+0x2d1>
mov    %ebx,%edi
call   1040 <bl_u_pocpx@plt>
mov    0x8(%rsp),%esi
mov    %r15d,%edi
imul   %esi,%edi
add    %eax,%edi
add    %ebp,%edi
js     152a <main+0x32a>
mov    %eax,%r14d
mov    0x18(%rsp),%rsi
mov    0x40(%rsp),%rbx
mov    %rbx,%rdx
call   10a0 <izvadi_blok_px@plt>
test   %r12d,%r12d
mov    %rbx,%r12
mov    0x48(%rsp),%rbx
je     14f0 <main+0x2f0>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1090 <mad@plt>
movsd  %xmm0,0x50(%rsp)
mov    0x8(%rsp),%r13d
imul   %r15d,%r13d
add    %r14d,%r13d
add    %ebp,%r13d
jmp    14f0 <main+0x2f0>
lea    0xae8(%rip),%rdi
jmp    14b6 <main+0x2b6>
lea    0xabf(%rip),%rdi
jmp    14b6 <main+0x2b6>
mov    %r13d,%eax
cltd
idiv   %esi
mov    %edx,%r14d
mov    %ebx,%edi
call   1040 <bl_u_pocpx@plt>
mov    0x8(%rsp),%esi
cltd
idiv   %esi
sub    %edx,%r14d
mov    %r13d,%eax
cltd
idiv   %esi
mov    %ebx,%edi
mov    %eax,%ebx
call   1040 <bl_u_pocpx@plt>
cltd
idivl  0x8(%rsp)
sub    %eax,%ebx
lea    0xa29(%rip),%rdi
xor    %ebp,%ebp
mov    %r14d,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x60(%rsp),%rdi
call   1070 <fclose@plt>
mov    0x58(%rsp),%rdi
call   1070 <fclose@plt>
mov    0x38(%rsp),%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    0x48(%rsp),%rdi
call   1030 <free@plt>
mov    0x40(%rsp),%rdi
call   1030 <free@plt>
jmp    14c0 <main+0x2c0>

LLVM IR (-O0):
@.str = [11 x i8] c"lenna1.pgm\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [10 x i8] c"lenna.pgm\00"
@.str.3 = [27 x i8] c"Neispravan poziv programa\0A\00"
@.str.4 = [39 x i8] c"Nije moguce otvoriti sliku lenna1.pgm\0A\00"
@.str.5 = [38 x i8] c"Nije moguce otvoriti sliku lenna.pgm\0A\00"
@.str.6 = [21 x i8] c"Format mora biti P5\0A\00"
@.str.7 = [6 x i8] c"%d %d\00"
@.str.8 = [27 x i8] c"Nepravilna velicina slike\0A\00"
@.str.9 = [3 x i8] c"%d\00"
@.str.10 = [36 x i8] c"Nemoguce ucitati dubinu komponente\0A\00"
@.str.11 = [30 x i8] c"Nepravilna dubina komponente\0A\00"
@.str.12 = [15 x i8] c"v_p: (%d, %d)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca [16 x i8]
%11 = alloca i8
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca double
%21 = alloca i32
%22 = alloca i32
%23 = alloca double
%24 = alloca i32
%25 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%26 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %26, i32** %6
%27 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %27, i32** %7
%28 = call i64 @malloc(i32 256)
%29 = inttoptr i64 %28 to i8*
store i8* %29, i8** %12
%30 = call i64 @malloc(i32 256)
%31 = inttoptr i64 %30 to i8*
store i8* %31, i8** %13
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i32 @atoi(i8* %34)
store i32 %35, i32* %19
store i32 1, i32* %21
%36 = load i32, i32* %4
%37 = icmp ne i32 %36, 2
br i1 %37, label %38, label %40
38: ; preds = %2
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %290
40: ; preds = %2
%41 = load i32*, i32** %6
%42 = icmp ne i32* %41, null
br i1 %42, label %45, label %43
43: ; preds = %40
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %290
45: ; preds = %40
%46 = load i32*, i32** %7
%47 = icmp ne i32* %46, null
br i1 %47, label %50, label %48
48: ; preds = %45
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %3
br label %290
50: ; preds = %45
%51 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%52 = load i32*, i32** %6
%53 = call i32 @fgets(i8* %51, i32 16, i32* %52)
%54 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp ne i32 %56, 80
br i1 %57, label %63, label %58
58: ; preds = %50
%59 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 1
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = icmp ne i32 %61, 53
br i1 %62, label %63, label %65
63: ; preds = %58, %50
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %3
br label %290
65: ; preds = %58
%66 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%67 = load i32*, i32** %7
%68 = call i32 @fgets(i8* %66, i32 16, i32* %67)
%69 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 0
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = icmp ne i32 %71, 80
br i1 %72, label %78, label %73
73: ; preds = %65
%74 = getelementptr inbounds [16 x i8], [16 x i8]* %10, i64 0, i64 1
%75 = load i8, i8* %74
%76 = sext i8 %75 to i32
%77 = icmp ne i32 %76, 53
br i1 %77, label %78, label %80
78: ; preds = %73, %65
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %3
br label %290
80: ; preds = %73
%81 = load i32*, i32** %6
%82 = call signext i8 @getc(i32* %81)
store i8 %82, i8* %11
br label %83
83: ; preds = %94, %80
%84 = load i8, i8* %11
%85 = sext i8 %84 to i32
%86 = icmp eq i32 %85, 35
br i1 %86, label %87, label %97
87: ; preds = %83
br label %88
88: ; preds = %93, %87
%89 = load i32*, i32** %6
%90 = call signext i8 @getc(i32* %89)
%91 = sext i8 %90 to i32
%92 = icmp ne i32 %91, 10
br i1 %92, label %93, label %94
93: ; preds = %88
br label %88
94: ; preds = %88
%95 = load i32*, i32** %6
%96 = call signext i8 @getc(i32* %95)
store i8 %96, i8* %11
br label %83
97: ; preds = %83
%98 = load i8, i8* %11
%99 = load i32*, i32** %6
%100 = call i32 @ungetc(i8 signext %98, i32* %99)
%101 = load i32*, i32** %7
%102 = call signext i8 @getc(i32* %101)
store i8 %102, i8* %11
br label %103
103: ; preds = %114, %97
%104 = load i8, i8* %11
%105 = sext i8 %104 to i32
%106 = icmp eq i32 %105, 35
br i1 %106, label %107, label %117
107: ; preds = %103
br label %108
108: ; preds = %113, %107
%109 = load i32*, i32** %7
%110 = call signext i8 @getc(i32* %109)
%111 = sext i8 %110 to i32
%112 = icmp ne i32 %111, 10
br i1 %112, label %113, label %114
113: ; preds = %108
br label %108
114: ; preds = %108
%115 = load i32*, i32** %7
%116 = call signext i8 @getc(i32* %115)
store i8 %116, i8* %11
br label %103
117: ; preds = %103
%118 = load i8, i8* %11
%119 = load i32*, i32** %7
%120 = call i32 @ungetc(i8 signext %118, i32* %119)
%121 = load i32*, i32** %6
%122 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %121, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32* %14, i32* %15)
%123 = icmp ne i32 %122, 2
br i1 %123, label %124, label %126
124: ; preds = %117
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %3
br label %290
126: ; preds = %117
%127 = load i32, i32* %14
%128 = load i32, i32* %15
%129 = mul nsw i32 %127, %128
%130 = sext i32 %129 to i64
%131 = mul i64 %130, 1
%132 = trunc i64 %131 to i32
%133 = call i64 @malloc(i32 %132)
%134 = inttoptr i64 %133 to i8*
store i8* %134, i8** %8
%135 = load i32*, i32** %7
%136 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %135, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32* %14, i32* %15)
%137 = icmp ne i32 %136, 2
br i1 %137, label %138, label %140
138: ; preds = %126
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %3
br label %290
140: ; preds = %126
%141 = load i32, i32* %14
%142 = load i32, i32* %15
%143 = mul nsw i32 %141, %142
%144 = sext i32 %143 to i64
%145 = mul i64 %144, 1
%146 = trunc i64 %145 to i32
%147 = call i64 @malloc(i32 %146)
%148 = inttoptr i64 %147 to i8*
store i8* %148, i8** %9
%149 = load i32*, i32** %6
%150 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %149, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %16)
%151 = icmp ne i32 %150, 1
br i1 %151, label %152, label %154
152: ; preds = %140
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.10, i64 0, i64 0))
store i32 1, i32* %3
br label %290
154: ; preds = %140
%155 = load i32, i32* %16
%156 = icmp ne i32 %155, 255
br i1 %156, label %157, label %159
157: ; preds = %154
%158 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %3
br label %290
159: ; preds = %154
%160 = load i32*, i32** %7
%161 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %160, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %16)
%162 = icmp ne i32 %161, 1
br i1 %162, label %163, label %165
163: ; preds = %159
%164 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.10, i64 0, i64 0))
store i32 1, i32* %3
br label %290
165: ; preds = %159
%166 = load i32, i32* %16
%167 = icmp ne i32 %166, 255
br i1 %167, label %168, label %170
168: ; preds = %165
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %3
br label %290
170: ; preds = %165
%171 = load i32*, i32** %6
%172 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %171, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %16)
%173 = load i32*, i32** %7
%174 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %173, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %16)
%175 = load i8*, i8** %8
%176 = load i32, i32* %14
%177 = load i32, i32* %15
%178 = load i32*, i32** %6
%179 = call i32 @fread(i8* %175, i32 %176, i32 %177, i32* %178)
%180 = load i8*, i8** %9
%181 = load i32, i32* %14
%182 = load i32, i32* %15
%183 = load i32*, i32** %7
%184 = call i32 @fread(i8* %180, i32 %181, i32 %182, i32* %183)
%185 = load i32, i32* %19
%186 = load i32, i32* %14
%187 = load i32, i32* %15
%188 = load i8*, i8** %8
%189 = load i8*, i8** %12
%190 = call i32 @izvadi_blok(i32 %185, i32 %186, i32 %187, i8* %188, i8* %189)
store i32 -16, i32* %17
br label %191
191: ; preds = %255, %170
%192 = load i32, i32* %17
%193 = icmp sle i32 %192, 16
br i1 %193, label %194, label %258
194: ; preds = %191
store i32 -16, i32* %18
br label %195
195: ; preds = %251, %194
%196 = load i32, i32* %18
%197 = icmp sle i32 %196, 16
br i1 %197, label %198, label %254
198: ; preds = %195
%199 = load i32, i32* %19
%200 = load i32, i32* %14
%201 = call i32 @bl_u_pocpx(i32 %199, i32 %200)
store i32 %201, i32* %24
%202 = load i32, i32* %24
%203 = load i32, i32* %17
%204 = load i32, i32* %14
%205 = mul nsw i32 %203, %204
%206 = add nsw i32 %202, %205
%207 = load i32, i32* %18
%208 = add nsw i32 %206, %207
store i32 %208, i32* %25
%209 = load i32, i32* %25
%210 = icmp slt i32 %209, 0
br i1 %210, label %211, label %212
211: ; preds = %198
br label %251
212: ; preds = %198
%213 = load i32, i32* %25
%214 = load i8*, i8** %9
%215 = load i8*, i8** %13
%216 = call i32 @izvadi_blok_px(i32 %213, i8* %214, i8* %215)
%217 = load i32, i32* %21
%218 = icmp ne i32 %217, 0
br i1 %218, label %219, label %234
219: ; preds = %212
%220 = load i32, i32* %21
%221 = icmp ne i32 %220, 0
%222 = xor i1 %221, true
%223 = zext i1 %222 to i32
store i32 %223, i32* %21
%224 = load i8*, i8** %12
%225 = load i8*, i8** %13
%226 = call double @mad(i8* %224, i8* %225)
store double %226, double* %20
%227 = load i32, i32* %24
%228 = load i32, i32* %17
%229 = load i32, i32* %14
%230 = mul nsw i32 %228, %229
%231 = add nsw i32 %227, %230
%232 = load i32, i32* %18
%233 = add nsw i32 %231, %232
store i32 %233, i32* %22
br label %234
234: ; preds = %219, %212
%235 = load i8*, i8** %12
%236 = load i8*, i8** %13
%237 = call double @mad(i8* %235, i8* %236)
store double %237, double* %23
%238 = load double, double* %23
%239 = load double, double* %20
%240 = fcmp olt double %238, %239
br i1 %240, label %241, label %250
241: ; preds = %234
%242 = load double, double* %23
store double %242, double* %20
%243 = load i32, i32* %24
%244 = load i32, i32* %17
%245 = load i32, i32* %14
%246 = mul nsw i32 %244, %245
%247 = add nsw i32 %243, %246
%248 = load i32, i32* %18
%249 = add nsw i32 %247, %248
store i32 %249, i32* %22
br label %250
250: ; preds = %241, %234
br label %251
251: ; preds = %250, %211
%252 = load i32, i32* %18
%253 = add nsw i32 %252, 1
store i32 %253, i32* %18
br label %195
254: ; preds = %195
br label %255
255: ; preds = %254
%256 = load i32, i32* %17
%257 = add nsw i32 %256, 1
store i32 %257, i32* %17
br label %191
258: ; preds = %191
%259 = load i32, i32* %22
%260 = load i32, i32* %14
%261 = srem i32 %259, %260
%262 = load i32, i32* %19
%263 = load i32, i32* %14
%264 = call i32 @bl_u_pocpx(i32 %262, i32 %263)
%265 = load i32, i32* %14
%266 = srem i32 %264, %265
%267 = sub nsw i32 %261, %266
%268 = load i32, i32* %22
%269 = load i32, i32* %14
%270 = sdiv i32 %268, %269
%271 = load i32, i32* %19
%272 = load i32, i32* %14
%273 = call i32 @bl_u_pocpx(i32 %271, i32 %272)
%274 = load i32, i32* %14
%275 = sdiv i32 %273, %274
%276 = sub nsw i32 %270, %275
%277 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0), i32 %267, i32 %276)
%278 = load i32*, i32** %6
%279 = call i32 @fclose(i32* %278)
%280 = load i32*, i32** %7
%281 = call i32 @fclose(i32* %280)
%282 = load i8*, i8** %8
%283 = call i32 @free(i8* %282)
%284 = load i8*, i8** %9
%285 = call i32 @free(i8* %284)
%286 = load i8*, i8** %12
%287 = call i32 @free(i8* %286)
%288 = load i8*, i8** %13
%289 = call i32 @free(i8* %288)
store i32 0, i32* %3
br label %290
290: ; preds = %258, %168, %163, %157, %152, %138, %124, %78, %63, %48, %43, %38
%291 = load i32, i32* %3
ret i32 %291
}

LLVM IR (-O2):
@.str = [11 x i8] c"lenna1.pgm\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [10 x i8] c"lenna.pgm\00"
@.str.7 = [6 x i8] c"%d %d\00"
@.str.9 = [3 x i8] c"%d\00"
@.str.12 = [15 x i8] c"v_p: (%d, %d)\0A\00"
@str = [38 x i8] c"Nije moguce otvoriti sliku lenna1.pgm\00"
@str.13 = [37 x i8] c"Nije moguce otvoriti sliku lenna.pgm\00"
@str.16 = [29 x i8] c"Nepravilna dubina komponente\00"
@str.17 = [35 x i8] c"Nemoguce ucitati dubinu komponente\00"
@str.19 = [26 x i8] c"Nepravilna velicina slike\00"
@str.21 = [20 x i8] c"Format mora biti P5\00"
@str.22 = [26 x i8] c"Neispravan poziv programa\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [16 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%10 = tail call i64 @malloc(i32 256)
%11 = inttoptr i64 %10 to i8*
%12 = tail call i64 @malloc(i32 256)
%13 = inttoptr i64 %12 to i8*
%14 = bitcast i32* %4 to i8*
%15 = bitcast i32* %5 to i8*
%16 = bitcast i32* %6 to i8*
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = load i8*, i8** %17
%19 = tail call i32 @atoi(i8* %18)
%20 = icmp eq i32 %0, 2
br i1 %20, label %23, label %21
21: ; preds = %2
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.22, i64 0, i64 0))
br label %191
23: ; preds = %2
%24 = icmp eq i32* %7, null
br i1 %24, label %25, label %27
25: ; preds = %23
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
br label %191
27: ; preds = %23
%28 = icmp eq i32* %8, null
br i1 %28, label %29, label %31
29: ; preds = %27
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.13, i64 0, i64 0))
br label %191
31: ; preds = %27
%32 = call i32 @fgets(i8* %9, i32 16, i32* %7)
%33 = load i8, i8* %9
%34 = icmp ne i8 %33, 80
%35 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 1
%36 = load i8, i8* %35
%37 = icmp ne i8 %36, 53
%38 = select i1 %34, i1 true, i1 %37
br i1 %38, label %39, label %41
39: ; preds = %31
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.21, i64 0, i64 0))
br label %191
41: ; preds = %31
%42 = call i32 @fgets(i8* %9, i32 16, i32* %8)
%43 = load i8, i8* %9
%44 = icmp ne i8 %43, 80
%45 = load i8, i8* %35
%46 = icmp ne i8 %45, 53
%47 = select i1 %44, i1 true, i1 %46
br i1 %47, label %48, label %50
48: ; preds = %41
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.21, i64 0, i64 0))
br label %191
50: ; preds = %41
%51 = call signext i8 @getc(i32* %7)
%52 = icmp eq i8 %51, 35
br i1 %52, label %53, label %60
53: ; preds = %50, %56
%54 = call signext i8 @getc(i32* %7)
%55 = icmp eq i8 %54, 10
br i1 %55, label %57, label %56
56: ; preds = %53, %57
br label %53
57: ; preds = %53
%58 = call signext i8 @getc(i32* %7)
%59 = icmp eq i8 %58, 35
br i1 %59, label %56, label %60
60: ; preds = %57, %50
%61 = phi i8 [ %51, %50 ], [ %58, %57 ]
%62 = call i32 @ungetc(i8 signext %61, i32* %7)
%63 = call signext i8 @getc(i32* %8)
%64 = icmp eq i8 %63, 35
br i1 %64, label %65, label %72
65: ; preds = %60, %68
%66 = call signext i8 @getc(i32* %8)
%67 = icmp eq i8 %66, 10
br i1 %67, label %69, label %68
68: ; preds = %65, %69
br label %65
69: ; preds = %65
%70 = call signext i8 @getc(i32* %8)
%71 = icmp eq i8 %70, 35
br i1 %71, label %68, label %72
72: ; preds = %69, %60
%73 = phi i8 [ %63, %60 ], [ %70, %69 ]
%74 = call i32 @ungetc(i8 signext %73, i32* %8)
%75 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32* %4, i32* %5)
%76 = icmp eq i32 %75, 2
br i1 %76, label %79, label %77
77: ; preds = %72
%78 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.19, i64 0, i64 0))
br label %191
79: ; preds = %72
%80 = load i32, i32* %4
%81 = load i32, i32* %5
%82 = mul nsw i32 %81, %80
%83 = call i64 @malloc(i32 %82)
%84 = inttoptr i64 %83 to i8*
%85 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32* %4, i32* %5)
%86 = icmp eq i32 %85, 2
br i1 %86, label %89, label %87
87: ; preds = %79
%88 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.19, i64 0, i64 0))
br label %191
89: ; preds = %79
%90 = load i32, i32* %4
%91 = load i32, i32* %5
%92 = mul nsw i32 %91, %90
%93 = call i64 @malloc(i32 %92)
%94 = inttoptr i64 %93 to i8*
%95 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %6)
%96 = icmp eq i32 %95, 1
br i1 %96, label %99, label %97
97: ; preds = %89
%98 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.17, i64 0, i64 0))
br label %191
99: ; preds = %89
%100 = load i32, i32* %6
%101 = icmp eq i32 %100, 255
br i1 %101, label %104, label %102
102: ; preds = %99
%103 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.16, i64 0, i64 0))
br label %191
104: ; preds = %99
%105 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %6)
%106 = icmp eq i32 %105, 1
br i1 %106, label %109, label %107
107: ; preds = %104
%108 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.17, i64 0, i64 0))
br label %191
109: ; preds = %104
%110 = load i32, i32* %6
%111 = icmp eq i32 %110, 255
br i1 %111, label %114, label %112
112: ; preds = %109
%113 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.16, i64 0, i64 0))
br label %191
114: ; preds = %109
%115 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %6)
%116 = call i32 (i32*, i8*, i32*, ...) @fscanf(i32* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32* %6)
%117 = load i32, i32* %4
%118 = load i32, i32* %5
%119 = call i32 @fread(i8* %84, i32 %117, i32 %118, i32* %7)
%120 = load i32, i32* %4
%121 = load i32, i32* %5
%122 = call i32 @fread(i8* %94, i32 %120, i32 %121, i32* %8)
%123 = load i32, i32* %4
%124 = load i32, i32* %5
%125 = call i32 @izvadi_blok(i32 %19, i32 %123, i32 %124, i8* %84, i8* %11)
%126 = load i32, i32* %4
br label %127
127: ; preds = %114, %170
%128 = phi i32 [ %126, %114 ], [ %164, %170 ]
%129 = phi i32 [ -16, %114 ], [ %171, %170 ]
%130 = phi i32 [ undef, %114 ], [ %167, %170 ]
%131 = phi i32 [ 1, %114 ], [ %166, %170 ]
%132 = phi double [ undef, %114 ], [ %165, %170 ]
br label %133
133: ; preds = %127, %163
%134 = phi i32 [ %128, %127 ], [ %164, %163 ]
%135 = phi i32 [ %130, %127 ], [ %167, %163 ]
%136 = phi i32 [ %131, %127 ], [ %166, %163 ]
%137 = phi double [ %132, %127 ], [ %165, %163 ]
%138 = phi i32 [ -16, %127 ], [ %168, %163 ]
%139 = call i32 @bl_u_pocpx(i32 %19, i32 %134)
%140 = load i32, i32* %4
%141 = mul nsw i32 %140, %129
%142 = add i32 %139, %138
%143 = add i32 %142, %141
%144 = icmp slt i32 %143, 0
br i1 %144, label %163, label %145
145: ; preds = %133
%146 = call i32 @izvadi_blok_px(i32 %143, i8* %94, i8* %13)
%147 = icmp eq i32 %136, 0
br i1 %147, label %153, label %148
148: ; preds = %145
%149 = call double @mad(i8* %11, i8* %13)
%150 = load i32, i32* %4
%151 = mul nsw i32 %150, %129
%152 = add i32 %142, %151
br label %153
153: ; preds = %148, %145
%154 = phi double [ %149, %148 ], [ %137, %145 ]
%155 = phi i32 [ %152, %148 ], [ %135, %145 ]
%156 = call double @mad(i8* %11, i8* %13)
%157 = fcmp olt double %156, %154
%158 = load i32, i32* %4
%159 = mul nsw i32 %158, %129
%160 = add i32 %142, %159
%161 = select i1 %157, double %156, double %154
%162 = select i1 %157, i32 %160, i32 %155
br label %163
163: ; preds = %133, %153
%164 = phi i32 [ %158, %153 ], [ %140, %133 ]
%165 = phi double [ %161, %153 ], [ %137, %133 ]
%166 = phi i32 [ 0, %153 ], [ %136, %133 ]
%167 = phi i32 [ %162, %153 ], [ %135, %133 ]
%168 = add nsw i32 %138, 1
%169 = icmp eq i32 %168, 17
br i1 %169, label %170, label %133
170: ; preds = %163
%171 = add nsw i32 %129, 1
%172 = icmp eq i32 %171, 17
br i1 %172, label %173, label %127
173: ; preds = %170
%174 = srem i32 %167, %164
%175 = call i32 @bl_u_pocpx(i32 %19, i32 %164)
%176 = load i32, i32* %4
%177 = srem i32 %175, %176
%178 = sub nsw i32 %174, %177
%179 = sdiv i32 %167, %176
%180 = call i32 @bl_u_pocpx(i32 %19, i32 %176)
%181 = load i32, i32* %4
%182 = sdiv i32 %180, %181
%183 = sub nsw i32 %179, %182
%184 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0), i32 %178, i32 %183)
%185 = call i32 @fclose(i32* %7)
%186 = call i32 @fclose(i32* %8)
%187 = call i32 @free(i8* %84)
%188 = call i32 @free(i8* %94)
%189 = call i32 @free(i8* %11)
%190 = call i32 @free(i8* %13)
br label %191
191: ; preds = %173, %112, %107, %102, %97, %87, %77, %48, %39, %29, %25, %21
%192 = phi i32 [ 1, %21 ], [ 1, %39 ], [ 1, %48 ], [ 1, %77 ], [ 1, %87 ], [ 1, %97 ], [ 1, %102 ], [ 1, %107 ], [ 1, %112 ], [ 0, %173 ], [ 1, %29 ], [ 1, %25 ]
ret i32 %192
}