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

/* Variables and functions */
int /*<<< orphan*/ fte_destroy(struct fte_data *);
int fte_getdescription(struct fte_data *, char *, char *, char **, char **,
                       char **, char **);
struct fte_data *fte_init(char *);
int /*<<< orphan*/ printf(char *, char *, char *, char *, char *, char *);
int main() {
  struct fte_data *fdata = fte_init("../../config/file_extensions.conf");
  char *test_ext[] = {"bmp", "docx", "doc", "dat"};
  int i;
  for (i = 0; i < 4; i++) {
    char *group, *descr, *icon, *version;
    int ret;
    ret = fte_getdescription(fdata, "nbo", test_ext[i], &group, &descr, &icon,
                             &version);
    printf("Extension(%s): %s / %s, Icon=%s, Version=%s\n", test_ext[i], group,
           descr, icon, version);
  }
  fte_destroy(fdata);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1060 <fte_init@plt>
mov    %rax,-0x10(%rbp)
mov    0x2c9a(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2c97(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2c94(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2c91(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x4,-0x34(%rbp)
jge    11ff <main+0xbf>
mov    -0x10(%rbp),%rdi
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdx
lea    0xe83(%rip),%rsi
lea    -0x40(%rbp),%rcx
lea    -0x48(%rbp),%r8
lea    -0x50(%rbp),%r9
lea    -0x58(%rbp),%rax
mov    %rax,(%rsp)
call   1050 <fte_getdescription@plt>
mov    %eax,-0x5c(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x48(%rbp),%rcx
mov    -0x50(%rbp),%r8
mov    -0x58(%rbp),%r9
lea    0xe4b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1192 <main+0x52>
mov    -0x10(%rbp),%rdi
call   1030 <fte_destroy@plt>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xeab(%rip),%rdi
call   1060 <fte_init@plt>
mov    %rax,%rbx
lea    0x10(%rsp),%rax
mov    %rax,(%rsp)
mov    %rax,%rbp
lea    0xec3(%rip),%r12
lea    0xeab(%rip),%r14
lea    0x20(%rsp),%r13
lea    0x18(%rsp),%r8
lea    0x8(%rsp),%r9
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
mov    %r13,%rcx
call   1050 <fte_getdescription@plt>
mov    0x20(%rsp),%rdx
mov    0x18(%rsp),%rcx
mov    0x8(%rsp),%r8
mov    0x10(%rsp),%r9
lea    0xe85(%rip),%r15
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
mov    %rbp,(%rsp)
lea    0xe5e(%rip),%rbp
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
mov    %r13,%rcx
lea    0x18(%rsp),%r8
mov    %r8,%r14
lea    0x8(%rsp),%r9
call   1050 <fte_getdescription@plt>
mov    0x20(%rsp),%rdx
mov    0x18(%rsp),%rcx
mov    0x8(%rsp),%r8
mov    0x10(%rsp),%r9
mov    %r15,%rdi
mov    %rbp,%rsi
call   1040 <printf@plt>
lea    0x10(%rsp),%rax
mov    %rax,(%rsp)
lea    0xe16(%rip),%rbp
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
mov    %r13,%rcx
mov    %r14,%r8
lea    0x8(%rsp),%r9
call   1050 <fte_getdescription@plt>
mov    0x20(%rsp),%rdx
mov    0x18(%rsp),%rcx
mov    0x8(%rsp),%r8
mov    0x10(%rsp),%r9
mov    %r15,%rdi
mov    %rbp,%rsi
call   1040 <printf@plt>
lea    0x10(%rsp),%rax
mov    %rax,(%rsp)
lea    0xdd2(%rip),%rbp
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
mov    %r13,%rcx
mov    %r14,%r8
lea    0x8(%rsp),%r9
call   1050 <fte_getdescription@plt>
mov    0x20(%rsp),%rdx
mov    0x18(%rsp),%rcx
mov    0x8(%rsp),%r8
mov    0x10(%rsp),%r9
mov    %r15,%rdi
mov    %rbp,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <fte_destroy@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.fte_data = type { i32 }
@.str = [34 x i8] c"../../config/file_extensions.conf\00"
@.str.1 = [4 x i8] c"bmp\00"
@.str.2 = [5 x i8] c"docx\00"
@.str.3 = [4 x i8] c"doc\00"
@.str.4 = [4 x i8] c"dat\00"
@__const.main.test_ext = [4 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0)]
@.str.5 = [4 x i8] c"nbo\00"
@.str.6 = [45 x i8] c"Extension(%s): %s / %s, Icon=%s, Version=%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.fte_data*
%3 = alloca [4 x i8*]
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store i32 0, i32* %1
%10 = call %struct.fte_data* @fte_init(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
store %struct.fte_data* %10, %struct.fte_data** %2
%11 = bitcast [4 x i8*]* %3 to i8*
store i32 0, i32* %4
br label %12
12: ; preds = %31, %0
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 4
br i1 %14, label %15, label %34
15: ; preds = %12
%16 = load %struct.fte_data*, %struct.fte_data** %2
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 %18
%20 = load i8*, i8** %19
%21 = call i32 @fte_getdescription(%struct.fte_data* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %20, i8** %5, i8** %6, i8** %7, i8** %8)
store i32 %21, i32* %9
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 %23
%25 = load i8*, i8** %24
%26 = load i8*, i8** %5
%27 = load i8*, i8** %6
%28 = load i8*, i8** %7
%29 = load i8*, i8** %8
%30 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0), i8* %25, i8* %26, i8* %27, i8* %28, i8* %29)
br label %31
31: ; preds = %15
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %12
34: ; preds = %12
%35 = load %struct.fte_data*, %struct.fte_data** %2
%36 = call i32 @fte_destroy(%struct.fte_data* %35)
%37 = load i32, i32* %1
ret i32 %37
}

LLVM IR (-O2):
%struct.fte_data = type { i32 }
@.str = [34 x i8] c"../../config/file_extensions.conf\00"
@.str.1 = [4 x i8] c"bmp\00"
@.str.2 = [5 x i8] c"docx\00"
@.str.3 = [4 x i8] c"doc\00"
@.str.4 = [4 x i8] c"dat\00"
@.str.5 = [4 x i8] c"nbo\00"
@.str.6 = [45 x i8] c"Extension(%s): %s / %s, Icon=%s, Version=%s\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = tail call %struct.fte_data* @fte_init(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%6 = bitcast i8** %1 to i8*
%7 = bitcast i8** %2 to i8*
%8 = bitcast i8** %3 to i8*
%9 = bitcast i8** %4 to i8*
%10 = call i32 @fte_getdescription(%struct.fte_data* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %1, i8** %2, i8** %3, i8** %4)
%11 = load i8*, i8** %1
%12 = load i8*, i8** %2
%13 = load i8*, i8** %3
%14 = load i8*, i8** %4
%15 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %11, i8* %12, i8* %13, i8* %14)
%16 = call i32 @fte_getdescription(%struct.fte_data* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %1, i8** %2, i8** %3, i8** %4)
%17 = load i8*, i8** %1
%18 = load i8*, i8** %2
%19 = load i8*, i8** %3
%20 = load i8*, i8** %4
%21 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %17, i8* %18, i8* %19, i8* %20)
%22 = call i32 @fte_getdescription(%struct.fte_data* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %1, i8** %2, i8** %3, i8** %4)
%23 = load i8*, i8** %1
%24 = load i8*, i8** %2
%25 = load i8*, i8** %3
%26 = load i8*, i8** %4
%27 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %23, i8* %24, i8* %25, i8* %26)
%28 = call i32 @fte_getdescription(%struct.fte_data* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8** %1, i8** %2, i8** %3, i8** %4)
%29 = load i8*, i8** %1
%30 = load i8*, i8** %2
%31 = load i8*, i8** %3
%32 = load i8*, i8** %4
%33 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %29, i8* %30, i8* %31, i8* %32)
%34 = call i32 @fte_destroy(%struct.fte_data* %5)
ret i32 0
}