#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 /*<<< orphan*/ setPixel(unsigned char *, unsigned int, unsigned int,
                            unsigned char, unsigned char, unsigned char);
void fillScreen(unsigned char *vmem, unsigned char r, unsigned char g,
                unsigned char b) {
  for (unsigned int y = 0; y < 480; y++)
    for (unsigned int x = 0; x < 640; x++)
      setPixel(vmem, x, y, r, g, b);
}


x86 assembly (clang, -O0):
<fillScreen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    %rdi,-0x8(%rbp)
mov    %dl,-0x9(%rbp)
mov    %cl,-0xa(%rbp)
mov    %al,-0xb(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x1e0,-0x10(%rbp)
jae    1196 <fillScreen+0x86>
movl   $0x0,-0x14(%rbp)
cmpl   $0x280,-0x14(%rbp)
jae    1183 <fillScreen+0x73>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x9(%rbp),%cl
mov    -0xa(%rbp),%al
movzbl %cl,%ecx
movzbl %al,%r8d
movzbl -0xb(%rbp),%r9d
call   1030 <setPixel@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <fillScreen+0x37>
jmp    1188 <fillScreen+0x78>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1133 <fillScreen+0x23>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fillScreen>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebp,%ebp
movzbl %sil,%r15d
movzbl %dl,%r12d
movzbl %cl,%r13d
nopl   0x0(%rax)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r15d,%ecx
mov    %r12d,%r8d
mov    %r13d,%r9d
call   1030 <setPixel@plt>
add    $0x1,%ebx
cmp    $0x280,%ebx
jne    1140 <fillScreen+0x30>
add    $0x1,%ebp
cmp    $0x1e0,%ebp
jne    1130 <fillScreen+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @fillScreen(i8* %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3) {
%5 = alloca i8*
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %5
store i8 %1, i8* %6
store i8 %2, i8* %7
store i8 %3, i8* %8
store i32 0, i32* %9
br label %11
11: ; preds = %30, %4
%12 = load i32, i32* %9
%13 = icmp ult i32 %12, 480
br i1 %13, label %14, label %33
14: ; preds = %11
store i32 0, i32* %10
br label %15
15: ; preds = %26, %14
%16 = load i32, i32* %10
%17 = icmp ult i32 %16, 640
br i1 %17, label %18, label %29
18: ; preds = %15
%19 = load i8*, i8** %5
%20 = load i32, i32* %10
%21 = load i32, i32* %9
%22 = load i8, i8* %6
%23 = load i8, i8* %7
%24 = load i8, i8* %8
%25 = call i32 @setPixel(i8* %19, i32 %20, i32 %21, i8 zeroext %22, i8 zeroext %23, i8 zeroext %24)
br label %26
26: ; preds = %18
%27 = load i32, i32* %10
%28 = add i32 %27, 1
store i32 %28, i32* %10
br label %15
29: ; preds = %15
br label %30
30: ; preds = %29
%31 = load i32, i32* %9
%32 = add i32 %31, 1
store i32 %32, i32* %9
br label %11
33: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @fillScreen(i8* %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3) {
br label %5
5: ; preds = %4, %8
%6 = phi i32 [ 0, %4 ], [ %9, %8 ]
br label %11
7: ; preds = %8
ret void
8: ; preds = %11
%9 = add nuw nsw i32 %6, 1
%10 = icmp eq i32 %9, 480
br i1 %10, label %7, label %5
11: ; preds = %5, %11
%12 = phi i32 [ 0, %5 ], [ %14, %11 ]
%13 = tail call i32 @setPixel(i8* %0, i32 %12, i32 %6, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3)
%14 = add nuw nsw i32 %12, 1
%15 = icmp eq i32 %14, 640
br i1 %15, label %8, label %11
}