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

/* Variables and functions */
struct model *model_from_fbx(unsigned char const *, size_t);
struct model *model_from_iqm(unsigned char const *, size_t);
struct model *model_from_mdl(unsigned char const *, size_t);
struct model *model_from_obj(unsigned char const *, size_t);
struct model *model_from_ply(unsigned char const *, size_t);
scalar_t__ strcmpi(char const *, char *);
struct model *model_from_mem_buf(const unsigned char *data, size_t sz,
                                 const char *hint) {
  if (strcmpi(hint, "obj") == 0)
    return model_from_obj(data, sz);
  else if (strcmpi(hint, "fbx") == 0)
    return model_from_fbx(data, sz);
  else if (strcmpi(hint, "ply") == 0)
    return model_from_ply(data, sz);
  else if (strcmpi(hint, "iqm") == 0)
    return model_from_iqm(data, sz);
  else if (strcmpi(hint, "mdl") == 0)
    return model_from_mdl(data, sz);
  return 0;
}


x86 assembly (clang, -O0):
<model_from_mem_buf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe81(%rip),%rsi
call   1050 <strcmpi@plt>
cmp    $0x0,%rax
jne    11a4 <model_from_mem_buf+0x44>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <model_from_obj@plt>
mov    %rax,-0x8(%rbp)
jmp    1280 <model_from_mem_buf+0x120>
mov    -0x20(%rbp),%rdi
lea    0xe55(%rip),%rsi
call   1050 <strcmpi@plt>
cmp    $0x0,%rax
jne    11d4 <model_from_mem_buf+0x74>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <model_from_fbx@plt>
mov    %rax,-0x8(%rbp)
jmp    1280 <model_from_mem_buf+0x120>
mov    -0x20(%rbp),%rdi
lea    0xe29(%rip),%rsi
call   1050 <strcmpi@plt>
cmp    $0x0,%rax
jne    1204 <model_from_mem_buf+0xa4>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <model_from_ply@plt>
mov    %rax,-0x8(%rbp)
jmp    1280 <model_from_mem_buf+0x120>
mov    -0x20(%rbp),%rdi
lea    0xdfd(%rip),%rsi
call   1050 <strcmpi@plt>
cmp    $0x0,%rax
jne    1234 <model_from_mem_buf+0xd4>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <model_from_iqm@plt>
mov    %rax,-0x8(%rbp)
jmp    1280 <model_from_mem_buf+0x120>
mov    -0x20(%rbp),%rdi
lea    0xdd1(%rip),%rsi
call   1050 <strcmpi@plt>
cmp    $0x0,%rax
jne    1264 <model_from_mem_buf+0x104>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <model_from_mdl@plt>
mov    %rax,-0x8(%rbp)
jmp    1280 <model_from_mem_buf+0x120>
jmp    1269 <model_from_mem_buf+0x109>
jmp    126e <model_from_mem_buf+0x10e>
jmp    1273 <model_from_mem_buf+0x113>
jmp    1278 <model_from_mem_buf+0x118>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<model_from_mem_buf>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xe8b(%rip),%rsi
mov    %rdx,%rdi
call   1050 <strcmpi@plt>
test   %rax,%rax
je     11da <model_from_mem_buf+0x7a>
lea    0xe7b(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmpi@plt>
test   %rax,%rax
je     11ea <model_from_mem_buf+0x8a>
lea    0xe6b(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmpi@plt>
test   %rax,%rax
je     11fa <model_from_mem_buf+0x9a>
lea    0xe5b(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmpi@plt>
test   %rax,%rax
je     120a <model_from_mem_buf+0xaa>
lea    0xe4b(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmpi@plt>
test   %rax,%rax
je     121a <model_from_mem_buf+0xba>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %r15,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <model_from_obj@plt>
mov    %r15,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1070 <model_from_fbx@plt>
mov    %r15,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1080 <model_from_ply@plt>
mov    %r15,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1060 <model_from_iqm@plt>
mov    %r15,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <model_from_mdl@plt>

LLVM IR (-O0):
%struct.model = type { i32 }
@.str = [4 x i8] c"obj\00"
@.str.1 = [4 x i8] c"fbx\00"
@.str.2 = [4 x i8] c"ply\00"
@.str.3 = [4 x i8] c"iqm\00"
@.str.4 = [4 x i8] c"mdl\00"
define %struct.model* @model_from_mem_buf(i8* %0, i64 %1, i8* %2) {
%4 = alloca %struct.model*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
%8 = load i8*, i8** %7
%9 = call i64 @strcmpi(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %3
%12 = load i8*, i8** %5
%13 = load i64, i64* %6
%14 = call %struct.model* @model_from_obj(i8* %12, i64 %13)
store %struct.model* %14, %struct.model** %4
br label %52
15: ; preds = %3
%16 = load i8*, i8** %7
%17 = call i64 @strcmpi(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = load i8*, i8** %5
%21 = load i64, i64* %6
%22 = call %struct.model* @model_from_fbx(i8* %20, i64 %21)
store %struct.model* %22, %struct.model** %4
br label %52
23: ; preds = %15
%24 = load i8*, i8** %7
%25 = call i64 @strcmpi(i8* %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %23
%28 = load i8*, i8** %5
%29 = load i64, i64* %6
%30 = call %struct.model* @model_from_ply(i8* %28, i64 %29)
store %struct.model* %30, %struct.model** %4
br label %52
31: ; preds = %23
%32 = load i8*, i8** %7
%33 = call i64 @strcmpi(i8* %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %31
%36 = load i8*, i8** %5
%37 = load i64, i64* %6
%38 = call %struct.model* @model_from_iqm(i8* %36, i64 %37)
store %struct.model* %38, %struct.model** %4
br label %52
39: ; preds = %31
%40 = load i8*, i8** %7
%41 = call i64 @strcmpi(i8* %40, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %47
43: ; preds = %39
%44 = load i8*, i8** %5
%45 = load i64, i64* %6
%46 = call %struct.model* @model_from_mdl(i8* %44, i64 %45)
store %struct.model* %46, %struct.model** %4
br label %52
47: ; preds = %39
br label %48
48: ; preds = %47
br label %49
49: ; preds = %48
br label %50
50: ; preds = %49
br label %51
51: ; preds = %50
store %struct.model* null, %struct.model** %4
br label %52
52: ; preds = %51, %43, %35, %27, %19, %11
%53 = load %struct.model*, %struct.model** %4
ret %struct.model* %53
}

LLVM IR (-O2):
%struct.model = type { i32 }
@.str = [4 x i8] c"obj\00"
@.str.1 = [4 x i8] c"fbx\00"
@.str.2 = [4 x i8] c"ply\00"
@.str.3 = [4 x i8] c"iqm\00"
@.str.4 = [4 x i8] c"mdl\00"
define %struct.model* @model_from_mem_buf(i8* %0, i64 %1, i8* %2) {
%4 = tail call i64 @strcmpi(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call %struct.model* @model_from_obj(i8* %0, i64 %1)
br label %28
8: ; preds = %3
%9 = tail call i64 @strcmpi(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call %struct.model* @model_from_fbx(i8* %0, i64 %1)
br label %28
13: ; preds = %8
%14 = tail call i64 @strcmpi(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = tail call %struct.model* @model_from_ply(i8* %0, i64 %1)
br label %28
18: ; preds = %13
%19 = tail call i64 @strcmpi(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = tail call %struct.model* @model_from_iqm(i8* %0, i64 %1)
br label %28
23: ; preds = %18
%24 = tail call i64 @strcmpi(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = tail call %struct.model* @model_from_mdl(i8* %0, i64 %1)
br label %28
28: ; preds = %23, %26, %21, %16, %11, %6
%29 = phi %struct.model* [ %7, %6 ], [ %12, %11 ], [ %17, %16 ], [ %22, %21 ], [ %27, %26 ], [ null, %23 ]
ret %struct.model* %29
}