#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 */

/* Variables and functions */
scalar_t__ getPixel1(int, char);
int whatsAt(char, char);
int colDown(char x, char y) {
  int i;
  int flag = 0;
  for (i = x; i < (x + 8); i++) {
    if (getPixel1(i, (y + 8))) {
      flag++;
    }
  }
  return whatsAt(x, (y + 1));
}


x86 assembly (clang, -O0):
<colDown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0x0,-0xc(%rbp)
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl -0x1(%rbp),%ecx
add    $0x8,%ecx
cmp    %ecx,%eax
jge    118c <colDown+0x6c>
mov    -0x8(%rbp),%edi
movsbl -0x2(%rbp),%eax
add    $0x8,%eax
movsbl %al,%esi
call   1030 <getPixel1@plt>
cmp    $0x0,%rax
je     1179 <colDown+0x59>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117e <colDown+0x5e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <colDown+0x22>
mov    -0x1(%rbp),%cl
movsbl -0x2(%rbp),%eax
add    $0x1,%eax
movsbl %cl,%edi
movsbl %al,%esi
call   1040 <whatsAt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<colDown>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebx
lea    0x8(%r14),%eax
movsbl %al,%ebp
mov    %ebp,%esi
call   1030 <getPixel1@plt>
lea    0x1(%rbx),%edi
mov    %ebp,%esi
call   1030 <getPixel1@plt>
lea    0x2(%rbx),%edi
mov    %ebp,%esi
call   1030 <getPixel1@plt>
lea    0x3(%rbx),%edi
mov    %ebp,%esi
call   1030 <getPixel1@plt>
lea    0x4(%rbx),%edi
mov    %ebp,%esi
call   1030 <getPixel1@plt>
lea    0x5(%rbx),%edi
mov    %ebp,%esi
call   1030 <getPixel1@plt>
lea    0x6(%rbx),%edi
mov    %ebp,%esi
call   1030 <getPixel1@plt>
lea    0x7(%rbx),%edi
mov    %ebp,%esi
call   1030 <getPixel1@plt>
add    $0x1,%r14b
movsbl %r14b,%esi
mov    %ebx,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <whatsAt@plt>

LLVM IR (-O0):
define i32 @colDown(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 0, i32* %6
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
store i32 %8, i32* %5
br label %9
9: ; preds = %27, %2
%10 = load i32, i32* %5
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
%13 = add nsw i32 %12, 8
%14 = icmp slt i32 %10, %13
br i1 %14, label %15, label %30
15: ; preds = %9
%16 = load i32, i32* %5
%17 = load i8, i8* %4
%18 = sext i8 %17 to i32
%19 = add nsw i32 %18, 8
%20 = trunc i32 %19 to i8
%21 = call i64 @getPixel1(i32 %16, i8 signext %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %15
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %26
26: ; preds = %23, %15
br label %27
27: ; preds = %26
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %9
30: ; preds = %9
%31 = load i8, i8* %3
%32 = load i8, i8* %4
%33 = sext i8 %32 to i32
%34 = add nsw i32 %33, 1
%35 = trunc i32 %34 to i8
%36 = call i32 @whatsAt(i8 signext %31, i8 signext %35)
ret i32 %36
}

LLVM IR (-O2):
define i32 @colDown(i8 signext %0, i8 signext %1) {
%3 = sext i8 %0 to i32
%4 = add i8 %1, 8
%5 = tail call i64 @getPixel1(i32 %3, i8 signext %4)
%6 = add nsw i32 %3, 1
%7 = tail call i64 @getPixel1(i32 %6, i8 signext %4)
%8 = add nsw i32 %3, 2
%9 = tail call i64 @getPixel1(i32 %8, i8 signext %4)
%10 = add nsw i32 %3, 3
%11 = tail call i64 @getPixel1(i32 %10, i8 signext %4)
%12 = add nsw i32 %3, 4
%13 = tail call i64 @getPixel1(i32 %12, i8 signext %4)
%14 = add nsw i32 %3, 5
%15 = tail call i64 @getPixel1(i32 %14, i8 signext %4)
%16 = add nsw i32 %3, 6
%17 = tail call i64 @getPixel1(i32 %16, i8 signext %4)
%18 = add nsw i32 %3, 7
%19 = tail call i64 @getPixel1(i32 %18, i8 signext %4)
%20 = add i8 %1, 1
%21 = tail call i32 @whatsAt(i8 signext %0, i8 signext %20)
ret i32 %21
}