#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*/ hang();
int /*<<< orphan*/ vga_put_pixel(int, int, int);
int /*<<< orphan*/ vga_set_mode(int, int, int);
void die(char *message) {
  vga_set_mode(320, 200, 8);
  int x;
  int y;
  for (x = 0; x < 320; x++) {
    for (y = 0; y < 200; y++) {
      vga_put_pixel(x, y, 6);
    }
  }
  hang();
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x140,%edi
mov    $0xc8,%esi
mov    $0x8,%edx
call   1030 <vga_set_mode@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x140,-0xc(%rbp)
jge    11a9 <die+0x79>
movl   $0x0,-0x10(%rbp)
cmpl   $0xc8,-0x10(%rbp)
jge    1196 <die+0x66>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    $0x6,%edx
call   1040 <vga_put_pixel@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    116b <die+0x3b>
jmp    119b <die+0x6b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1157 <die+0x27>
mov    $0x0,%al
call   1050 <hang@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<die>:
push   %rbp
push   %rbx
push   %rax
mov    $0x140,%edi
mov    $0xc8,%esi
mov    $0x8,%edx
call   1030 <vga_set_mode@plt>
xor    %ebx,%ebx
nopl   0x0(%rax)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x6,%edx
call   1040 <vga_put_pixel@plt>
add    $0x1,%ebp
cmp    $0xc8,%ebp
jne    1160 <die+0x30>
add    $0x1,%ebx
cmp    $0x140,%ebx
jne    1150 <die+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <hang@plt>

LLVM IR (-O0):
define void @die(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i32 @vga_set_mode(i32 320, i32 200, i32 8)
store i32 0, i32* %3
br label %6
6: ; preds = %21, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 320
br i1 %8, label %9, label %24
9: ; preds = %6
store i32 0, i32* %4
br label %10
10: ; preds = %17, %9
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 200
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = call i32 @vga_put_pixel(i32 %14, i32 %15, i32 6)
br label %17
17: ; preds = %13
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %10
20: ; preds = %10
br label %21
21: ; preds = %20
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %6
24: ; preds = %6
%25 = call i32 (...) @hang()
ret void
}

LLVM IR (-O2):
define void @die(i8* nocapture readnone %0) {
%2 = tail call i32 @vga_set_mode(i32 320, i32 200, i32 8)
br label %3
3: ; preds = %1, %10
%4 = phi i32 [ 0, %1 ], [ %11, %10 ]
br label %5
5: ; preds = %3, %5
%6 = phi i32 [ 0, %3 ], [ %8, %5 ]
%7 = tail call i32 @vga_put_pixel(i32 %4, i32 %6, i32 6)
%8 = add nuw nsw i32 %6, 1
%9 = icmp eq i32 %8, 200
br i1 %9, label %10, label %5
10: ; preds = %5
%11 = add nuw nsw i32 %4, 1
%12 = icmp eq i32 %11, 320
br i1 %12, label %13, label %3
13: ; preds = %10
%14 = tail call i32 (...) @hang()
ret void
}