#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*/ rarch_deinit_msg_queue();
int /*<<< orphan*/ rarch_init_msg_queue();
int /*<<< orphan*/ rarch_main_clear_state();
int /*<<< orphan*/ rarch_main_deinit();
int rarch_main_init(int, char **);
scalar_t__ rarch_main_iterate();
int main(int argc, char *argv[]) {
  int init_ret;
  if ((init_ret = rarch_main_init(argc, argv)))
    return init_ret;
  rarch_init_msg_queue();
  while (rarch_main_iterate())
    ;
  rarch_main_deinit();
  rarch_deinit_msg_queue();
  rarch_main_clear_state();
  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)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1080 <rarch_main_init@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     1199 <main+0x39>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11d2 <main+0x72>
mov    $0x0,%al
call   1040 <rarch_init_msg_queue@plt>
mov    $0x0,%al
call   1060 <rarch_main_iterate@plt>
cmp    $0x0,%rax
je     11b6 <main+0x56>
jmp    11a0 <main+0x40>
mov    $0x0,%al
call   1070 <rarch_main_deinit@plt>
mov    $0x0,%al
call   1030 <rarch_deinit_msg_queue@plt>
mov    $0x0,%al
call   1050 <rarch_main_clear_state@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
call   1080 <rarch_main_init@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    11a3 <main+0x43>
xor    %eax,%eax
call   1040 <rarch_init_msg_queue@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1060 <rarch_main_iterate@plt>
test   %rax,%rax
jne    1180 <main+0x20>
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <rarch_main_deinit@plt>
xor    %eax,%eax
call   1030 <rarch_deinit_msg_queue@plt>
xor    %eax,%eax
call   1050 <rarch_main_clear_state@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = call i32 @rarch_main_init(i32 %7, i8** %8)
store i32 %9, i32* %6
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i32, i32* %6
store i32 %12, i32* %3
br label %23
13: ; preds = %2
%14 = call i32 (...) @rarch_init_msg_queue()
br label %15
15: ; preds = %18, %13
%16 = call i64 (...) @rarch_main_iterate()
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %15
br label %15
19: ; preds = %15
%20 = call i32 (...) @rarch_main_deinit()
%21 = call i32 (...) @rarch_deinit_msg_queue()
%22 = call i32 (...) @rarch_main_clear_state()
store i32 0, i32* %3
br label %23
23: ; preds = %19, %11
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @rarch_main_init(i32 %0, i8** %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %14
5: ; preds = %2
%6 = tail call i32 (...) @rarch_init_msg_queue()
br label %7
7: ; preds = %7, %5
%8 = tail call i64 (...) @rarch_main_iterate()
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %7
10: ; preds = %7
%11 = tail call i32 (...) @rarch_main_deinit()
%12 = tail call i32 (...) @rarch_deinit_msg_queue()
%13 = tail call i32 (...) @rarch_main_clear_state()
br label %14
14: ; preds = %2, %10
%15 = phi i32 [ 0, %10 ], [ %3, %2 ]
ret i32 %15
}