#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 imv {
  int dummy;
};

/* Variables and functions */
struct imv *imv_create();
int /*<<< orphan*/ imv_free(struct imv *);
int /*<<< orphan*/ imv_load_config(struct imv *);
int /*<<< orphan*/ imv_parse_args(struct imv *, int, char **);
int imv_run(struct imv *);
int main(int argc, char **argv) {
  struct imv *imv = imv_create();
  if (!imv) {
    return 1;
  }
  if (!imv_load_config(imv)) {
    imv_free(imv);
    return 1;
  }
  if (!imv_parse_args(imv, argc, argv)) {
    imv_free(imv);
    return 1;
  }
  int ret = imv_run(imv);
  imv_free(imv);
  return ret;
}


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    $0x0,%al
call   1030 <imv_create@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1188 <main+0x38>
movl   $0x1,-0x4(%rbp)
jmp    11f8 <main+0xa8>
mov    -0x18(%rbp),%rdi
call   1040 <imv_load_config@plt>
cmp    $0x0,%eax
jne    11af <main+0x5f>
mov    -0x18(%rbp),%rdi
call   1070 <imv_free@plt>
movl   $0x1,-0x4(%rbp)
jmp    11f8 <main+0xa8>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1060 <imv_parse_args@plt>
cmp    $0x0,%eax
jne    11dd <main+0x8d>
mov    -0x18(%rbp),%rdi
call   1070 <imv_free@plt>
movl   $0x1,-0x4(%rbp)
jmp    11f8 <main+0xa8>
mov    -0x18(%rbp),%rdi
call   1050 <imv_run@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <imv_free@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   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%r15d
xor    %eax,%eax
call   1030 <imv_create@plt>
test   %rax,%rax
je     11a3 <main+0x53>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <imv_load_config@plt>
mov    $0x1,%ebp
test   %eax,%eax
je     1199 <main+0x49>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14,%rdx
call   1060 <imv_parse_args@plt>
test   %eax,%eax
je     1199 <main+0x49>
mov    %rbx,%rdi
call   1050 <imv_run@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1070 <imv_free@plt>
jmp    11a8 <main+0x58>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.imv = type { i32 }
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.imv*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call %struct.imv* (...) @imv_create()
store %struct.imv* %8, %struct.imv** %6
%9 = load %struct.imv*, %struct.imv** %6
%10 = icmp ne %struct.imv* %9, null
br i1 %10, label %12, label %11
11: ; preds = %2
store i32 1, i32* %3
br label %34
12: ; preds = %2
%13 = load %struct.imv*, %struct.imv** %6
%14 = call i32 @imv_load_config(%struct.imv* %13)
%15 = icmp ne i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %12
%17 = load %struct.imv*, %struct.imv** %6
%18 = call i32 @imv_free(%struct.imv* %17)
store i32 1, i32* %3
br label %34
19: ; preds = %12
%20 = load %struct.imv*, %struct.imv** %6
%21 = load i32, i32* %4
%22 = load i8**, i8*** %5
%23 = call i32 @imv_parse_args(%struct.imv* %20, i32 %21, i8** %22)
%24 = icmp ne i32 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %19
%26 = load %struct.imv*, %struct.imv** %6
%27 = call i32 @imv_free(%struct.imv* %26)
store i32 1, i32* %3
br label %34
28: ; preds = %19
%29 = load %struct.imv*, %struct.imv** %6
%30 = call i32 @imv_run(%struct.imv* %29)
store i32 %30, i32* %7
%31 = load %struct.imv*, %struct.imv** %6
%32 = call i32 @imv_free(%struct.imv* %31)
%33 = load i32, i32* %7
store i32 %33, i32* %3
br label %34
34: ; preds = %28, %25, %16, %11
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
%struct.imv = type { i32 }
define i32 @main(i32 %0, i8** %1) {
%3 = tail call %struct.imv* (...) @imv_create()
%4 = icmp eq %struct.imv* %3, null
br i1 %4, label %16, label %5
5: ; preds = %2
%6 = tail call i32 @imv_load_config(%struct.imv* %3)
%7 = icmp eq i32 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %5
%9 = tail call i32 @imv_parse_args(%struct.imv* %3, i32 %0, i8** %1)
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = tail call i32 @imv_run(%struct.imv* %3)
br label %13
13: ; preds = %8, %5, %11
%14 = phi i32 [ %12, %11 ], [ 1, %5 ], [ 1, %8 ]
%15 = tail call i32 @imv_free(%struct.imv* %3)
br label %16
16: ; preds = %13, %2
%17 = phi i32 [ 1, %2 ], [ %14, %13 ]
ret i32 %17
}