#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*/ exit(int);
int /*<<< orphan*/ fb_close();
int /*<<< orphan*/ fb_draw_point(int, int, int);
int fb_open();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main(void) {
  int x, y;
  int ret;
  ret = fb_open();
  if (ret != 0) {
    fprintf(stderr, "fb_open() error.\n");
    exit(1);
  }
  for (x = 300; x < 400; x++)
    for (y = 300; y < 400; y++) {
      fb_draw_point(x, y, 0xaf);
    }
  fb_close();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <fb_open@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1192 <main+0x42>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
lea    0xe7d(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
movl   $0x12c,-0x8(%rbp)
cmpl   $0x190,-0x8(%rbp)
jge    11eb <main+0x9b>
movl   $0x12c,-0xc(%rbp)
cmpl   $0x190,-0xc(%rbp)
jge    11d8 <main+0x88>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0xaf,%edx
call   1030 <fb_draw_point@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ad <main+0x5d>
jmp    11dd <main+0x8d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1199 <main+0x49>
mov    $0x0,%al
call   1040 <fb_close@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1070 <fb_open@plt>
test   %eax,%eax
jne    11b4 <main+0x64>
mov    $0x12c,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x12c,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0xaf,%edx
call   1030 <fb_draw_point@plt>
add    $0x1,%ebp
cmp    $0x190,%ebp
jne    1180 <main+0x30>
add    $0x1,%ebx
cmp    $0x190,%ebx
jne    1170 <main+0x20>
xor    %eax,%eax
call   1040 <fb_close@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
lea    0xe3c(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"fb_open() error.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (...) @fb_open()
store i32 %5, i32* %4
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %0
store i32 300, i32* %2
br label %13
13: ; preds = %28, %12
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 400
br i1 %15, label %16, label %31
16: ; preds = %13
store i32 300, i32* %3
br label %17
17: ; preds = %24, %16
%18 = load i32, i32* %3
%19 = icmp slt i32 %18, 400
br i1 %19, label %20, label %27
20: ; preds = %17
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = call i32 @fb_draw_point(i32 %21, i32 %22, i32 175)
br label %24
24: ; preds = %20
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %17
27: ; preds = %17
br label %28
28: ; preds = %27
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %2
br label %13
31: ; preds = %13
%32 = call i32 (...) @fb_close()
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"fb_open() error.\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @fb_open()
%2 = icmp eq i32 %1, 0
br i1 %2, label %7, label %3
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %0, %14
%8 = phi i32 [ %15, %14 ], [ 300, %0 ]
br label %9
9: ; preds = %7, %9
%10 = phi i32 [ 300, %7 ], [ %12, %9 ]
%11 = tail call i32 @fb_draw_point(i32 %8, i32 %10, i32 175)
%12 = add nuw nsw i32 %10, 1
%13 = icmp eq i32 %12, 400
br i1 %13, label %14, label %9
14: ; preds = %9
%15 = add nuw nsw i32 %8, 1
%16 = icmp eq i32 %15, 400
br i1 %16, label %17, label %7
17: ; preds = %14
%18 = tail call i32 (...) @fb_close()
ret i32 0
}