#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *const, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ print_intro();
int /*<<< orphan*/ print_outro();
int /*<<< orphan*/ stderr;
int translate(int /*<<< orphan*/ *);
int main(const int argc, const char *const *argv) {
  FILE *src = NULL;
  int retval = 0;
  if (argc != 2) {
    fputs("Usage: yanbi <source.bf>\n", stderr);
    return 1;
  }
  if ((src = fopen(*++argv, "r")) == NULL) {
    perror("open");
    return 1;
  }
  print_intro();
  retval = translate(src);
  print_outro();
  fclose(src);
  return retval;
}


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)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11c0 <main+0x50>
mov    0x2e3a(%rip),%rax
mov    (%rax),%esi
lea    0xe51(%rip),%rdi
call   1050 <fputs@plt>
movl   $0x1,-0x4(%rbp)
jmp    122e <main+0xbe>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xe40(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1205 <main+0x95>
lea    0xe28(%rip),%rdi
call   1070 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    122e <main+0xbe>
mov    $0x0,%al
call   1030 <print_intro@plt>
mov    -0x18(%rbp),%rdi
call   1080 <translate@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1090 <print_outro@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    11b4 <main+0x44>
mov    0x8(%rsi),%rdi
lea    0xe97(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
je     11d5 <main+0x65>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <print_intro@plt>
mov    %rbx,%rdi
call   1080 <translate@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1090 <print_outro@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %ebp,%eax
jmp    11ce <main+0x5e>
mov    0x2e25(%rip),%rax
mov    (%rax),%esi
lea    0xe3c(%rip),%rdi
call   1050 <fputs@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe40(%rip),%rdi
call   1070 <perror@plt>
jmp    11c9 <main+0x59>

LLVM IR (-O0):
@.str = [26 x i8] c"Usage: yanbi <source.bf>\0A\00"
@stderr = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [5 x i8] c"open\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* null, i32** %6
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = call i32 @fputs(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %11)
store i32 1, i32* %3
br label %29
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i32 1
store i8** %15, i8*** %5
%16 = load i8*, i8** %15
%17 = call i32* @fopen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %17, i32** %6
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %21
19: ; preds = %13
%20 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %29
21: ; preds = %13
%22 = call i32 (...) @print_intro()
%23 = load i32*, i32** %6
%24 = call i32 @translate(i32* %23)
store i32 %24, i32* %7
%25 = call i32 (...) @print_outro()
%26 = load i32*, i32** %6
%27 = call i32 @fclose(i32* %26)
%28 = load i32, i32* %7
store i32 %28, i32* %3
br label %29
29: ; preds = %21, %19, %10
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
@.str = [26 x i8] c"Usage: yanbi <source.bf>\0A\00"
@stderr = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [5 x i8] c"open\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 i32, i32* @stderr
%6 = tail call i32 @fputs(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %19
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %19
14: ; preds = %7
%15 = tail call i32 (...) @print_intro()
%16 = tail call i32 @translate(i32* %10)
%17 = tail call i32 (...) @print_outro()
%18 = tail call i32 @fclose(i32* %10)
br label %19
19: ; preds = %14, %12, %4
%20 = phi i32 [ 1, %4 ], [ 1, %12 ], [ %16, %14 ]
ret i32 %20
}