#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 */
int GB_CameraWebcamImageGetPixel(int, int);
void GB_Debug_GBCameraWebcamOutputPrint(unsigned char *buffer, int bufw,
                                        __attribute__((unused)) int bufh) {
  for (int y = 0; y < 14 * 8; y++) {
    for (int x = 0; x < 16 * 8; x++) {
      int color = GB_CameraWebcamImageGetPixel(x, y);
      int bufindex = (y * bufw + x) * 3;
      buffer[bufindex + 0] = color;
      buffer[bufindex + 1] = color;
      buffer[bufindex + 2] = color;
    }
  }
}


x86 assembly (clang, -O0):
<GB_Debug_GBCameraWebcamOutputPrint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x70,-0x14(%rbp)
jge    11c5 <GB_Debug_GBCameraWebcamOutputPrint+0xb5>
movl   $0x0,-0x18(%rbp)
cmpl   $0x80,-0x18(%rbp)
jge    11b2 <GB_Debug_GBCameraWebcamOutputPrint+0xa2>
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1030 <GB_CameraWebcamImageGetPixel@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
imul   -0xc(%rbp),%eax
add    -0x18(%rbp),%eax
imul   $0x3,%eax,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113a <GB_Debug_GBCameraWebcamOutputPrint+0x2a>
jmp    11b7 <GB_Debug_GBCameraWebcamOutputPrint+0xa7>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <GB_Debug_GBCameraWebcamOutputPrint+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GB_Debug_GBCameraWebcamOutputPrint>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r14
movslq %esi,%rax
add    $0x2,%r14
lea    (%rax,%rax,2),%r12
xor    %r15d,%r15d
nopw   0x0(%rax,%rax,1)
mov    %r14,%rbx
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
mov    %r13d,%edi
mov    %r15d,%esi
call   1030 <GB_CameraWebcamImageGetPixel@plt>
mov    %al,-0x2(%rbx)
mov    %al,-0x1(%rbx)
mov    %al,(%rbx)
add    $0x1,%r13
add    $0x3,%rbx
cmp    $0x80,%r13
jne    1140 <GB_Debug_GBCameraWebcamOutputPrint+0x30>
add    $0x1,%r15
add    %r12,%r14
cmp    $0x70,%r15
jne    1130 <GB_Debug_GBCameraWebcamOutputPrint+0x20>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @GB_Debug_GBCameraWebcamOutputPrint(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %11
11: ; preds = %53, %3
%12 = load i32, i32* %7
%13 = icmp slt i32 %12, 112
br i1 %13, label %14, label %56
14: ; preds = %11
store i32 0, i32* %8
br label %15
15: ; preds = %49, %14
%16 = load i32, i32* %8
%17 = icmp slt i32 %16, 128
br i1 %17, label %18, label %52
18: ; preds = %15
%19 = load i32, i32* %8
%20 = load i32, i32* %7
%21 = call i32 @GB_CameraWebcamImageGetPixel(i32 %19, i32 %20)
store i32 %21, i32* %9
%22 = load i32, i32* %7
%23 = load i32, i32* %5
%24 = mul nsw i32 %22, %23
%25 = load i32, i32* %8
%26 = add nsw i32 %24, %25
%27 = mul nsw i32 %26, 3
store i32 %27, i32* %10
%28 = load i32, i32* %9
%29 = trunc i32 %28 to i8
%30 = load i8*, i8** %4
%31 = load i32, i32* %10
%32 = add nsw i32 %31, 0
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %30, i64 %33
store i8 %29, i8* %34
%35 = load i32, i32* %9
%36 = trunc i32 %35 to i8
%37 = load i8*, i8** %4
%38 = load i32, i32* %10
%39 = add nsw i32 %38, 1
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %37, i64 %40
store i8 %36, i8* %41
%42 = load i32, i32* %9
%43 = trunc i32 %42 to i8
%44 = load i8*, i8** %4
%45 = load i32, i32* %10
%46 = add nsw i32 %45, 2
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %44, i64 %47
store i8 %43, i8* %48
br label %49
49: ; preds = %18
%50 = load i32, i32* %8
%51 = add nsw i32 %50, 1
store i32 %51, i32* %8
br label %15
52: ; preds = %15
br label %53
53: ; preds = %52
%54 = load i32, i32* %7
%55 = add nsw i32 %54, 1
store i32 %55, i32* %7
br label %11
56: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @GB_Debug_GBCameraWebcamOutputPrint(i8* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
br label %5
5: ; preds = %3, %10
%6 = phi i64 [ 0, %3 ], [ %11, %10 ]
%7 = mul nsw i64 %6, %4
%8 = trunc i64 %6 to i32
br label %13
9: ; preds = %10
ret void
10: ; preds = %13
%11 = add nuw nsw i64 %6, 1
%12 = icmp eq i64 %11, 112
br i1 %12, label %9, label %5
13: ; preds = %5, %13
%14 = phi i64 [ 0, %5 ], [ %25, %13 ]
%15 = trunc i64 %14 to i32
%16 = tail call i32 @GB_CameraWebcamImageGetPixel(i32 %15, i32 %8)
%17 = add nsw i64 %14, %7
%18 = mul nsw i64 %17, 3
%19 = trunc i32 %16 to i8
%20 = getelementptr inbounds i8, i8* %0, i64 %18
store i8 %19, i8* %20
%21 = add nsw i64 %18, 1
%22 = getelementptr inbounds i8, i8* %0, i64 %21
store i8 %19, i8* %22
%23 = add nsw i64 %18, 2
%24 = getelementptr inbounds i8, i8* %0, i64 %23
store i8 %19, i8* %24
%25 = add nuw nsw i64 %14, 1
%26 = icmp eq i64 %25, 128
br i1 %26, label %10, label %13
}