xunge/DecIR huggingface dataset:
/* Type definitions */
struct fid_domain {
  int dummy;
};
struct fid_cntr {
  int dummy;
};
struct fi_cntr_attr {
  int dummy;
};

/* Variables and functions */
int gnix_cntr_open(struct fid_domain *, struct fi_cntr_attr *,
                   struct fid_cntr **, void *);
int fi_cntr_open(struct fid_domain *domain, struct fi_cntr_attr *attr,
                 struct fid_cntr **cntr, void *context) {
  return gnix_cntr_open(domain, attr, cntr, context);
}


x86 assembly (clang, -O0):
<fi_cntr_open>:
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),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <gnix_cntr_open@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fi_cntr_open>:
jmp    1030 <gnix_cntr_open@plt>

LLVM IR (-O0):
%struct.fid_domain = type { i32 }
%struct.fi_cntr_attr = type { i32 }
%struct.fid_cntr = type { i32 }
define i32 @fi_cntr_open(%struct.fid_domain* %0, %struct.fi_cntr_attr* %1, %struct.fid_cntr** %2, i8* %3) {
%5 = alloca %struct.fid_domain*
%6 = alloca %struct.fi_cntr_attr*
%7 = alloca %struct.fid_cntr**
%8 = alloca i8*
store %struct.fid_domain* %0, %struct.fid_domain** %5
store %struct.fi_cntr_attr* %1, %struct.fi_cntr_attr** %6
store %struct.fid_cntr** %2, %struct.fid_cntr*** %7
store i8* %3, i8** %8
%9 = load %struct.fid_domain*, %struct.fid_domain** %5
%10 = load %struct.fi_cntr_attr*, %struct.fi_cntr_attr** %6
%11 = load %struct.fid_cntr**, %struct.fid_cntr*** %7
%12 = load i8*, i8** %8
%13 = call i32 @gnix_cntr_open(%struct.fid_domain* %9, %struct.fi_cntr_attr* %10, %struct.fid_cntr** %11, i8* %12)
ret i32 %13
}

LLVM IR (-O2):
%struct.fid_domain = type { i32 }
%struct.fi_cntr_attr = type { i32 }
%struct.fid_cntr = type { i32 }
define i32 @fi_cntr_open(%struct.fid_domain* %0, %struct.fi_cntr_attr* %1, %struct.fid_cntr** %2, i8* %3) {
%5 = tail call i32 @gnix_cntr_open(%struct.fid_domain* %0, %struct.fi_cntr_attr* %1, %struct.fid_cntr** %2, i8* %3)
ret i32 %5
}
void finn_vec2_up(float *result) {
  result[0] = 0;
  result[1] = 1;
}


x86 assembly (clang, -O0):
<finn_vec2_up>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  0xee1(%rip),%xmm0
movss  %xmm0,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<finn_vec2_up>:
movabs $0x3f80000000000000,%rax
mov    %rax,(%rdi)
ret

LLVM IR (-O0):
define void @finn_vec2_up(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
%4 = getelementptr inbounds float, float* %3, i64 0
store float 0.000000e+00, float* %4
%5 = load float*, float** %2
%6 = getelementptr inbounds float, float* %5, i64 1
store float 1.000000e+00, float* %6
ret void
}

LLVM IR (-O2):
define void @finn_vec2_up(float* nocapture writeonly %0) {
store float 0.000000e+00, float* %0
%2 = getelementptr inbounds float, float* %0, i64 1
store float 1.000000e+00, float* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void version(void) {
  printf("\n\n\t\t\tStudents Grade Average Program\n"
         "\t\t\t\tVersion: 1.000\n"
         "\t\t\t      Copyright (c) 2013\n");
  exit(0);
}


x86 assembly (clang, -O0):
<version>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<version>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [84 x i8] c"\0A\0A\09\09\09Students Grade Average Program\0A\09\09\09\09Version: 1.000\0A\09\09\09 Copyright (c) 2013\0A\00"
define void @version() {
%1 = call i32 @printf(i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [83 x i8] c"\0A\0A\09\09\09Students Grade Average Program\0A\09\09\09\09Version: 1.000\0A\09\09\09 Copyright (c) 2013\00"
define void @version() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([83 x i8], [83 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
void bar(int k) {
  void *label = (k) ? &&x : &&y;
  if (k)
    goto *label;
x:
  if (k)
    dont_remove();
y:
  return;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
test   %eax,%eax
lea    0x2b(%rip),%rcx
lea    0x3a(%rip),%rax
cmovne %rcx,%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     114d <bar+0x3d>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    116e <bar+0x5e>
jmp    1152 <bar+0x42>
cmpl   $0x0,-0x4(%rbp)
je     1163 <bar+0x53>
mov    $0x0,%al
call   1030 <dont_remove@plt>
jmp    1168 <bar+0x58>
add    $0x20,%rsp
pop    %rbp
ret
mov    -0x18(%rbp),%rax
jmp    *%rax

x86 assembly (clang, -O2):
<bar>:
test   %edi,%edi
je     111b <bar+0xb>
xor    %eax,%eax
jmp    1030 <dont_remove@plt>
ret

LLVM IR (-O0):
define void @bar(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i8* blockaddress(@bar, %13), i8* blockaddress(@bar, %19)
store i8* %7, i8** %3
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load i8*, i8** %3
br label %20
12: ; preds = %1
br label %13
13: ; preds = %12, %20
%14 = load i32, i32* %2
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 (...) @dont_remove()
br label %18
18: ; preds = %16, %13
br label %19
19: ; preds = %18, %20
ret void
20: ; preds = %10
%21 = phi i8* [ %11, %10 ]
indirectbr i8* %21, [label %13, label %19]
}

LLVM IR (-O2):
define void @bar(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @dont_remove()
br label %5
5: ; preds = %1, %3
ret void
}
__attribute__((no)) void dummywrite(char *arr, int i) { arr[i] = (char)i; }


x86 assembly (clang, -O0):
<dummywrite>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<dummywrite>:
movslq %esi,%rax
mov    %sil,(%rdi,%rax,1)
ret

LLVM IR (-O0):
define void @dummywrite(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 = trunc i32 %5 to i8
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
store i8 %6, i8* %10
ret void
}

LLVM IR (-O2):
define void @dummywrite(i8* nocapture writeonly %0, i32 %1) {
%3 = trunc i32 %1 to i8
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
store i8 %3, i8* %5
ret void
}
/* Variables and functions */
char toupper(char);
char charMaiusculo(char caracter) { return toupper(caracter); }


x86 assembly (clang, -O0):
<charMaiusculo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <toupper@plt>
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<charMaiusculo>:
jmp    1030 <toupper@plt>

LLVM IR (-O0):
define signext i8 @charMaiusculo(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call signext i8 @toupper(i8 signext %3)
ret i8 %4
}

LLVM IR (-O2):
define signext i8 @charMaiusculo(i8 signext %0) {
%2 = tail call signext i8 @toupper(i8 signext %0)
ret i8 %2
}
/* Variables and functions */
char *parse_bencode_string(char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char *test = "4:spam";
  printf("%s\n", parse_bencode_string(test));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <parse_bencode_string@plt>
mov    %rax,%rsi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"4:spam\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call i8* @parse_bencode_string(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void dummy_motors_enable(void *user, char b) {
  fprintf(stderr, "GCodeParser: %s motors\n", b ? "enable" : "disable");
}


x86 assembly (clang, -O0):
<dummy_motors_enable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    0x2eb7(%rip),%rax
mov    (%rax),%edi
movsbl -0x9(%rbp),%ecx
lea    0xee9(%rip),%rdx
lea    0xedb(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xeb5(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dummy_motors_enable>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
test   %sil,%sil
lea    0xefc(%rip),%rax
lea    0xeee(%rip),%rdx
cmove  %rax,%rdx
lea    0xecb(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"GCodeParser: %s motors\0A\00"
@.str.1 = [7 x i8] c"enable\00"
@.str.2 = [8 x i8] c"disable\00"
define void @dummy_motors_enable(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i32, i32* @stderr
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%11 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %10)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"GCodeParser: %s motors\0A\00"
@.str.1 = [7 x i8] c"enable\00"
@.str.2 = [8 x i8] c"disable\00"
define void @dummy_motors_enable(i8* nocapture readnone %0, i8 signext %1) {
%3 = load i32, i32* @stderr
%4 = icmp eq i8 %1, 0
%5 = select i1 %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0)
%6 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}
/* Type definitions */
typedef char uint8_t;

/* Variables and functions */
uint8_t _int(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  if (c >= 'A' && c <= 'F') {
    return c - 'A' + 0xA;
  }
  return 0;
}


x86 assembly (clang, -O0):
<_int>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x30,%eax
jl     1133 <_int+0x33>
movsbl -0x2(%rbp),%eax
cmp    $0x39,%eax
jg     1133 <_int+0x33>
movsbl -0x2(%rbp),%eax
sub    $0x30,%eax
mov    %al,-0x1(%rbp)
jmp    1163 <_int+0x63>
movsbl -0x2(%rbp),%eax
cmp    $0x41,%eax
jl     115f <_int+0x5f>
movsbl -0x2(%rbp),%eax
cmp    $0x46,%eax
jg     115f <_int+0x5f>
movsbl -0x2(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %al,-0x1(%rbp)
jmp    1163 <_int+0x63>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_int>:
lea    -0x30(%rdi),%eax
lea    -0x41(%rdi),%ecx
add    $0xc9,%dil
xor    %edx,%edx
cmp    $0x6,%cl
movzbl %dil,%ecx
cmovae %edx,%ecx
cmp    $0xa,%al
movzbl %al,%eax
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define signext i8 @_int(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 48
%15 = trunc i32 %14 to i8
store i8 %15, i8* %2
br label %31
16: ; preds = %7, %1
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = icmp sge i32 %18, 65
br i1 %19, label %20, label %30
20: ; preds = %16
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = icmp sle i32 %22, 70
br i1 %23, label %24, label %30
24: ; preds = %20
%25 = load i8, i8* %3
%26 = sext i8 %25 to i32
%27 = sub nsw i32 %26, 65
%28 = add nsw i32 %27, 10
%29 = trunc i32 %28 to i8
store i8 %29, i8* %2
br label %31
30: ; preds = %20, %16
store i8 0, i8* %2
br label %31
31: ; preds = %30, %24, %11
%32 = load i8, i8* %2
ret i8 %32
}

LLVM IR (-O2):
define signext i8 @_int(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = add i8 %0, -65
%5 = icmp ult i8 %4, 6
%6 = add i8 %0, -55
%7 = select i1 %5, i8 %6, i8 0
%8 = select i1 %3, i8 %2, i8 %7
ret i8 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ bench_small(int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  srand(time(NULL));
  FILE *outf = fopen("testout.txt", "w");
  bench_small(outf);
  fclose(outf);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0xe91(%rip),%rdi
lea    0xe96(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <bench_small@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0xe9a(%rip),%rdi
lea    0xe9f(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <bench_small@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"testout.txt\00"
@.str.1 = [2 x i8] c"w\00"
define i32 @main() {
%1 = alloca i32*
%2 = call i32 @time(i32* null)
%3 = call i32 @srand(i32 %2)
%4 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %1
%5 = load i32*, i32** %1
%6 = call i32 @bench_small(i32* %5)
%7 = load i32*, i32** %1
%8 = call i32 @fclose(i32* %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"testout.txt\00"
@.str.1 = [2 x i8] c"w\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @bench_small(i32* %3)
%5 = tail call i32 @fclose(i32* %3)
ret i32 0
}
void continue_handler(int sig) {}


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

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

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

LLVM IR (-O2):
define void @continue_handler(i32 %0) {
ret void
}
void INT_Excep_MTU0_TCIV0(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_MTU0_TCIV0() {
ret void
}
int main() { return '\\'; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0x5c,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
ret i32 92
}

LLVM IR (-O2):
define i32 @main() {
ret i32 92
}
/* Variables and functions */
void *dlsym(void *, char const *);
void *call_replacement(void *hTable, const char *name) {
  void *fnPtr = dlsym(hTable, name);
  return fnPtr;
}


x86 assembly (clang, -O0):
<call_replacement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <dlsym@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_replacement>:
jmp    1030 <dlsym@plt>

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

LLVM IR (-O2):
define i8* @call_replacement(i8* %0, i8* %1) {
%3 = tail call i8* @dlsym(i8* %0, i8* %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void set_wallpaper(const char *str) {
  printf("can't automatically set wallpaper on Linux, please set your "
         "wallpaper path to ~/.fractalart/wallpaper.bmp\n");
}


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

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

LLVM IR (-O0):
@.str = [107 x i8] c"can't automatically set wallpaper on Linux, please set your wallpaper path to ~/.fractalart/wallpaper.bmp\0A\00"
define void @set_wallpaper(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([107 x i8], [107 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [106 x i8] c"can't automatically set wallpaper on Linux, please set your wallpaper path to ~/.fractalart/wallpaper.bmp\00"
define void @set_wallpaper(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([106 x i8], [106 x i8]* @str, i64 0, i64 0))
ret void
}
int check_num_table(int num, int num_table[], int num_elems) {
  int i;
  for (i = 0; i < num_elems; i++) {
    if (num_table[i] == num) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_num_table>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1154 <check_num_table+0x54>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x8(%rbp),%eax
jne    1141 <check_num_table+0x41>
movl   $0x1,-0x4(%rbp)
jmp    115b <check_num_table+0x5b>
jmp    1146 <check_num_table+0x46>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1115 <check_num_table+0x15>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_num_table>:
test   %edx,%edx
jle    111e <check_num_table+0x1e>
mov    %edx,%eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cmp    %edi,(%rsi,%rcx,4)
je     1121 <check_num_table+0x21>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1110 <check_num_table+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @check_num_table(i32 %0, i32* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %15
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %14, %6
br i1 %8, label %15, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %14, %7 ]
%11 = getelementptr inbounds i32, i32* %1, i64 %10
%12 = load i32, i32* %11
%13 = icmp eq i32 %12, %0
%14 = add nuw nsw i64 %10, 1
br i1 %13, label %15, label %7
15: ; preds = %9, %7, %3
%16 = phi i32 [ 0, %3 ], [ 0, %7 ], [ 1, %9 ]
ret i32 %16
}
void free_cache(void) {}


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

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

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

LLVM IR (-O2):
define void @free_cache() {
ret void
}
/* Variables and functions */
int *custom_alloc(int);
void make_leak(void) {
  int *array2 = custom_alloc(sizeof(int) * 10);
  array2 = 0;
  return;
}


x86 assembly (clang, -O0):
<make_leak>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x28,%edi
call   1030 <custom_alloc@plt>
mov    %rax,-0x8(%rbp)
movq   $0x0,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_leak>:
mov    $0x28,%edi
jmp    1030 <custom_alloc@plt>

LLVM IR (-O0):
define void @make_leak() {
%1 = alloca i32*
%2 = call i32* @custom_alloc(i32 40)
store i32* %2, i32** %1
store i32* null, i32** %1
ret void
}

LLVM IR (-O2):
define void @make_leak() {
%1 = tail call i32* @custom_alloc(i32 40)
ret void
}
void __attribute((transaction_pure, no)) dont_optimize(void *p) {
  *(volatile char *)p;
}


x86 assembly (clang, -O0):
<dont_optimize>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
pop    %rbp
ret

x86 assembly (clang, -O2):
<dont_optimize>:
mov    (%rdi),%al
ret

LLVM IR (-O0):
define void @dont_optimize(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load volatile i8, i8* %3
ret void
}

LLVM IR (-O2):
define void @dont_optimize(i8* %0) {
%2 = load volatile i8, i8* %0
ret void
}
/* Variables and functions */
double pow(int, double);
double __exp10(double x) { return pow(10, x); }


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

x86 assembly (clang, -O2):
<__exp10>:
mov    $0xa,%edi
jmp    1030 <pow@plt>

LLVM IR (-O0):
define double @__exp10(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @pow(i32 10, double %3)
ret double %4
}

LLVM IR (-O2):
define double @__exp10(double %0) {
%2 = tail call double @pow(i32 10, double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ SI1133_delay_msek(int);
int /*<<< orphan*/ si1133_write8(int, int);
void si1133_reset() {
  si1133_write8(0X0B, 0X01);
  SI1133_delay_msek(100);
}


x86 assembly (clang, -O0):
<si1133_reset>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb,%edi
mov    $0x1,%esi
call   1040 <si1133_write8@plt>
mov    $0x64,%edi
call   1030 <SI1133_delay_msek@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<si1133_reset>:
push   %rax
mov    $0xb,%edi
mov    $0x1,%esi
call   1040 <si1133_write8@plt>
mov    $0x64,%edi
pop    %rax
jmp    1030 <SI1133_delay_msek@plt>

LLVM IR (-O0):
define void @si1133_reset() {
%1 = call i32 @si1133_write8(i32 11, i32 1)
%2 = call i32 @SI1133_delay_msek(i32 100)
ret void
}

LLVM IR (-O2):
define void @si1133_reset() {
%1 = tail call i32 @si1133_write8(i32 11, i32 1)
%2 = tail call i32 @SI1133_delay_msek(i32 100)
ret void
}
/* Variables and functions */
char *native_int_to_s(long, long);
char *string__Int__native_int_to_s(long self, long p0) {
  char *var;
  char *var1;
  var1 = native_int_to_s(self, p0);
  var = var1;
  goto RET_LABEL;
RET_LABEL:;
  return var;
}


x86 assembly (clang, -O0):
<string__Int__native_int_to_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <native_int_to_s@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string__Int__native_int_to_s>:
jmp    1030 <native_int_to_s@plt>

LLVM IR (-O0):
define i8* @string__Int__native_int_to_s(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %3
%8 = load i64, i64* %4
%9 = call i8* @native_int_to_s(i64 %7, i64 %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
store i8* %10, i8** %5
br label %11
11: ; preds = %2
%12 = load i8*, i8** %5
ret i8* %12
}

LLVM IR (-O2):
define i8* @string__Int__native_int_to_s(i64 %0, i64 %1) {
%3 = tail call i8* @native_int_to_s(i64 %0, i64 %1)
ret i8* %3
}
int fun1230() { return 1230; }


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

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

LLVM IR (-O0):
define i32 @fun1230() {
ret i32 1230
}

LLVM IR (-O2):
define i32 @fun1230() {
ret i32 1230
}
void pftrace_init(void) {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ HTS_get_copyright(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
void HTS_show_copyright(FILE *fp) {
  char buf[1024];
  HTS_get_copyright(buf);
  fprintf(fp, "%s", buf);
  return;
}


x86 assembly (clang, -O0):
<HTS_show_copyright>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x410(%rbp),%rdi
call   1030 <HTS_get_copyright@plt>
mov    -0x8(%rbp),%rdi
lea    -0x410(%rbp),%rdx
lea    0xeb3(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HTS_show_copyright>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <HTS_get_copyright@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <fputs@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @HTS_show_copyright(i32* %0) {
%2 = alloca i32*
%3 = alloca [1024 x i8]
store i32* %0, i32** %2
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = call i32 @HTS_get_copyright(i8* %4)
%6 = load i32*, i32** %2
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%8 = call i32 @fprintf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7)
ret void
}

LLVM IR (-O2):
define void @HTS_show_copyright(i32* nocapture %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32 @HTS_get_copyright(i8* %3)
%5 = call i32 @fputs(i8* %3, i32* %0)
ret void
}
void ls_costN_nm8_incref(void) {}


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

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

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

LLVM IR (-O2):
define void @ls_costN_nm8_incref() {
ret void
}
/* Variables and functions */
void Sys_mkdir(const char *path) {}


x86 assembly (clang, -O0):
<Sys_mkdir>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @Sys_mkdir(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ set_var(int *);
int main() {
  int a, b;
  set_var(&a);
  set_var(&b);
  printf("%d %d\n", a, b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <set_var@plt>
lea    -0xc(%rbp),%rdi
call   1040 <set_var@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
call   1040 <set_var@plt>
mov    %rsp,%rdi
call   1040 <set_var@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 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 @set_var(i32* %2)
%5 = call i32 @set_var(i32* %3)
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @set_var(i32* %1)
%6 = call i32 @set_var(i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
ret i32 0
}
/* Variables and functions */
int strlen(char *);
void chomp(char *str) {
  if (str[strlen(str) - 1] == '\n')
    str[strlen(str) - 1] = '\0';
}


x86 assembly (clang, -O0):
<chomp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    1167 <chomp+0x57>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chomp>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    1131 <chomp+0x21>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
pop    %rbx
ret

LLVM IR (-O0):
define void @chomp(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = sub nsw i32 %5, 1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %3, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 10
br i1 %11, label %12, label %19
12: ; preds = %1
%13 = load i8*, i8** %2
%14 = load i8*, i8** %2
%15 = call i32 @strlen(i8* %14)
%16 = sub nsw i32 %15, 1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %13, i64 %17
store i8 0, i8* %18
br label %19
19: ; preds = %12, %1
ret void
}

LLVM IR (-O2):
define void @chomp(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 10
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = tail call i32 @strlen(i8* %0)
%10 = add nsw i32 %9, -1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %0, i64 %11
store i8 0, i8* %12
br label %13
13: ; preds = %8, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ tosFilename_split(char const *, void *, void *, char *);
void tosFilename_getExtension(const char *pszFilename, char *pszExtension) {
  tosFilename_split(pszFilename, ((void *)0), ((void *)0), pszExtension);
}


x86 assembly (clang, -O0):
<tosFilename_getExtension>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1030 <tosFilename_split@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tosFilename_getExtension>:
mov    %rsi,%rcx
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <tosFilename_split@plt>

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

LLVM IR (-O2):
define void @tosFilename_getExtension(i8* %0, i8* %1) {
%3 = tail call i32 @tosFilename_split(i8* %0, i8* null, i8* null, i8* %1)
ret void
}
int test_imm_3Dint16_mem(short *val) {
  return ((*val) & (-0x3D << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_3Dint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
and    $0xffffffc3,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_3Dint16_mem>:
movzwl (%rdi),%eax
test   $0xffc3,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_3Dint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, -61
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_3Dint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -61
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void foo116() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ pthread_create(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                  void *, int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_join(int /*<<< orphan*/, int /*<<< orphan*/ *);
main() {
  pthread_t thread1, thread2;
  void compute_until_hell_freezes();
  pthread_create(&thread1, NULL, (void *)&compute_until_hell_freezes, NULL);
  pthread_create(&thread2, NULL, (void *)&compute_until_hell_freezes, NULL);
  pthread_join(thread1, NULL);
  pthread_join(thread2, NULL);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%ecx
mov    0x2e92(%rip),%rdx
mov    %rcx,%rsi
call   1030 <pthread_create@plt>
lea    -0xc(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%ecx
mov    0x2e7b(%rip),%rdx
mov    %rcx,%rsi
call   1030 <pthread_create@plt>
mov    -0x8(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <pthread_join@plt>
mov    -0xc(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <pthread_join@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    0x2ea4(%rip),%rbx
lea    0xc(%rsp),%rdi
xor    %esi,%esi
mov    %rbx,%rdx
xor    %ecx,%ecx
call   1030 <pthread_create@plt>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
mov    %rbx,%rdx
xor    %ecx,%ecx
call   1030 <pthread_create@plt>
mov    0xc(%rsp),%edi
xor    %esi,%esi
call   1050 <pthread_join@plt>
mov    0x8(%rsp),%edi
xor    %esi,%esi
call   1050 <pthread_join@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @pthread_create(i32* %2, i32* null, i8* bitcast (void (...)* @compute_until_hell_freezes to i8*), i32* null)
%5 = call i32 @pthread_create(i32* %3, i32* null, i8* bitcast (void (...)* @compute_until_hell_freezes to i8*), i32* null)
%6 = load i32, i32* %2
%7 = call i32 @pthread_join(i32 %6, i32* null)
%8 = load i32, i32* %3
%9 = call i32 @pthread_join(i32 %8, i32* null)
%10 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @pthread_create(i32* %1, i32* null, i8* bitcast (void (...)* @compute_until_hell_freezes to i8*), i32* null)
%6 = call i32 @pthread_create(i32* %2, i32* null, i8* bitcast (void (...)* @compute_until_hell_freezes to i8*), i32* null)
%7 = load i32, i32* %1
%8 = call i32 @pthread_join(i32 %7, i32* null)
%9 = load i32, i32* %2
%10 = call i32 @pthread_join(i32 %9, i32* null)
%11 = call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ XDR;

/* Variables and functions */
int /*<<< orphan*/ fill_getport_xdr(int /*<<< orphan*/ *, int, int, int);
void fill_vxi_getport_xdr(XDR *xdr) { fill_getport_xdr(xdr, 0x0607AF, 1, 6); }


x86 assembly (clang, -O0):
<fill_vxi_getport_xdr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x607af,%esi
mov    $0x1,%edx
mov    $0x6,%ecx
call   1030 <fill_getport_xdr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_vxi_getport_xdr>:
mov    $0x607af,%esi
mov    $0x1,%edx
mov    $0x6,%ecx
jmp    1030 <fill_getport_xdr@plt>

LLVM IR (-O0):
define void @fill_vxi_getport_xdr(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fill_getport_xdr(i32* %3, i32 395183, i32 1, i32 6)
ret void
}

LLVM IR (-O2):
define void @fill_vxi_getport_xdr(i32* %0) {
%2 = tail call i32 @fill_getport_xdr(i32* %0, i32 395183, i32 1, i32 6)
ret void
}
int my_absolute(int integer) {
  if (integer < 0) {
    integer = (-1) * integer;
  }
  return integer;
}


x86 assembly (clang, -O0):
<my_absolute>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111b <my_absolute+0x1b>
imul   $0xffffffff,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_absolute>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
ret

LLVM IR (-O0):
define i32 @my_absolute(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = mul nsw i32 -1, %6
store i32 %7, i32* %2
br label %8
8: ; preds = %5, %1
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @my_absolute(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ palindrome(int, int);
int main() {
  char message[100];
  palindrome(3, 2);
  int flag[100];
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x200,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3,%edi
mov    $0x2,%esi
call   1030 <palindrome@plt>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
mov    $0x2,%esi
call   1030 <palindrome@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [100 x i32]
store i32 0, i32* %1
%4 = call i32 @palindrome(i32 3, i32 2)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @palindrome(i32 3, i32 2)
ret i32 0
}
/* Variables and functions */
scalar_t__ is_end(char);
scalar_t__ is_whitespace(char);
bool is_whitespace_or_end(char c) { return is_whitespace(c) || is_end(c); }


x86 assembly (clang, -O0):
<is_whitespace_or_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <is_whitespace@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    115c <is_whitespace_or_end+0x3c>
movsbl -0x1(%rbp),%edi
call   1040 <is_end@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_whitespace_or_end>:
push   %rbx
mov    %edi,%ebx
call   1030 <is_whitespace@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1137 <is_whitespace_or_end+0x17>
pop    %rbx
ret
movsbl %bl,%edi
call   1040 <is_end@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_whitespace_or_end(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @is_whitespace(i8 signext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = call i64 @is_end(i8 signext %7)
%9 = icmp ne i64 %8, 0
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @is_whitespace_or_end(i8 signext %0) {
%2 = tail call i64 @is_whitespace(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @is_end(i8 signext %0)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
void dmb(void) {}


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

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

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

LLVM IR (-O2):
define void @dmb() {
ret void
}
int ct_string_hash(const char *str) {
  unsigned int hash = 5381;
  int c;
  while ((c = *str++))
    hash = ((hash << 5) + hash) + c;
  return hash;
}


x86 assembly (clang, -O0):
<ct_string_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1505,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
je     1141 <ct_string_hash+0x41>
mov    -0xc(%rbp),%eax
shl    $0x5,%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    110f <ct_string_hash+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ct_string_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1138 <ct_string_hash+0x38>
add    $0x1,%rdi
mov    $0x1505,%edx
mov    %edx,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %cl,%ecx
shl    $0x5,%eax
add    %edx,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
mov    %eax,%edx
test   %cl,%cl
jne    1120 <ct_string_hash+0x20>
ret
mov    $0x1505,%eax
ret

LLVM IR (-O0):
define i32 @ct_string_hash(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 5381, i32* %3
br label %5
5: ; preds = %11, %1
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %2
%8 = load i8, i8* %6
%9 = sext i8 %8 to i32
store i32 %9, i32* %4
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %5
%12 = load i32, i32* %3
%13 = shl i32 %12, 5
%14 = load i32, i32* %3
%15 = add i32 %13, %14
%16 = load i32, i32* %4
%17 = add i32 %15, %16
store i32 %17, i32* %3
br label %5
18: ; preds = %5
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
define i32 @ct_string_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %9, %4 ], [ %0, %1 ]
%7 = phi i32 [ %11, %4 ], [ 5381, %1 ]
%8 = sext i8 %5 to i32
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = mul i32 %7, 33
%11 = add i32 %10, %8
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 5381, %1 ], [ %11, %4 ]
ret i32 %15
}
double format2deg(double x) {
  long deg;
  double frac;
  deg = (long)(x / 100);
  frac = x - deg * 100;
  return (deg + frac / 60.0);
}


x86 assembly (clang, -O0):
<format2deg>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xef2(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
imul   $0x64,-0x10(%rbp),%rax
cvtsi2sd %rax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdq -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xeb2(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<format2deg>:
movapd %xmm0,%xmm1
divsd  0xef4(%rip),%xmm1
cvttsd2si %xmm1,%rax
imul   $0x64,%rax,%rcx
xorps  %xmm1,%xmm1
cvtsi2sd %rcx,%xmm1
cvtsi2sd %rax,%xmm2
subsd  %xmm1,%xmm0
divsd  0xeda(%rip),%xmm0
addsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @format2deg(double %0) {
%2 = alloca double
%3 = alloca i64
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
%6 = fdiv double %5, 1.000000e+02
%7 = fptosi double %6 to i64
store i64 %7, i64* %3
%8 = load double, double* %2
%9 = load i64, i64* %3
%10 = mul nsw i64 %9, 100
%11 = sitofp i64 %10 to double
%12 = fsub double %8, %11
store double %12, double* %4
%13 = load i64, i64* %3
%14 = sitofp i64 %13 to double
%15 = load double, double* %4
%16 = fdiv double %15, 6.000000e+01
%17 = fadd double %14, %16
ret double %17
}

LLVM IR (-O2):
define double @format2deg(double %0) {
%2 = fdiv double %0, 1.000000e+02
%3 = fptosi double %2 to i64
%4 = mul nsw i64 %3, 100
%5 = sitofp i64 %4 to double
%6 = fsub double %0, %5
%7 = sitofp i64 %3 to double
%8 = fdiv double %6, 6.000000e+01
%9 = fadd double %8, %7
ret double %9
}
int main() {
  int a;
  {
    {
      int b;
      b = 10;
      a = b;
    }
    {}
  }
  return a - 10;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0xa,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %3
%4 = load i32, i32* %3
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = sub nsw i32 %5, 10
ret i32 %6
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int test_imm_F1int64_highword_reg(long long val) {
  return ((val >> 32) & (0xF1 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_F1int64_highword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x20,%rdx
and    $0xf1,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_F1int64_highword_reg>:
movabs $0xf100000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_F1int64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 32
%5 = and i64 %4, 241
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_F1int64_highword_reg(i64 %0) {
%2 = and i64 %0, 1035087118336
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ getAbs(int);
int /*<<< orphan*/ getAbs2(int);
void main() {
  getAbs(-3721);
  getAbs2(-3721);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffff177,%edi
call   1040 <getAbs@plt>
mov    $0xfffff177,%edi
call   1030 <getAbs2@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xfffff177,%edi
call   1040 <getAbs@plt>
mov    $0xfffff177,%edi
pop    %rax
jmp    1030 <getAbs2@plt>

LLVM IR (-O0):
define void @main() {
%1 = call i32 @getAbs(i32 -3721)
%2 = call i32 @getAbs2(i32 -3721)
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @getAbs(i32 -3721)
%2 = tail call i32 @getAbs2(i32 -3721)
ret void
}