#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*/ check_env();
int /*<<< orphan*/ raise_error(int, char *);
int /*<<< orphan*/ setup_env();
int /*<<< orphan*/ trace(int, char *);
void op_init(int argc, char *argv[], int index) {
  if (!check_env()) {
    if (!setup_env()) {
      raise_error(1, "Unable to set up environment");
    }
    trace(1, "Environment successfully created.");
  } else {
    trace(1, "Environment already set up: nothing to do.");
  }
}


x86 assembly (clang, -O0):
<op_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1030 <check_env@plt>
cmp    $0x0,%eax
jne    1199 <op_init+0x59>
mov    $0x0,%al
call   1060 <setup_env@plt>
cmp    $0x0,%eax
jne    1183 <op_init+0x43>
mov    $0x1,%edi
lea    0xe82(%rip),%rsi
call   1040 <raise_error@plt>
mov    $0x1,%edi
lea    0xe8e(%rip),%rsi
call   1050 <trace@plt>
jmp    11aa <op_init+0x6a>
mov    $0x1,%edi
lea    0xe9a(%rip),%rsi
call   1050 <trace@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_init>:
push   %rbx
xor    %eax,%eax
call   1030 <check_env@plt>
test   %eax,%eax
je     1155 <op_init+0x15>
lea    0xeec(%rip),%rbx
jmp    1178 <op_init+0x38>
xor    %eax,%eax
call   1060 <setup_env@plt>
lea    0xeba(%rip),%rbx
test   %eax,%eax
jne    1178 <op_init+0x38>
lea    0xe92(%rip),%rsi
mov    $0x1,%edi
call   1040 <raise_error@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1050 <trace@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"Unable to set up environment\00"
@.str.1 = [34 x i8] c"Environment successfully created.\00"
@.str.2 = [43 x i8] c"Environment already set up: nothing to do.\00"
define void @op_init(i32 %0, i8** %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
%7 = call i32 (...) @check_env()
%8 = icmp ne i32 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %3
%10 = call i32 (...) @setup_env()
%11 = icmp ne i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = call i32 @raise_error(i32 1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %9
%15 = call i32 @trace(i32 1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %18
16: ; preds = %3
%17 = call i32 @trace(i32 1, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"Unable to set up environment\00"
@.str.1 = [34 x i8] c"Environment successfully created.\00"
@.str.2 = [43 x i8] c"Environment already set up: nothing to do.\00"
define void @op_init(i32 %0, i8** nocapture readnone %1, i32 %2) {
%4 = tail call i32 (...) @check_env()
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = tail call i32 (...) @setup_env()
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 @raise_error(i32 1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %3, %6, %9
%12 = phi i8* [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), %9 ], [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), %6 ], [ getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), %3 ]
%13 = tail call i32 @trace(i32 1, i8* %12)
ret void
}