#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*/ lcd_draw_pixel(int, int, int);
void lcd_draw_picture(const unsigned char bmp_file_addr[]) {
  int i, j;
  char *p = bmp_file_addr;
  int blue, green, red;
  int color;
  p += 54;
  for (i = 0; i < 480; i++)
    for (j = 0; j < 800; j++) {
      blue = *p++;
      green = *p++;
      red = *p++;
      color = red << 16 | green << 8 | blue << 0;
      lcd_draw_pixel(480 - i, j, color);
    }
  return;
}


x86 assembly (clang, -O0):
<lcd_draw_picture>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x36,%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x1e0,-0xc(%rbp)
jge    11e4 <lcd_draw_picture+0xd4>
movl   $0x0,-0x10(%rbp)
cmpl   $0x320,-0x10(%rbp)
jge    11d1 <lcd_draw_picture+0xc1>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
shl    $0x10,%eax
mov    -0x20(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x1c(%rbp),%ecx
shl    $0x0,%ecx
or     %ecx,%eax
mov    %eax,-0x28(%rbp)
mov    $0x1e0,%edi
sub    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x28(%rbp),%edx
call   1030 <lcd_draw_pixel@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114b <lcd_draw_picture+0x3b>
jmp    11d6 <lcd_draw_picture+0xc6>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1137 <lcd_draw_picture+0x27>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd_draw_picture>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
add    $0x36,%rbx
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1e0,%r14d
sub    %r15d,%r14d
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movsbl (%rbx),%eax
movsbl 0x1(%rbx),%edx
movsbl 0x2(%rbx),%ecx
add    $0x3,%rbx
shl    $0x10,%ecx
shl    $0x8,%edx
or     %eax,%edx
or     %ecx,%edx
mov    %r14d,%edi
mov    %ebp,%esi
call   1030 <lcd_draw_pixel@plt>
add    $0x1,%ebp
cmp    $0x320,%ebp
jne    1140 <lcd_draw_picture+0x30>
add    $0x1,%r15d
cmp    $0x1e0,%r15d
jne    1130 <lcd_draw_picture+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @lcd_draw_picture(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 54
br label %3
3: ; preds = %1, %26
%4 = phi i32 [ 0, %1 ], [ %27, %26 ]
%5 = phi i8* [ %2, %1 ], [ %16, %26 ]
%6 = sub nuw nsw i32 480, %4
br label %7
7: ; preds = %3, %7
%8 = phi i32 [ 0, %3 ], [ %24, %7 ]
%9 = phi i8* [ %5, %3 ], [ %16, %7 ]
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %9
%12 = sext i8 %11 to i32
%13 = getelementptr inbounds i8, i8* %9, i64 2
%14 = load i8, i8* %10
%15 = sext i8 %14 to i32
%16 = getelementptr inbounds i8, i8* %9, i64 3
%17 = load i8, i8* %13
%18 = sext i8 %17 to i32
%19 = shl nsw i32 %18, 16
%20 = shl nsw i32 %15, 8
%21 = or i32 %20, %12
%22 = or i32 %21, %19
%23 = tail call i32 @lcd_draw_pixel(i32 %6, i32 %8, i32 %22)
%24 = add nuw nsw i32 %8, 1
%25 = icmp eq i32 %24, 800
br i1 %25, label %26, label %7
26: ; preds = %7
%27 = add nuw nsw i32 %4, 1
%28 = icmp eq i32 %27, 480
br i1 %28, label %29, label %3
29: ; preds = %26
ret void
}