xunge/DecIR huggingface dataset:
int ZopfliGetDistSymbol(int dist) {
  if (dist < 5) {
    return dist - 1;
  }
  int l = (31 ^ __builtin_clz(dist - 1));
  int r = ((dist - 1) >> (l - 1)) & 1;
  return l * 2 + r;
}


x86 assembly (clang, -O0):
<ZopfliGetDistSymbol>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    111f <ZopfliGetDistSymbol+0x1f>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1151 <ZopfliGetDistSymbol+0x51>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
bsr    %eax,%eax
xor    $0x1f,%eax
xor    $0x1f,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
sar    %cl,%eax
and    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ZopfliGetDistSymbol>:
lea    -0x1(%rdi),%eax
cmp    $0x5,%edi
jl     111d <ZopfliGetDistSymbol+0x1d>
bsr    %eax,%edx
xor    $0x1f,%edx
mov    $0x1e,%cl
sub    %dl,%cl
shr    %cl,%eax
and    $0x1,%eax
lea    (%rax,%rdx,2),%eax
xor    $0x3e,%eax
ret

LLVM IR (-O0):
define i32 @ZopfliGetDistSymbol(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 5
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* %3
%10 = sub nsw i32 %9, 1
store i32 %10, i32* %2
br label %26
11: ; preds = %1
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, 1
%14 = call i32 @llvm.ctlz.i32(i32 %13, i1 true)
%15 = xor i32 31, %14
store i32 %15, i32* %4
%16 = load i32, i32* %3
%17 = sub nsw i32 %16, 1
%18 = load i32, i32* %4
%19 = sub nsw i32 %18, 1
%20 = ashr i32 %17, %19
%21 = and i32 %20, 1
store i32 %21, i32* %5
%22 = load i32, i32* %4
%23 = mul nsw i32 %22, 2
%24 = load i32, i32* %5
%25 = add nsw i32 %23, %24
store i32 %25, i32* %2
br label %26
26: ; preds = %11, %8
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
define i32 @ZopfliGetDistSymbol(i32 %0) {
%2 = icmp slt i32 %0, 5
%3 = add nsw i32 %0, -1
br i1 %2, label %12, label %4
4: ; preds = %1
%5 = tail call i32 @llvm.ctlz.i32(i32 %3, i1 true)
%6 = sub nsw i32 30, %5
%7 = lshr i32 %3, %6
%8 = and i32 %7, 1
%9 = shl nuw nsw i32 %5, 1
%10 = or i32 %8, %9
%11 = xor i32 %10, 62
br label %12
12: ; preds = %1, %4
%13 = phi i32 [ %11, %4 ], [ %3, %1 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void Example4() {
  int i = NULL;
  i = 80;
  printf("%d\n", i);
}


x86 assembly (clang, -O0):
<Example4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x50,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Example4>:
lea    0xee9(%rip),%rdi
mov    $0x50,%esi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define void @Example4() {
%1 = alloca i32
store i32 0, i32* %1
store i32 80, i32* %1
%2 = load i32, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @Example4() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 80)
ret void
}
/* Variables and functions */
void *calloc(int, int);
int /*<<< orphan*/ printf(char *);
int main(void) {
  void *mem = calloc(1000, 100000000);
  printf("mem: %p\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3e8,%edi
mov    $0x5f5e100,%esi
call   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"mem: %p\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* @calloc(i32 1000, i32 100000000)
store i8* %3, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"mem: %p\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_channel_map_init() {
  printf("NOT IMPLEMENTED:"
         "pa_channel_map_init"
         "\n");
}


x86 assembly (clang, -O0):
<pa_channel_map_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pa_channel_map_init>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"NOT IMPLEMENTED:pa_channel_map_init\0A\00"
define i32 @pa_channel_map_init() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [36 x i8] c"NOT IMPLEMENTED:pa_channel_map_init\00"
define i32 @pa_channel_map_init() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(int);
void offBeg() {
  char *p = malloc(15);
  p[-2] = 8;
  free(p);
}


x86 assembly (clang, -O0):
<offBeg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xf,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x8,-0x2(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<offBeg>:
push   %rax
mov    $0xf,%edi
call   1040 <malloc@plt>
movb   $0x8,-0x2(%rax)
mov    %rax,%rdi
pop    %rax
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @offBeg() {
%1 = alloca i8*
%2 = call i8* @malloc(i32 15)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = getelementptr inbounds i8, i8* %3, i64 -2
store i8 8, i8* %4
%5 = load i8*, i8** %1
%6 = call i32 @free(i8* %5)
ret void
}

LLVM IR (-O2):
define void @offBeg() {
%1 = tail call dereferenceable_or_null(15) i8* @malloc(i32 15)
%2 = getelementptr inbounds i8, i8* %1, i64 -2
store i8 8, i8* %2
%3 = tail call i32 @free(i8* %1)
ret void
}
/* Variables and functions */
int U_WMRCORENONE_get(char *);
int U_WMR7A_get(void) { return U_WMRCORENONE_get("U_WMR7A"); }


x86 assembly (clang, -O0):
<U_WMR7A_get>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <U_WMRCORENONE_get@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<U_WMR7A_get>:
lea    0xee9(%rip),%rdi
jmp    1030 <U_WMRCORENONE_get@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMR7A\00"
define i32 @U_WMR7A_get() {
%1 = call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMR7A\00"
define i32 @U_WMR7A_get() {
%1 = tail call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
void unrom_update() { return; }


x86 assembly (clang, -O0):
<unrom_update>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unrom_update>:
ret

LLVM IR (-O0):
define void @unrom_update() {
ret void
}

LLVM IR (-O2):
define void @unrom_update() {
ret void
}
int c030(void) { return 0; }


x86 assembly (clang, -O0):
<c030>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<c030>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @c030() {
ret i32 0
}

LLVM IR (-O2):
define i32 @c030() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ read_nonblock();
int /*<<< orphan*/ term_set_raw_mode();
void read_nonblock_rawmode(void) {
  term_set_raw_mode();
  read_nonblock();
}


x86 assembly (clang, -O0):
<read_nonblock_rawmode>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <term_set_raw_mode@plt>
mov    $0x0,%al
call   1040 <read_nonblock@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_nonblock_rawmode>:
push   %rax
xor    %eax,%eax
call   1030 <term_set_raw_mode@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <read_nonblock@plt>

LLVM IR (-O0):
define void @read_nonblock_rawmode() {
%1 = call i32 (...) @term_set_raw_mode()
%2 = call i32 (...) @read_nonblock()
ret void
}

LLVM IR (-O2):
define void @read_nonblock_rawmode() {
%1 = tail call i32 (...) @term_set_raw_mode()
%2 = tail call i32 (...) @read_nonblock()
ret void
}
unsigned int cpu_family(unsigned int eax) {
  unsigned family = (eax & 0xf00) >> 8;
  unsigned ext_family = (eax & 0xff00000) >> 20;
  return ext_family + family;
}


x86 assembly (clang, -O0):
<cpu_family>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf00,%eax
shr    $0x8,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff00000,%eax
shr    $0x14,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_family>:
mov    %edi,%ecx
shr    $0x8,%ecx
and    $0xf,%ecx
shr    $0x14,%edi
movzbl %dil,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @cpu_family(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = and i32 %5, 3840
%7 = lshr i32 %6, 8
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = and i32 %8, 267386880
%10 = lshr i32 %9, 20
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = add i32 %11, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @cpu_family(i32 %0) {
%2 = lshr i32 %0, 8
%3 = and i32 %2, 15
%4 = lshr i32 %0, 20
%5 = and i32 %4, 255
%6 = add nuw nsw i32 %5, %3
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ ERR_free_strings();
int /*<<< orphan*/ EVP_cleanup();
void DestroySSL() {
  ERR_free_strings();
  EVP_cleanup();
}


x86 assembly (clang, -O0):
<DestroySSL>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <ERR_free_strings@plt>
mov    $0x0,%al
call   1030 <EVP_cleanup@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<DestroySSL>:
push   %rax
xor    %eax,%eax
call   1040 <ERR_free_strings@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <EVP_cleanup@plt>

LLVM IR (-O0):
define void @DestroySSL() {
%1 = call i32 (...) @ERR_free_strings()
%2 = call i32 (...) @EVP_cleanup()
ret void
}

LLVM IR (-O2):
define void @DestroySSL() {
%1 = tail call i32 (...) @ERR_free_strings()
%2 = tail call i32 (...) @EVP_cleanup()
ret void
}
int MPI_Init(int *a, char ***b) { return 1; }


x86 assembly (clang, -O0):
<MPI_Init>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<MPI_Init>:
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @MPI_Init(i32* %0, i8*** %1) {
%3 = alloca i32*
%4 = alloca i8***
store i32* %0, i32** %3
store i8*** %1, i8**** %4
ret i32 1
}

LLVM IR (-O2):
define i32 @MPI_Init(i32* nocapture readnone %0, i8*** nocapture readnone %1) {
ret i32 1
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
bool SHAREMIND_MAP_KEY_EQUALS_uint8_t(uint8_t const k1, uint8_t const k2) {
  return k1 == k2;
}


x86 assembly (clang, -O0):
<SHAREMIND_MAP_KEY_EQUALS_uint8_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SHAREMIND_MAP_KEY_EQUALS_uint8_t>:
xor    %eax,%eax
cmp    %rsi,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @SHAREMIND_MAP_KEY_EQUALS_uint8_t(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp eq i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @SHAREMIND_MAP_KEY_EQUALS_uint8_t(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int LOGIN_NAME_MAX;
int getlogin_r(char *, int);
void test(void) {
  char loginnamebuffer[LOGIN_NAME_MAX];
  int result;
  result = getlogin_r(loginnamebuffer, LOGIN_NAME_MAX);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,%rsp
mov    %rax,-0x10(%rbp)
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
call   1030 <getlogin_r@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdi
mov    %rsi,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rdi
mov    %rdi,%rsp
call   1030 <getlogin_r@plt>
mov    %rbp,%rsp
pop    %rbp
ret

LLVM IR (-O0):
@LOGIN_NAME_MAX = global i32 0
define void @test() {
%1 = alloca i8*
%2 = alloca i64
%3 = alloca i32
%4 = load i32, i32* @LOGIN_NAME_MAX
%5 = zext i32 %4 to i64
%6 = call i8* @llvm.stacksave()
store i8* %6, i8** %1
%7 = alloca i8, i64 %5
store i64 %5, i64* %2
%8 = load i32, i32* @LOGIN_NAME_MAX
%9 = call i32 @getlogin_r(i8* %7, i32 %8)
store i32 %9, i32* %3
%10 = load i8*, i8** %1
ret void
}

LLVM IR (-O2):
@LOGIN_NAME_MAX = global i32 0
define void @test() {
%1 = load i32, i32* @LOGIN_NAME_MAX
%2 = zext i32 %1 to i64
%3 = alloca i8, i64 %2
%4 = call i32 @getlogin_r(i8* %3, i32 %1)
ret void
}
int __get_nprocs_conf(void) { return 1; }


x86 assembly (clang, -O0):
<__get_nprocs_conf>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__get_nprocs_conf>:
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @__get_nprocs_conf() {
ret i32 1
}

LLVM IR (-O2):
define i32 @__get_nprocs_conf() {
ret i32 1
}
void g_flags_get_value_by_name() {}


x86 assembly (clang, -O0):
<g_flags_get_value_by_name>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_flags_get_value_by_name>:
ret

LLVM IR (-O0):
define void @g_flags_get_value_by_name() {
ret void
}

LLVM IR (-O2):
define void @g_flags_get_value_by_name() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fwrite(void *, int, int, int /*<<< orphan*/ *);
int TgvLz_StoreFile(char *name, void *buf, int sz) {
  FILE *fd;
  fd = fopen(name, "wb");
  if (!fd)
    return (-1);
  fwrite(buf, 1, sz, fd);
  fclose(fd);
  return (0);
}


x86 assembly (clang, -O0):
<TgvLz_StoreFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    116e <TgvLz_StoreFile+0x3e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1193 <TgvLz_StoreFile+0x63>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    $0x1,%esi
call   1050 <fwrite@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TgvLz_StoreFile>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
lea    0xebf(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     116d <TgvLz_StoreFile+0x3d>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r14d,%edx
mov    %rax,%rcx
call   1050 <fwrite@plt>
mov    %rbp,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
jmp    1172 <TgvLz_StoreFile+0x42>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"wb\00"
define i32 @TgvLz_StoreFile(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%9 = load i8*, i8** %5
%10 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %10, i32** %8
%11 = load i32*, i32** %8
%12 = icmp ne i32* %11, null
br i1 %12, label %14, label %13
13: ; preds = %3
store i32 -1, i32* %4
br label %21
14: ; preds = %3
%15 = load i8*, i8** %6
%16 = load i32, i32* %7
%17 = load i32*, i32** %8
%18 = call i32 @fwrite(i8* %15, i32 1, i32 %16, i32* %17)
%19 = load i32*, i32** %8
%20 = call i32 @fclose(i32* %19)
store i32 0, i32* %4
br label %21
21: ; preds = %14, %13
%22 = load i32, i32* %4
ret i32 %22
}

LLVM IR (-O2):
@.str = [3 x i8] c"wb\00"
define i32 @TgvLz_StoreFile(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32 @fwrite(i8* %1, i32 1, i32 %2, i32* %4)
%8 = tail call i32 @fclose(i32* %4)
br label %9
9: ; preds = %3, %6
%10 = phi i32 [ 0, %6 ], [ -1, %3 ]
ret i32 %10
}
void test_two(int x, int y) {
#pragma omp simd
  for (int i = 0; i < x; i++)
    for (int i = 0; i < y; i++)
      ;
}


x86 assembly (clang, -O0):
<test_two>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1156 <test_two+0x56>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1143 <test_two+0x43>
jmp    1135 <test_two+0x35>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1124 <test_two+0x24>
jmp    1148 <test_two+0x48>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1111 <test_two+0x11>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_two>:
ret

LLVM IR (-O0):
define void @test_two(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %21, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %24
11: ; preds = %7
store i32 0, i32* %6
br label %12
12: ; preds = %17, %11
%13 = load i32, i32* %6
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %20
16: ; preds = %12
br label %17
17: ; preds = %16
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
br label %12
20: ; preds = %12
br label %21
21: ; preds = %20
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
store i32 %23, i32* %5
br label %7
24: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @test_two(i32 %0, i32 %1) {
ret void
}
unsigned char READ_INT_AS_CHAR(unsigned int *ptr, unsigned int offset) {
  return ((ptr[offset >> 2] >> (((offset & 0x3) << 3))) & 0xff);
}


x86 assembly (clang, -O0):
<READ_INT_AS_CHAR>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shr    $0x2,%ecx
mov    %ecx,%ecx
mov    (%rax,%rcx,4),%eax
mov    -0xc(%rbp),%ecx
and    $0x3,%ecx
shl    $0x3,%ecx
shr    %cl,%eax
and    $0xff,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<READ_INT_AS_CHAR>:
lea    0x0(,%rsi,8),%ecx
and    $0xfffffffc,%esi
mov    (%rdi,%rsi,1),%eax
shr    %cl,%eax
ret

LLVM IR (-O0):
define zeroext i8 @READ_INT_AS_CHAR(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %4
%7 = lshr i32 %6, 2
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %5, i64 %8
%10 = load i32, i32* %9
%11 = load i32, i32* %4
%12 = and i32 %11, 3
%13 = shl i32 %12, 3
%14 = lshr i32 %10, %13
%15 = and i32 %14, 255
%16 = trunc i32 %15 to i8
ret i8 %16
}

LLVM IR (-O2):
define zeroext i8 @READ_INT_AS_CHAR(i32* nocapture %0, i32 %1) {
%3 = lshr i32 %1, 2
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = shl i32 %1, 3
%8 = and i32 %7, 24
%9 = lshr i32 %6, %8
%10 = trunc i32 %9 to i8
ret i8 %10
}
void linux_fetch_registers(int regno) {}


x86 assembly (clang, -O0):
<linux_fetch_registers>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<linux_fetch_registers>:
ret

LLVM IR (-O0):
define void @linux_fetch_registers(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @linux_fetch_registers(i32 %0) {
ret void
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
void BFD_TIMEVAL2US(struct timeval *ptv, unsigned int *pus) {
  if (ptv && pus) {
    *pus = ptv->tv_sec * (1000000) + ptv->tv_usec;
  }
}


x86 assembly (clang, -O0):
<BFD_TIMEVAL2US>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1139 <BFD_TIMEVAL2US+0x39>
cmpq   $0x0,-0x10(%rbp)
je     1139 <BFD_TIMEVAL2US+0x39>
mov    -0x8(%rbp),%rax
imul   $0xf4240,(%rax),%ecx
mov    -0x8(%rbp),%rax
add    0x4(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<BFD_TIMEVAL2US>:
test   %rdi,%rdi
je     1115 <BFD_TIMEVAL2US+0x15>
test   %rsi,%rsi
je     1115 <BFD_TIMEVAL2US+0x15>
imul   $0xf4240,(%rdi),%eax
add    0x4(%rdi),%eax
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define void @BFD_TIMEVAL2US(%struct.timeval* %0, i32* %1) {
%3 = alloca %struct.timeval*
%4 = alloca i32*
store %struct.timeval* %0, %struct.timeval** %3
store i32* %1, i32** %4
%5 = load %struct.timeval*, %struct.timeval** %3
%6 = icmp ne %struct.timeval* %5, null
br i1 %6, label %7, label %20
7: ; preds = %2
%8 = load i32*, i32** %4
%9 = icmp ne i32* %8, null
br i1 %9, label %10, label %20
10: ; preds = %7
%11 = load %struct.timeval*, %struct.timeval** %3
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = mul nsw i32 %13, 1000000
%15 = load %struct.timeval*, %struct.timeval** %3
%16 = getelementptr inbounds %struct.timeval, %struct.timeval* %15, i32 0, i32 1
%17 = load i32, i32* %16
%18 = add nsw i32 %14, %17
%19 = load i32*, i32** %4
store i32 %18, i32* %19
br label %20
20: ; preds = %10, %7, %2
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define void @BFD_TIMEVAL2US(%struct.timeval* %0, i32* writeonly %1) {
%3 = icmp ne %struct.timeval* %0, null
%4 = icmp ne i32* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %13
6: ; preds = %2
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%8 = load i32, i32* %7
%9 = mul nsw i32 %8, 1000000
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%11 = load i32, i32* %10
%12 = add nsw i32 %9, %11
store i32 %12, i32* %1
br label %13
13: ; preds = %6, %2
ret void
}
float foo001(float a, float b, double c) { return (a + b * c); }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movsd  %xmm2,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @foo001(float %0, float %1, double %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca double
store float %0, float* %4
store float %1, float* %5
store double %2, double* %6
%7 = load float, float* %4
%8 = fpext float %7 to double
%9 = load float, float* %5
%10 = fpext float %9 to double
%11 = load double, double* %6
%12 = call double @llvm.fmuladd.f64(double %10, double %11, double %8)
%13 = fptrunc double %12 to float
ret float %13
}

LLVM IR (-O2):
define float @foo001(float %0, float %1, double %2) {
%4 = fpext float %0 to double
%5 = fpext float %1 to double
%6 = tail call double @llvm.fmuladd.f64(double %5, double %2, double %4)
%7 = fptrunc double %6 to float
ret float %7
}
/* Type definitions */
typedef int /*<<< orphan*/ state;

/* Variables and functions */
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ TCP_CORK;
int /*<<< orphan*/ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              int *, int);
void set_tcp_cork(int fd) {
  int state = 1;
  setsockopt(fd, IPPROTO_TCP, TCP_CORK, &state, sizeof(state));
}


x86 assembly (clang, -O0):
<set_tcp_cork>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebc(%rip),%rax
mov    (%rax),%esi
mov    0x2eab(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_tcp_cork>:
push   %rax
movl   $0x1,0x4(%rsp)
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
mov    0x2eb7(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
pop    %rax
ret

LLVM IR (-O0):
@IPPROTO_TCP = global i32 0
@TCP_CORK = global i32 0
define void @set_tcp_cork(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* @IPPROTO_TCP
%6 = load i32, i32* @TCP_CORK
%7 = call i32 @setsockopt(i32 %4, i32 %5, i32 %6, i32* %3, i32 4)
ret void
}

LLVM IR (-O2):
@IPPROTO_TCP = global i32 0
@TCP_CORK = global i32 0
define void @set_tcp_cork(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%4 = load i32, i32* @IPPROTO_TCP
%5 = load i32, i32* @TCP_CORK
%6 = call i32 @setsockopt(i32 %0, i32 %4, i32 %5, i32* %2, i32 4)
ret void
}
/* Type definitions */
struct s {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int s_cat_u4_hex(struct s *, int /*<<< orphan*/);
int /*<<< orphan*/ s_catn(struct s *, char *, int);
int s_cat_i4_hex(struct s *s, int32_t v) {
  int i = 0;
  if (v < 0) {
    i++;
    s_catn(s, "-", 1);
    v = -v;
  }
  return s_cat_u4_hex(s, v) + i;
}


x86 assembly (clang, -O0):
<s_cat_i4_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1166 <s_cat_i4_hex+0x46>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeac(%rip),%rsi
mov    $0x1,%edx
call   1030 <s_catn@plt>
xor    %eax,%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <s_cat_u4_hex@plt>
add    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_cat_i4_hex>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %rdi,%r14
xor    %ebp,%ebp
test   %esi,%esi
jns    114a <s_cat_i4_hex+0x2a>
lea    0xeca(%rip),%rsi
mov    $0x1,%ebp
mov    %r14,%rdi
mov    $0x1,%edx
call   1030 <s_catn@plt>
neg    %ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <s_cat_u4_hex@plt>
add    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.s = type { i32 }
@.str = [2 x i8] c"-\00"
define i32 @s_cat_i4_hex(%struct.s* %0, i32 %1) {
%3 = alloca %struct.s*
%4 = alloca i32
%5 = alloca i32
store %struct.s* %0, %struct.s** %3
store i32 %1, i32* %4
store i32 0, i32* %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load i32, i32* %5
%10 = add nsw i32 %9, 1
store i32 %10, i32* %5
%11 = load %struct.s*, %struct.s** %3
%12 = call i32 @s_catn(%struct.s* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%13 = load i32, i32* %4
%14 = sub nsw i32 0, %13
store i32 %14, i32* %4
br label %15
15: ; preds = %8, %2
%16 = load %struct.s*, %struct.s** %3
%17 = load i32, i32* %4
%18 = call i32 @s_cat_u4_hex(%struct.s* %16, i32 %17)
%19 = load i32, i32* %5
%20 = add nsw i32 %18, %19
ret i32 %20
}

LLVM IR (-O2):
%struct.s = type { i32 }
@.str = [2 x i8] c"-\00"
define i32 @s_cat_i4_hex(%struct.s* %0, i32 %1) {
%3 = icmp slt i32 %1, 0
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @s_catn(%struct.s* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%6 = sub nsw i32 0, %1
br label %7
7: ; preds = %4, %2
%8 = phi i32 [ %6, %4 ], [ %1, %2 ]
%9 = phi i32 [ 1, %4 ], [ 0, %2 ]
%10 = tail call i32 @s_cat_u4_hex(%struct.s* %0, i32 %8)
%11 = add nsw i32 %10, %9
ret i32 %11
}
/* Type definitions */
struct pmd_part {
  int dummy;
};
struct fmdriver_work {
  int dummy;
};
struct driver_pmd {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ pmd_part_cmdload(struct driver_pmd *, struct pmd_part *);
void pmd_cmd_null_3(struct fmdriver_work *work, struct driver_pmd *pmd,
                    struct pmd_part *part) {
  (void)work;
  for (int i = 0; i < 3; i++) {
    pmd_part_cmdload(pmd, part);
  }
}


x86 assembly (clang, -O0):
<pmd_cmd_null_3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    1150 <pmd_cmd_null_3+0x40>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <pmd_part_cmdload@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112b <pmd_cmd_null_3+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmd_cmd_null_3>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1030 <pmd_part_cmdload@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <pmd_part_cmdload@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <pmd_part_cmdload@plt>

LLVM IR (-O0):
%struct.fmdriver_work = type { i32 }
%struct.driver_pmd = type { i32 }
%struct.pmd_part = type { i32 }
define void @pmd_cmd_null_3(%struct.fmdriver_work* %0, %struct.driver_pmd* %1, %struct.pmd_part* %2) {
%4 = alloca %struct.fmdriver_work*
%5 = alloca %struct.driver_pmd*
%6 = alloca %struct.pmd_part*
%7 = alloca i32
store %struct.fmdriver_work* %0, %struct.fmdriver_work** %4
store %struct.driver_pmd* %1, %struct.driver_pmd** %5
store %struct.pmd_part* %2, %struct.pmd_part** %6
%8 = load %struct.fmdriver_work*, %struct.fmdriver_work** %4
store i32 0, i32* %7
br label %9
9: ; preds = %16, %3
%10 = load i32, i32* %7
%11 = icmp slt i32 %10, 3
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = load %struct.driver_pmd*, %struct.driver_pmd** %5
%14 = load %struct.pmd_part*, %struct.pmd_part** %6
%15 = call i32 @pmd_part_cmdload(%struct.driver_pmd* %13, %struct.pmd_part* %14)
br label %16
16: ; preds = %12
%17 = load i32, i32* %7
%18 = add nsw i32 %17, 1
store i32 %18, i32* %7
br label %9
19: ; preds = %9
ret void
}

LLVM IR (-O2):
%struct.fmdriver_work = type { i32 }
%struct.driver_pmd = type { i32 }
%struct.pmd_part = type { i32 }
define void @pmd_cmd_null_3(%struct.fmdriver_work* nocapture readnone %0, %struct.driver_pmd* %1, %struct.pmd_part* %2) {
%4 = tail call i32 @pmd_part_cmdload(%struct.driver_pmd* %1, %struct.pmd_part* %2)
%5 = tail call i32 @pmd_part_cmdload(%struct.driver_pmd* %1, %struct.pmd_part* %2)
%6 = tail call i32 @pmd_part_cmdload(%struct.driver_pmd* %1, %struct.pmd_part* %2)
ret void
}
int A(int m, int n) {
  if (m == 0)
    return n + 1;
  else if (n == 0)
    return A(m - 1, 1);
  else
    return A(m - 1, A(m, n - 1));
}


x86 assembly (clang, -O0):
<A>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1136 <A+0x26>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    117c <A+0x6c>
cmpl   $0x0,-0xc(%rbp)
jne    1158 <A+0x48>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    $0x1,%esi
call   1030 <A@plt>
mov    %eax,-0x4(%rbp)
jmp    117c <A+0x6c>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1030 <A@plt>
mov    -0x10(%rbp),%edi
mov    %eax,%esi
call   1030 <A@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<A>:
push   %rbx
mov    %esi,%eax
test   %edi,%edi
je     113f <A+0x2f>
mov    %edi,%ebx
jmp    112a <A+0x1a>
nopl   0x0(%rax,%rax,1)
mov    $0x1,%eax
add    $0xffffffff,%ebx
je     113f <A+0x2f>
test   %eax,%eax
je     1120 <A+0x10>
add    $0xffffffff,%eax
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <A@plt>
add    $0xffffffff,%ebx
jne    112a <A+0x1a>
add    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @A(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* %5
%10 = add nsw i32 %9, 1
store i32 %10, i32* %3
br label %26
11: ; preds = %2
%12 = load i32, i32* %5
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i32, i32* %4
%16 = sub nsw i32 %15, 1
%17 = call i32 @A(i32 %16, i32 1)
store i32 %17, i32* %3
br label %26
18: ; preds = %11
%19 = load i32, i32* %4
%20 = sub nsw i32 %19, 1
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = sub nsw i32 %22, 1
%24 = call i32 @A(i32 %21, i32 %23)
%25 = call i32 @A(i32 %20, i32 %24)
store i32 %25, i32* %3
br label %26
26: ; preds = %18, %14, %8
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @A(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %7
4: ; preds = %11, %2
%5 = phi i32 [ %1, %2 ], [ %12, %11 ]
%6 = add nsw i32 %5, 1
ret i32 %6
7: ; preds = %2, %11
%8 = phi i32 [ %12, %11 ], [ %1, %2 ]
%9 = phi i32 [ %13, %11 ], [ %0, %2 ]
%10 = icmp eq i32 %8, 0
br i1 %10, label %11, label %15
11: ; preds = %7, %15
%12 = phi i32 [ %17, %15 ], [ 1, %7 ]
%13 = add nsw i32 %9, -1
%14 = icmp eq i32 %13, 0
br i1 %14, label %4, label %7
15: ; preds = %7
%16 = add nsw i32 %8, -1
%17 = tail call i32 @A(i32 %9, i32 %16)
br label %11
}
/* Variables and functions */
int __builtin_mips_cabs_le_d(double, double);
int test14(double a, double b) { return __builtin_mips_cabs_le_d(a, b); }


x86 assembly (clang, -O0):
<test14>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <__builtin_mips_cabs_le_d@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test14>:
jmp    1030 <__builtin_mips_cabs_le_d@plt>

LLVM IR (-O0):
define i32 @test14(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = call i32 @__builtin_mips_cabs_le_d(double %5, double %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @test14(double %0, double %1) {
%3 = tail call i32 @__builtin_mips_cabs_le_d(double %0, double %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void *realloc(void *, int);
void *sqlite3GenericRealloc(void *p, int n) {
  assert(n > 0);
  p = realloc(p, n);
  return p;
}


x86 assembly (clang, -O0):
<sqlite3GenericRealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqlite3GenericRealloc>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
xor    %edi,%edi
test   %esi,%esi
setg   %dil
call   1030 <assert@plt>
mov    %r14,%rdi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <realloc@plt>

LLVM IR (-O0):
define i8* @sqlite3GenericRealloc(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp sgt i32 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = call i8* @realloc(i8* %9, i32 %10)
store i8* %11, i8** %3
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
define i8* @sqlite3GenericRealloc(i8* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i8* @realloc(i8* %0, i32 %1)
ret i8* %6
}
/* Type definitions */
struct packet {
  int dummy;
};

/* Variables and functions */
unsigned char *create_kv_packet(unsigned char const *, int,
                                unsigned char const *, size_t, struct packet *,
                                unsigned char *);
unsigned char *create_location_packet(const unsigned char *location,
                                      size_t location_sz, struct packet *pkt,
                                      unsigned char *ptr) {
  return create_kv_packet((const unsigned char *)"location",
                          (sizeof("location") - 1), location, location_sz, pkt,
                          ptr);
}


x86 assembly (clang, -O0):
<create_location_packet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
lea    0xec1(%rip),%rdi
mov    $0x8,%esi
call   1030 <create_kv_packet@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_location_packet>:
mov    %rcx,%r9
mov    %rdx,%r8
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xedd(%rip),%rdi
mov    $0x8,%esi
jmp    1030 <create_kv_packet@plt>

LLVM IR (-O0):
%struct.packet = type { i32 }
@.str = [9 x i8] c"location\00"
define i8* @create_location_packet(i8* %0, i64 %1, %struct.packet* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca %struct.packet*
%8 = alloca i8*
store i8* %0, i8** %5
store i64 %1, i64* %6
store %struct.packet* %2, %struct.packet** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load %struct.packet*, %struct.packet** %7
%12 = load i8*, i8** %8
%13 = call i8* @create_kv_packet(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 8, i8* %9, i64 %10, %struct.packet* %11, i8* %12)
ret i8* %13
}

LLVM IR (-O2):
%struct.packet = type { i32 }
@.str = [9 x i8] c"location\00"
define i8* @create_location_packet(i8* %0, i64 %1, %struct.packet* %2, i8* %3) {
%5 = tail call i8* @create_kv_packet(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 8, i8* %0, i64 %1, %struct.packet* %2, i8* %3)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ benchmark(int, char **);
int main(int argc, char **argv) { benchmark(argc, argv); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <benchmark@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1030 <benchmark@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = load i8**, i8*** %4
%7 = call i32 @benchmark(i32 %5, i8** %6)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @benchmark(i32 %0, i8** %1)
ret i32 0
}
void XChangeKeyboardMapping() {}


x86 assembly (clang, -O0):
<XChangeKeyboardMapping>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XChangeKeyboardMapping>:
ret

LLVM IR (-O0):
define void @XChangeKeyboardMapping() {
ret void
}

LLVM IR (-O2):
define void @XChangeKeyboardMapping() {
ret void
}
/* Variables and functions */
unsigned long g(long, int);
unsigned long f(long int a) { return g(a, 1 << 13); }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2000,%esi
call   1030 <g@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    $0x2000,%esi
jmp    1030 <g@plt>

LLVM IR (-O0):
define i64 @f(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 @g(i64 %3, i32 8192)
ret i64 %4
}

LLVM IR (-O2):
define i64 @f(i64 %0) {
%2 = tail call i64 @g(i64 %0, i32 8192)
ret i64 %2
}
float clamp_range_f(const float x, const float low, const float high) {
  return x > high ? high : (x < low ? low : x);
}


x86 assembly (clang, -O0):
<clamp_range_f>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1131 <clamp_range_f+0x31>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1167 <clamp_range_f+0x67>
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1153 <clamp_range_f+0x53>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    115d <clamp_range_f+0x5d>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp_range_f>:
maxss  %xmm0,%xmm1
movaps %xmm2,%xmm3
cmpltss %xmm0,%xmm3
movaps %xmm3,%xmm0
andnps %xmm1,%xmm0
andps  %xmm2,%xmm3
orps   %xmm0,%xmm3
movaps %xmm3,%xmm0
ret

LLVM IR (-O0):
define float @clamp_range_f(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %6
%9 = fcmp ogt float %7, %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = load float, float* %6
br label %22
12: ; preds = %3
%13 = load float, float* %4
%14 = load float, float* %5
%15 = fcmp olt float %13, %14
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = load float, float* %5
br label %20
18: ; preds = %12
%19 = load float, float* %4
br label %20
20: ; preds = %18, %16
%21 = phi float [ %17, %16 ], [ %19, %18 ]
br label %22
22: ; preds = %20, %10
%23 = phi float [ %11, %10 ], [ %21, %20 ]
ret float %23
}

LLVM IR (-O2):
define float @clamp_range_f(float %0, float %1, float %2) {
%4 = fcmp ogt float %0, %2
%5 = fcmp olt float %0, %1
%6 = select i1 %5, float %1, float %0
%7 = select i1 %4, float %2, float %6
ret float %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int fac(int n);
  int n;
  int y;
  printf("input an number:");
  scanf("%d", &n);
  y = fac(n);
  printf("%d!=%d\n", n, y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xebd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1030 <fac@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecb(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1030 <fac@plt>
mov    0x4(%rsp),%esi
lea    0xeb0(%rip),%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"input an number:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [8 x i8] c"%d!=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = call i32 @fac(i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"input an number:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [8 x i8] c"%d!=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @fac(i32 %5)
%7 = load i32, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %6)
ret i32 0
}
double sum(int n) {
  double tmp;
  if (n == 2)
    return 0.5;
  tmp = 1 / (double)n + sum(n - 1);
  return tmp;
}


x86 assembly (clang, -O0):
<sum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jne    1137 <sum+0x27>
movsd  0xedb(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1173 <sum+0x63>
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xebc(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
call   1030 <sum@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum>:
push   %rax
cmp    $0x2,%edi
jne    1120 <sum+0x10>
movsd  0xee2(%rip),%xmm0
pop    %rax
ret
cvtsi2sd %edi,%xmm0
movsd  0xedc(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
add    $0xffffffff,%edi
call   1030 <sum@plt>
addsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @sum(i32 %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca double
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %8
7: ; preds = %1
store double 5.000000e-01, double* %2
br label %17
8: ; preds = %1
%9 = load i32, i32* %3
%10 = sitofp i32 %9 to double
%11 = fdiv double 1.000000e+00, %10
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, 1
%14 = call double @sum(i32 %13)
%15 = fadd double %11, %14
store double %15, double* %4
%16 = load double, double* %4
store double %16, double* %2
br label %17
17: ; preds = %8, %7
%18 = load double, double* %2
ret double %18
}

LLVM IR (-O2):
define double @sum(i32 %0) {
%2 = icmp eq i32 %0, 2
br i1 %2, label %3, label %5
3: ; preds = %1, %5
%4 = phi double [ %10, %5 ], [ 5.000000e-01, %1 ]
ret double %4
5: ; preds = %1
%6 = sitofp i32 %0 to double
%7 = fdiv double 1.000000e+00, %6
%8 = add nsw i32 %0, -1
%9 = tail call double @sum(i32 %8)
%10 = fadd double %7, %9
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ ol(char *);
m_and() { ol("AND  AX,BX"); }


x86 assembly (clang, -O0):
<m_and>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <ol@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_and>:
lea    0xee9(%rip),%rdi
jmp    1030 <ol@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"AND AX,BX\00"
define i32 @m_and() {
%1 = alloca i32
%2 = call i32 @ol(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [11 x i8] c"AND AX,BX\00"
define i32 @m_and() {
%1 = tail call i32 @ol(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
int sbpEnd() { return 0; }


x86 assembly (clang, -O0):
<sbpEnd>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sbpEnd>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @sbpEnd() {
ret i32 0
}

LLVM IR (-O2):
define i32 @sbpEnd() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_rwlock_t;

/* Variables and functions */
int EINVAL;
int pthread_rwlock_always_fail_EINVAL(pthread_rwlock_t *rwlock) {
  return EINVAL;
}


x86 assembly (clang, -O0):
<pthread_rwlock_always_fail_EINVAL>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_rwlock_always_fail_EINVAL>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @pthread_rwlock_always_fail_EINVAL(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32, i32* @EINVAL
ret i32 %3
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @pthread_rwlock_always_fail_EINVAL(i32* nocapture readnone %0) {
%2 = load i32, i32* @EINVAL
ret i32 %2
}