#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 */
scalar_t__ prepare_mbox();
scalar_t__ prepare_temp_dir(char *);
scalar_t__ prepare_zip();
char *prepare_object(int mode) {
  int is_zip = 0;
  int i = 0;
  if (prepare_temp_dir("temp_dir") < 0)
    return NULL;
  if (mode == 1) {
    if (prepare_zip() != 0)
      return NULL;
  } else if (mode == 2) {
    if (prepare_mbox() != 0)
      return NULL;
  }
  return "temp_dir";
}


x86 assembly (clang, -O0):
<prepare_object>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeb0(%rip),%rdi
call   1040 <prepare_temp_dir@plt>
cmp    $0x0,%rax
jge    116c <prepare_object+0x3c>
movq   $0x0,-0x8(%rbp)
jmp    11d6 <prepare_object+0xa6>
cmpl   $0x1,-0xc(%rbp)
jne    1199 <prepare_object+0x69>
mov    $0x0,%al
call   1050 <prepare_zip@plt>
cmp    $0x0,%rax
je     1194 <prepare_object+0x64>
movq   $0x0,-0x8(%rbp)
jmp    11d6 <prepare_object+0xa6>
jmp    11cb <prepare_object+0x9b>
cmpl   $0x2,-0xc(%rbp)
jne    11c6 <prepare_object+0x96>
mov    $0x0,%al
call   1030 <prepare_mbox@plt>
cmp    $0x0,%rax
je     11c1 <prepare_object+0x91>
movq   $0x0,-0x8(%rbp)
jmp    11d6 <prepare_object+0xa6>
jmp    11c6 <prepare_object+0x96>
jmp    11cb <prepare_object+0x9b>
lea    0xe2e(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prepare_object>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
lea    0xec4(%rip),%rbx
mov    %rbx,%rdi
call   1040 <prepare_temp_dir@plt>
test   %rax,%rax
js     116d <prepare_object+0x3d>
cmp    $0x2,%ebp
je     1161 <prepare_object+0x31>
cmp    $0x1,%ebp
jne    116f <prepare_object+0x3f>
xor    %eax,%eax
call   1050 <prepare_zip@plt>
test   %rax,%rax
jne    116d <prepare_object+0x3d>
jmp    116f <prepare_object+0x3f>
xor    %eax,%eax
call   1030 <prepare_mbox@plt>
test   %rax,%rax
je     116f <prepare_object+0x3f>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"temp_dir\00"
define i8* @prepare_object(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%6 = call i64 @prepare_temp_dir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i8* null, i8** %2
br label %27
9: ; preds = %1
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = call i64 (...) @prepare_zip()
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %12
store i8* null, i8** %2
br label %27
16: ; preds = %12
br label %26
17: ; preds = %9
%18 = load i32, i32* %3
%19 = icmp eq i32 %18, 2
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = call i64 (...) @prepare_mbox()
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %20
store i8* null, i8** %2
br label %27
24: ; preds = %20
br label %25
25: ; preds = %24, %17
br label %26
26: ; preds = %25, %16
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %2
br label %27
27: ; preds = %26, %23, %15, %8
%28 = load i8*, i8** %2
ret i8* %28
}

LLVM IR (-O2):
@.str = [9 x i8] c"temp_dir\00"
define i8* @prepare_object(i32 %0) {
%2 = tail call i64 @prepare_temp_dir(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = icmp slt i64 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1
switch i32 %0, label %11 [
i32 1, label %5
i32 2, label %8
]
5: ; preds = %4
%6 = tail call i64 (...) @prepare_zip()
%7 = icmp eq i64 %6, 0
br i1 %7, label %11, label %12
8: ; preds = %4
%9 = tail call i64 (...) @prepare_mbox()
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %4, %8, %5
br label %12
12: ; preds = %8, %5, %1, %11
%13 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %11 ], [ null, %1 ], [ null, %5 ], [ null, %8 ]
ret i8* %13
}