#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*/ cfag12864b_blit();
int /*<<< orphan*/ cfag12864b_exit();
scalar_t__ cfag12864b_init(char *);
int /*<<< orphan*/ example(unsigned char);
char getchar();
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  unsigned char n;
  if (argc != 2) {
    printf("Sintax:  %s fbdev\n"
           "Usually: /dev/fb0, /dev/fb1...\n",
           argv[0]);
    return -1;
  }
  if (cfag12864b_init(argv[1])) {
    printf("Can't init %s fbdev\n", argv[1]);
    return -2;
  }
  for (n = 1; n <= 6; n++) {
    example(n);
    cfag12864b_blit();
    while (getchar() != '\n')
      ;
  }
  cfag12864b_exit();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     119f <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe72(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    122f <main+0xcf>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <cfag12864b_init@plt>
cmp    $0x0,%rax
je     11d6 <main+0x76>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe6d(%rip),%rdi
call   1040 <printf@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    122f <main+0xcf>
movb   $0x1,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
cmp    $0x6,%eax
jg     1221 <main+0xc1>
movzbl -0x11(%rbp),%edi
call   1060 <example@plt>
mov    $0x0,%al
call   1030 <cfag12864b_blit@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     120f <main+0xaf>
jmp    11f7 <main+0x97>
jmp    1214 <main+0xb4>
mov    -0x11(%rbp),%al
add    $0x1,%al
mov    %al,-0x11(%rbp)
jmp    11da <main+0x7a>
mov    $0x0,%al
call   1080 <cfag12864b_exit@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    1191 <main+0x31>
mov    0x8(%rbx),%rdi
call   1070 <cfag12864b_init@plt>
test   %rax,%rax
je     11aa <main+0x4a>
mov    0x8(%rbx),%rsi
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
mov    $0xfffffffe,%ebx
jmp    1274 <main+0x114>
mov    (%rbx),%rsi
lea    0xe65(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%ebx
jmp    1274 <main+0x114>
mov    $0x1,%edi
call   1060 <example@plt>
xor    %eax,%eax
call   1030 <cfag12864b_blit@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
jne    11c0 <main+0x60>
mov    $0x2,%edi
call   1060 <example@plt>
xor    %eax,%eax
call   1030 <cfag12864b_blit@plt>
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
jne    11e0 <main+0x80>
mov    $0x3,%edi
call   1060 <example@plt>
xor    %eax,%eax
call   1030 <cfag12864b_blit@plt>
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
jne    1200 <main+0xa0>
mov    $0x4,%edi
call   1060 <example@plt>
xor    %eax,%eax
call   1030 <cfag12864b_blit@plt>
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
jne    1220 <main+0xc0>
mov    $0x5,%edi
call   1060 <example@plt>
xor    %eax,%eax
call   1030 <cfag12864b_blit@plt>
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
jne    1240 <main+0xe0>
mov    $0x6,%edi
call   1060 <example@plt>
xor    %eax,%eax
call   1030 <cfag12864b_blit@plt>
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
jne    1260 <main+0x100>
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <cfag12864b_exit@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [50 x i8] c"Sintax: %s fbdev\0AUsually: /dev/fb0, /dev/fb1...\0A\00"
@.str.1 = [21 x i8] c"Can't init %s fbdev\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %12)
store i32 -1, i32* %3
br label %45
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i64 @cfag12864b_init(i8* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %14
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %23)
store i32 -2, i32* %3
br label %45
25: ; preds = %14
store i8 1, i8* %6
br label %26
26: ; preds = %40, %25
%27 = load i8, i8* %6
%28 = zext i8 %27 to i32
%29 = icmp sle i32 %28, 6
br i1 %29, label %30, label %43
30: ; preds = %26
%31 = load i8, i8* %6
%32 = call i32 @example(i8 zeroext %31)
%33 = call i32 (...) @cfag12864b_blit()
br label %34
34: ; preds = %38, %30
%35 = call signext i8 (...) @getchar()
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %36, 10
br i1 %37, label %38, label %39
38: ; preds = %34
br label %34
39: ; preds = %34
br label %40
40: ; preds = %39
%41 = load i8, i8* %6
%42 = add i8 %41, 1
store i8 %42, i8* %6
br label %26
43: ; preds = %26
%44 = call i32 (...) @cfag12864b_exit()
store i32 0, i32* %3
br label %45
45: ; preds = %43, %20, %9
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
@.str = [50 x i8] c"Sintax: %s fbdev\0AUsually: /dev/fb0, /dev/fb1...\0A\00"
@.str.1 = [21 x i8] c"Can't init %s fbdev\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %53
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i64 @cfag12864b_init(i8* %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = tail call i32 @example(i8 zeroext 1)
%14 = tail call i32 (...) @cfag12864b_blit()
br label %18
15: ; preds = %7
%16 = load i8*, i8** %8
%17 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %16)
br label %53
18: ; preds = %18, %12
%19 = tail call signext i8 (...) @getchar()
%20 = icmp eq i8 %19, 10
br i1 %20, label %21, label %18
21: ; preds = %18
%22 = tail call i32 @example(i8 zeroext 2)
%23 = tail call i32 (...) @cfag12864b_blit()
br label %24
24: ; preds = %24, %21
%25 = tail call signext i8 (...) @getchar()
%26 = icmp eq i8 %25, 10
br i1 %26, label %27, label %24
27: ; preds = %24
%28 = tail call i32 @example(i8 zeroext 3)
%29 = tail call i32 (...) @cfag12864b_blit()
br label %30
30: ; preds = %30, %27
%31 = tail call signext i8 (...) @getchar()
%32 = icmp eq i8 %31, 10
br i1 %32, label %33, label %30
33: ; preds = %30
%34 = tail call i32 @example(i8 zeroext 4)
%35 = tail call i32 (...) @cfag12864b_blit()
br label %36
36: ; preds = %36, %33
%37 = tail call signext i8 (...) @getchar()
%38 = icmp eq i8 %37, 10
br i1 %38, label %39, label %36
39: ; preds = %36
%40 = tail call i32 @example(i8 zeroext 5)
%41 = tail call i32 (...) @cfag12864b_blit()
br label %42
42: ; preds = %42, %39
%43 = tail call signext i8 (...) @getchar()
%44 = icmp eq i8 %43, 10
br i1 %44, label %45, label %42
45: ; preds = %42
%46 = tail call i32 @example(i8 zeroext 6)
%47 = tail call i32 (...) @cfag12864b_blit()
br label %48
48: ; preds = %48, %45
%49 = tail call signext i8 (...) @getchar()
%50 = icmp eq i8 %49, 10
br i1 %50, label %51, label %48
51: ; preds = %48
%52 = tail call i32 (...) @cfag12864b_exit()
br label %53
53: ; preds = %51, %15, %4
%54 = phi i32 [ -1, %4 ], [ -2, %15 ], [ 0, %51 ]
ret i32 %54
}