#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 bitis_fileTypeModuleLE {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
struct bitis_fileTypeModuleLE *
bitis_GetModules(struct bitis_fileTypeModuleLE **);
int /*<<< orphan*/ bitis_addModulesToFile(struct bitis_fileTypeModuleLE *,
                                          int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int /*<<< orphan*/ *tmpfile();
FILE *bitis_GetModuleList() {
  struct bitis_fileTypeModuleLE *head, **orphans = 0;
  FILE *f = tmpfile();
  head = bitis_GetModules(orphans);
  bitis_addModulesToFile(head, f);
  fseek(f, 0, SEEK_SET);
  return f;
}


x86 assembly (clang, -O0):
<bitis_GetModuleList>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <tmpfile@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <bitis_GetModules@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <bitis_addModulesToFile@plt>
mov    -0x18(%rbp),%rdi
mov    0x2e60(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <fseek@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitis_GetModuleList>:
push   %rbx
xor    %eax,%eax
call   1030 <tmpfile@plt>
mov    %rax,%rbx
xor    %edi,%edi
call   1060 <bitis_GetModules@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1040 <bitis_addModulesToFile@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <fseek@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.bitis_fileTypeModuleLE = type { i32 }
@SEEK_SET = global i32 0
define i32* @bitis_GetModuleList() {
%1 = alloca %struct.bitis_fileTypeModuleLE*
%2 = alloca %struct.bitis_fileTypeModuleLE**
%3 = alloca i32*
store %struct.bitis_fileTypeModuleLE** null, %struct.bitis_fileTypeModuleLE*** %2
%4 = call i32* (...) @tmpfile()
store i32* %4, i32** %3
%5 = load %struct.bitis_fileTypeModuleLE**, %struct.bitis_fileTypeModuleLE*** %2
%6 = call %struct.bitis_fileTypeModuleLE* @bitis_GetModules(%struct.bitis_fileTypeModuleLE** %5)
store %struct.bitis_fileTypeModuleLE* %6, %struct.bitis_fileTypeModuleLE** %1
%7 = load %struct.bitis_fileTypeModuleLE*, %struct.bitis_fileTypeModuleLE** %1
%8 = load i32*, i32** %3
%9 = call i32 @bitis_addModulesToFile(%struct.bitis_fileTypeModuleLE* %7, i32* %8)
%10 = load i32*, i32** %3
%11 = load i32, i32* @SEEK_SET
%12 = call i32 @fseek(i32* %10, i32 0, i32 %11)
%13 = load i32*, i32** %3
ret i32* %13
}

LLVM IR (-O2):
%struct.bitis_fileTypeModuleLE = type { i32 }
@SEEK_SET = global i32 0
define i32* @bitis_GetModuleList() {
%1 = tail call i32* (...) @tmpfile()
%2 = tail call %struct.bitis_fileTypeModuleLE* @bitis_GetModules(%struct.bitis_fileTypeModuleLE** null)
%3 = tail call i32 @bitis_addModulesToFile(%struct.bitis_fileTypeModuleLE* %2, i32* %1)
%4 = load i32, i32* @SEEK_SET
%5 = tail call i32 @fseek(i32* %1, i32 0, i32 %4)
ret i32* %1
}