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

/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ load_pumas_materials(struct pumas_physics **, char const *,
                                        char const *, char const *);
int /*<<< orphan*/ pumas_physics_destroy(struct pumas_physics **);
int main(int argc, char *argv[]) {
  const char *mdf = (argc >= 2) ? argv[1] : "examples/data/materials.xml";
  const char *dedx = (argc >= 3) ? argv[2] : NULL;
  const char *dump = (argc >= 4) ? argv[3] : "examples/data/materials.pumas";
  struct pumas_physics *physics;
  load_pumas_materials(&physics, mdf, dedx, dump);
  pumas_physics_destroy(&physics);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     1161 <main+0x31>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    1171 <main+0x41>
lea    0xe98(%rip),%rax
mov    %rax,-0x38(%rbp)
jmp    1171 <main+0x41>
mov    -0x38(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x3,-0x8(%rbp)
jl     1194 <main+0x64>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    119f <main+0x6f>
xor    %eax,%eax
mov    %rax,-0x40(%rbp)
jmp    119f <main+0x6f>
mov    -0x40(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x4,-0x8(%rbp)
jl     11c2 <main+0x92>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x48(%rbp)
jmp    11d2 <main+0xa2>
lea    0xe53(%rip),%rax
mov    %rax,-0x48(%rbp)
jmp    11d2 <main+0xa2>
mov    -0x48(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    -0x30(%rbp),%rdi
call   1030 <load_pumas_materials@plt>
lea    -0x30(%rbp),%rdi
call   1040 <pumas_physics_destroy@plt>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xee0(%rip),%rcx
cmp    $0x2,%edi
jl     114e <main+0x1e>
mov    %rsi,%rax
mov    0x8(%rsi),%rsi
jne    1159 <main+0x29>
xor    %edx,%edx
jmp    1166 <main+0x36>
lea    0xeab(%rip),%rsi
xor    %edx,%edx
jmp    1166 <main+0x36>
mov    0x10(%rax),%rdx
cmp    $0x4,%edi
jb     1166 <main+0x36>
mov    0x18(%rax),%rcx
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <load_pumas_materials@plt>
mov    %rbx,%rdi
call   1040 <pumas_physics_destroy@plt>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.pumas_physics = type { i32 }
@.str = [28 x i8] c"examples/data/materials.xml\00"
@.str.1 = [30 x i8] c"examples/data/materials.pumas\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca %struct.pumas_physics*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp sge i32 %10, 2
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
br label %17
16: ; preds = %2
br label %17
17: ; preds = %16, %12
%18 = phi i8* [ %15, %12 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), %16 ]
store i8* %18, i8** %6
%19 = load i32, i32* %4
%20 = icmp sge i32 %19, 3
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
br label %26
25: ; preds = %17
br label %26
26: ; preds = %25, %21
%27 = phi i8* [ %24, %21 ], [ null, %25 ]
store i8* %27, i8** %7
%28 = load i32, i32* %4
%29 = icmp sge i32 %28, 4
br i1 %29, label %30, label %34
30: ; preds = %26
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 3
%33 = load i8*, i8** %32
br label %35
34: ; preds = %26
br label %35
35: ; preds = %34, %30
%36 = phi i8* [ %33, %30 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), %34 ]
store i8* %36, i8** %8
%37 = load i8*, i8** %6
%38 = load i8*, i8** %7
%39 = load i8*, i8** %8
%40 = call i32 @load_pumas_materials(%struct.pumas_physics** %9, i8* %37, i8* %38, i8* %39)
%41 = call i32 @pumas_physics_destroy(%struct.pumas_physics** %9)
%42 = load i32, i32* @EXIT_SUCCESS
%43 = call i32 @exit(i32 %42)
unreachable
}

LLVM IR (-O2):
%struct.pumas_physics = type { i32 }
@.str = [28 x i8] c"examples/data/materials.xml\00"
@.str.1 = [30 x i8] c"examples/data/materials.pumas\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.pumas_physics*
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %16
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = icmp eq i32 %0, 2
br i1 %8, label %16, label %9
9: ; preds = %5
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = icmp ugt i32 %0, 3
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = getelementptr inbounds i8*, i8** %1, i64 3
%15 = load i8*, i8** %14
br label %16
16: ; preds = %2, %5, %9, %13
%17 = phi i8* [ %11, %13 ], [ %11, %9 ], [ null, %5 ], [ null, %2 ]
%18 = phi i8* [ %7, %13 ], [ %7, %9 ], [ %7, %5 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), %2 ]
%19 = phi i8* [ %15, %13 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), %9 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), %2 ]
%20 = bitcast %struct.pumas_physics** %3 to i8*
%21 = call i32 @load_pumas_materials(%struct.pumas_physics** %3, i8* %18, i8* %17, i8* %19)
%22 = call i32 @pumas_physics_destroy(%struct.pumas_physics** %3)
%23 = load i32, i32* @EXIT_SUCCESS
%24 = call i32 @exit(i32 %23)
unreachable
}