#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 */
struct test_struct {
  int dummy;
};

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ free(struct test_struct *);
int /*<<< orphan*/ free_memory();
int getopt(int, char **, char *);
int /*<<< orphan*/ init_modes();
int /*<<< orphan*/ init_windows();
int /*<<< orphan*/ loop();
struct test_struct *new_test_struct(int);
int /*<<< orphan*/ prepare_for_exit();
int /*<<< orphan*/ print_help_message();
int /*<<< orphan*/ print_licence_message();
int /*<<< orphan*/ random_init();
int /*<<< orphan*/ set_signals();
char *string(char *);
int main(int argc, char *argv[]) {
  struct test_struct *t4 = new_test_struct(4);
  ;
  do {
    free(t4);
  } while (0);
  char *char_string = string("asdasd");
  int c;
  while ((c = getopt(argc, argv, "hv")) != -1) {
    switch (c) {
    case 'h':
      print_help_message();
      prepare_for_exit();
      return EXIT_FAILURE;
    case 'v':
      print_licence_message();
      prepare_for_exit();
      return EXIT_FAILURE;
    }
  }
  random_init();
  set_signals();
  init_windows();
  init_modes();
  loop();
  prepare_for_exit();
  free_memory();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x4,%edi
call   1080 <new_test_struct@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
lea    0xdfc(%rip),%rdi
call   1090 <string@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdec(%rip),%rdx
call   10c0 <getopt@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
je     1294 <main+0xc4>
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x68,%eax
je     1251 <main+0x81>
jmp    1240 <main+0x70>
mov    -0x28(%rbp),%eax
sub    $0x76,%eax
je     1270 <main+0xa0>
jmp    128f <main+0xbf>
mov    $0x0,%al
call   1040 <print_help_message@plt>
mov    $0x0,%al
call   1060 <prepare_for_exit@plt>
mov    0x2d7a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12d1 <main+0x101>
mov    $0x0,%al
call   1050 <print_licence_message@plt>
mov    $0x0,%al
call   1060 <prepare_for_exit@plt>
mov    0x2d5b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12d1 <main+0x101>
jmp    120d <main+0x3d>
mov    $0x0,%al
call   10b0 <random_init@plt>
mov    $0x0,%al
call   10f0 <set_signals@plt>
mov    $0x0,%al
call   10a0 <init_windows@plt>
mov    $0x0,%al
call   10e0 <init_modes@plt>
mov    $0x0,%al
call   1070 <loop@plt>
mov    $0x0,%al
call   1060 <prepare_for_exit@plt>
mov    $0x0,%al
call   10d0 <free_memory@plt>
mov    0x2d0c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x4,%edi
call   1080 <new_test_struct@plt>
mov    %rax,%rdi
call   1030 <free@plt>
lea    0xe0e(%rip),%rdi
call   1090 <string@plt>
lea    0xe09(%rip),%r14
xchg   %ax,%ax
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   10c0 <getopt@plt>
cmp    $0xffffffff,%eax
je     1225 <main+0x55>
cmp    $0x76,%eax
je     125f <main+0x8f>
cmp    $0x68,%eax
jne    1200 <main+0x30>
xor    %eax,%eax
call   1040 <print_help_message@plt>
jmp    1266 <main+0x96>
xor    %eax,%eax
call   10b0 <random_init@plt>
xor    %eax,%eax
call   10f0 <set_signals@plt>
xor    %eax,%eax
call   10a0 <init_windows@plt>
xor    %eax,%eax
call   10e0 <init_modes@plt>
xor    %eax,%eax
call   1070 <loop@plt>
xor    %eax,%eax
call   1060 <prepare_for_exit@plt>
xor    %eax,%eax
call   10d0 <free_memory@plt>
mov    0x2d7b(%rip),%rax
jmp    1274 <main+0xa4>
xor    %eax,%eax
call   1050 <print_licence_message@plt>
xor    %eax,%eax
call   1060 <prepare_for_exit@plt>
mov    0x2d6c(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.test_struct = type { i32 }
@.str = [7 x i8] c"asdasd\00"
@.str.1 = [3 x i8] c"hv\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.test_struct*
%7 = alloca i8*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call %struct.test_struct* @new_test_struct(i32 4)
store %struct.test_struct* %9, %struct.test_struct** %6
br label %10
10: ; preds = %2
%11 = load %struct.test_struct*, %struct.test_struct** %6
%12 = call i32 @free(%struct.test_struct* %11)
br label %13
13: ; preds = %10
%14 = call i8* @string(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i8* %14, i8** %7
br label %15
15: ; preds = %30, %13
%16 = load i32, i32* %4
%17 = load i8**, i8*** %5
%18 = call i32 @getopt(i32 %16, i8** %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 %18, i32* %8
%19 = icmp ne i32 %18, -1
br i1 %19, label %20, label %31
20: ; preds = %15
%21 = load i32, i32* %8
switch i32 %21, label %30 [
i32 104, label %22
i32 118, label %26
]
22: ; preds = %20
%23 = call i32 (...) @print_help_message()
%24 = call i32 (...) @prepare_for_exit()
%25 = load i32, i32* @EXIT_FAILURE
store i32 %25, i32* %3
br label %40
26: ; preds = %20
%27 = call i32 (...) @print_licence_message()
%28 = call i32 (...) @prepare_for_exit()
%29 = load i32, i32* @EXIT_FAILURE
store i32 %29, i32* %3
br label %40
30: ; preds = %20
br label %15
31: ; preds = %15
%32 = call i32 (...) @random_init()
%33 = call i32 (...) @set_signals()
%34 = call i32 (...) @init_windows()
%35 = call i32 (...) @init_modes()
%36 = call i32 (...) @loop()
%37 = call i32 (...) @prepare_for_exit()
%38 = call i32 (...) @free_memory()
%39 = load i32, i32* @EXIT_SUCCESS
store i32 %39, i32* %3
br label %40
40: ; preds = %31, %26, %22
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
%struct.test_struct = type { i32 }
@.str = [7 x i8] c"asdasd\00"
@.str.1 = [3 x i8] c"hv\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call %struct.test_struct* @new_test_struct(i32 4)
%4 = tail call i32 @free(%struct.test_struct* %3)
%5 = tail call i8* @string(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %6, %2
%7 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
switch i32 %7, label %6 [
i32 -1, label %14
i32 104, label %8
i32 118, label %11
]
8: ; preds = %6
%9 = tail call i32 (...) @print_help_message()
%10 = tail call i32 (...) @prepare_for_exit()
br label %22
11: ; preds = %6
%12 = tail call i32 (...) @print_licence_message()
%13 = tail call i32 (...) @prepare_for_exit()
br label %22
14: ; preds = %6
%15 = tail call i32 (...) @random_init()
%16 = tail call i32 (...) @set_signals()
%17 = tail call i32 (...) @init_windows()
%18 = tail call i32 (...) @init_modes()
%19 = tail call i32 (...) @loop()
%20 = tail call i32 (...) @prepare_for_exit()
%21 = tail call i32 (...) @free_memory()
br label %22
22: ; preds = %14, %11, %8
%23 = phi i32* [ @EXIT_FAILURE, %11 ], [ @EXIT_FAILURE, %8 ], [ @EXIT_SUCCESS, %14 ]
%24 = load i32, i32* %23
ret i32 %24
}