xunge/DecIR huggingface dataset:
void arcpre_(prec) int *prec;
{ circleprecision(*prec); }


x86 assembly (clang, -O0):
<arcpre_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    $0x0,%al
call   1030 <circleprecision@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arcpre_>:
mov    (%rdi),%edi
xor    %eax,%eax
jmp    1030 <circleprecision@plt>

LLVM IR (-O0):
define void @arcpre_(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = call i32 (i32, ...) bitcast (i32 (...)* @circleprecision to i32 (i32, ...)*)(i32 %4)
ret void
}

LLVM IR (-O2):
define void @arcpre_(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @circleprecision to i32 (i32, ...)*)(i32 %2)
ret void
}
int ktapc_int2fb(unsigned int x) {
  int e = 0;
  if (x < 8)
    return x;
  while (x >= 0x10) {
    x = (x + 1) >> 1;
    e++;
  }
  return ((e + 1) << 3) | ((int)x - 8);
}


x86 assembly (clang, -O0):
<ktapc_int2fb>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0x8(%rbp)
jae    1123 <ktapc_int2fb+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1160 <ktapc_int2fb+0x60>
jmp    1128 <ktapc_int2fb+0x28>
cmpl   $0x10,-0x8(%rbp)
jb     114c <ktapc_int2fb+0x4c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
shr    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1128 <ktapc_int2fb+0x28>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
shl    $0x3,%eax
mov    -0x8(%rbp),%ecx
sub    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ktapc_int2fb>:
mov    %edi,%eax
cmp    $0x8,%edi
jb     113c <ktapc_int2fb+0x3c>
mov    $0x8,%ecx
cmp    $0x10,%eax
jb     1133 <ktapc_int2fb+0x33>
mov    $0x8,%ecx
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%eax
mov    %eax,%edx
shr    %edx
add    $0x8,%ecx
cmp    $0x1f,%eax
mov    %edx,%eax
ja     1120 <ktapc_int2fb+0x20>
jmp    1135 <ktapc_int2fb+0x35>
mov    %eax,%edx
add    $0xfffffff8,%edx
or     %ecx,%edx
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @ktapc_int2fb(i32 %0) {
%2 = icmp ult i32 %0, 8
br i1 %2, label %19, label %3
3: ; preds = %1
%4 = icmp ugt i32 %0, 15
br i1 %4, label %5, label %14
5: ; preds = %3, %5
%6 = phi i32 [ %10, %5 ], [ 1, %3 ]
%7 = phi i32 [ %9, %5 ], [ %0, %3 ]
%8 = add i32 %7, 1
%9 = lshr i32 %8, 1
%10 = add i32 %6, 1
%11 = icmp ugt i32 %8, 31
br i1 %11, label %5, label %12
12: ; preds = %5
%13 = shl i32 %10, 3
br label %14
14: ; preds = %12, %3
%15 = phi i32 [ %0, %3 ], [ %9, %12 ]
%16 = phi i32 [ 8, %3 ], [ %13, %12 ]
%17 = add nsw i32 %15, -8
%18 = or i32 %16, %17
br label %19
19: ; preds = %1, %14
%20 = phi i32 [ %18, %14 ], [ %0, %1 ]
ret i32 %20
}
/* Variables and functions */
char *strdup(char const *);
char *n_strdup(const char *ptr, const int lineno, const char *file) {
  char *buf;
  if (!ptr) {
    ptr = "(null)";
  }
  buf = strdup(ptr);
  return buf;
}


x86 assembly (clang, -O0):
<n_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1139 <n_strdup+0x29>
lea    0xecb(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strdup@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<n_strdup>:
test   %rdi,%rdi
lea    0xee6(%rip),%rax
cmove  %rax,%rdi
jmp    1030 <strdup@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"(null)\00"
define i8* @n_strdup(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %11, label %10
10: ; preds = %3
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %4
br label %11
11: ; preds = %10, %3
%12 = load i8*, i8** %4
%13 = call i8* @strdup(i8* %12)
store i8* %13, i8** %7
%14 = load i8*, i8** %7
ret i8* %14
}

LLVM IR (-O2):
@.str = [7 x i8] c"(null)\00"
define noalias i8* @n_strdup(i8* %0, i32 %1, i8* nocapture readnone %2) {
%4 = icmp eq i8* %0, null
%5 = select i1 %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0
%6 = tail call i8* @strdup(i8* %5)
ret i8* %6
}
/* Variables and functions */
int getArrayBound(int, int);
int popNumber();
int /*<<< orphan*/ pushNumber(int);
void basUBound() {
  int index, range;
  index = popNumber();
  range = getArrayBound(index, 1);
  popNumber();
  pushNumber(range);
}


x86 assembly (clang, -O0):
<basUBound>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <popNumber@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <getArrayBound@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <popNumber@plt>
mov    -0x8(%rbp),%edi
call   1040 <pushNumber@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basUBound>:
push   %rbx
xor    %eax,%eax
call   1050 <popNumber@plt>
mov    %eax,%edi
mov    $0x1,%esi
call   1030 <getArrayBound@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <popNumber@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <pushNumber@plt>

LLVM IR (-O0):
define void @basUBound() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @popNumber()
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = call i32 @getArrayBound(i32 %4, i32 1)
store i32 %5, i32* %2
%6 = call i32 (...) @popNumber()
%7 = load i32, i32* %2
%8 = call i32 @pushNumber(i32 %7)
ret void
}

LLVM IR (-O2):
define void @basUBound() {
%1 = tail call i32 (...) @popNumber()
%2 = tail call i32 @getArrayBound(i32 %1, i32 1)
%3 = tail call i32 (...) @popNumber()
%4 = tail call i32 @pushNumber(i32 %2)
ret void
}
long long mini(long long a, long long b) { return a < b ? a : b; }


x86 assembly (clang, -O0):
<mini>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1127 <mini+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <mini+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mini>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovl  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @mini(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 slt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @mini(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Type definitions */
struct btree_node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct btree_node *);
void btree_free_node(struct btree_node *n) { free(n); }


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

x86 assembly (clang, -O2):
<btree_free_node>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.btree_node = type { i32 }
define void @btree_free_node(%struct.btree_node* %0) {
%2 = alloca %struct.btree_node*
store %struct.btree_node* %0, %struct.btree_node** %2
%3 = load %struct.btree_node*, %struct.btree_node** %2
%4 = call i32 @free(%struct.btree_node* %3)
ret void
}

LLVM IR (-O2):
%struct.btree_node = type { i32 }
define void @btree_free_node(%struct.btree_node* nocapture %0) {
%2 = tail call i32 @free(%struct.btree_node* %0)
ret void
}
/* Variables and functions */
float __nv_copysignf(float, float);
float copysignf(float __a, float __b) { return __nv_copysignf(__a, __b); }


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

x86 assembly (clang, -O2):
<copysignf>:
jmp    1030 <__nv_copysignf@plt>

LLVM IR (-O0):
define float @copysignf(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = call float @__nv_copysignf(float %5, float %6)
ret float %7
}

LLVM IR (-O2):
define float @copysignf(float %0, float %1) {
%3 = tail call float @__nv_copysignf(float %0, float %1)
ret float %3
}
/* Variables and functions */
int NAME_MAX;
int getpgrp();
int snprintf(char *, int, char *, int);
int plrSD_getShmName(char name[NAME_MAX]) {
  int pgid = getpgrp();
  int w = snprintf(name, NAME_MAX, "/plr_data.%d", pgid);
  if (w < 0 || w >= NAME_MAX) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<plrSD_getShmName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getpgrp@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e97(%rip),%rax
mov    (%rax),%esi
mov    -0x14(%rbp),%ecx
lea    0xeb3(%rip),%rdx
call   1030 <snprintf@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     1171 <plrSD_getShmName+0x51>
mov    -0x18(%rbp),%eax
mov    0x2e6f(%rip),%rcx
cmp    (%rcx),%eax
jl     117d <plrSD_getShmName+0x5d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1184 <plrSD_getShmName+0x64>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plrSD_getShmName>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <getpgrp@plt>
mov    0x2ea3(%rip),%r14
mov    (%r14),%esi
lea    0xec1(%rip),%rdx
mov    %rbx,%rdi
mov    %eax,%ecx
call   1030 <snprintf@plt>
test   %eax,%eax
sets   %cl
cmp    (%r14),%eax
setge  %al
or     %cl,%al
movzbl %al,%eax
neg    %eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@NAME_MAX = global i32 0
@.str = [13 x i8] c"/plr_data.%d\00"
define i32 @plrSD_getShmName(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i32, i32* @NAME_MAX
%7 = zext i32 %6 to i64
%8 = call i32 (...) @getpgrp()
store i32 %8, i32* %4
%9 = load i8*, i8** %3
%10 = load i32, i32* @NAME_MAX
%11 = load i32, i32* %4
%12 = call i32 @snprintf(i8* %9, i32 %10, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %11)
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = icmp slt i32 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %1
%16 = load i32, i32* %5
%17 = load i32, i32* @NAME_MAX
%18 = icmp sge i32 %16, %17
br i1 %18, label %19, label %20
19: ; preds = %15, %1
store i32 -1, i32* %2
br label %21
20: ; preds = %15
store i32 0, i32* %2
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
@NAME_MAX = global i32 0
@.str = [13 x i8] c"/plr_data.%d\00"
define i32 @plrSD_getShmName(i8* %0) {
%2 = tail call i32 (...) @getpgrp()
%3 = load i32, i32* @NAME_MAX
%4 = tail call i32 @snprintf(i8* %0, i32 %3, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %2)
%5 = icmp slt i32 %4, 0
%6 = load i32, i32* @NAME_MAX
%7 = icmp sge i32 %4, %6
%8 = select i1 %5, i1 true, i1 %7
%9 = sext i1 %8 to i32
ret i32 %9
}
int main() {
  if (bar() == 0)
    printf("%s()\n", __PRETTY_FUNCTION__);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <bar@plt>
cmp    $0x0,%eax
jne    1154 <main+0x34>
lea    0xeba(%rip),%rdi
lea    0xeb9(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <bar@plt>
test   %eax,%eax
jne    1141 <main+0x21>
lea    0xecd(%rip),%rdi
lea    0xecc(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s()\0A\00"
@__PRETTY_FUNCTION__.main = [11 x i8] c"int main()\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @bar()
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s()\0A\00"
@__PRETTY_FUNCTION__.main = [11 x i8] c"int main()\00"
define i32 @main() {
%1 = tail call i32 (...) @bar()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int getpid();
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ sprintf(char *, char *, int, int);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void ChildProcess(void) {
  char buf[100];
  sprintf(buf, "Hello World from child! from pid %d, value = %d\n", getpid(),
          1);
  write(1, buf, strlen(buf));
  sleep(1);
  exit(0);
}


x86 assembly (clang, -O0):
<ChildProcess>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
lea    -0x70(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    -0x80(%rbp),%rdi
mov    %eax,%edx
lea    0xe79(%rip),%rsi
mov    $0x1,%ecx
call   1060 <sprintf@plt>
lea    -0x70(%rbp),%rax
mov    %rax,-0x78(%rbp)
lea    -0x70(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x78(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<ChildProcess>:
push   %rbx
sub    $0x70,%rsp
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xe8d(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %eax,%edx
mov    $0x1,%ecx
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"Hello World from child! from pid %d, value = %d\0A\00"
define void @ChildProcess() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 (...) @getpid()
%4 = call i32 @sprintf(i8* %2, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 %3, i32 1)
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%7 = call i32 @strlen(i8* %6)
%8 = call i32 @write(i32 1, i8* %5, i32 %7)
%9 = call i32 @sleep(i32 1)
%10 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [49 x i8] c"Hello World from child! from pid %d, value = %d\0A\00"
define void @ChildProcess() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @getpid()
%4 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 %3, i32 1)
%5 = call i32 @strlen(i8* %2)
%6 = call i32 @write(i32 1, i8* %2, i32 %5)
%7 = call i32 @sleep(i32 1)
%8 = call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ ASN1_T61STRING;

/* Variables and functions */
int /*<<< orphan*/ ASN1_T61STRING_it;
scalar_t__ ASN1_item_new(int /*<<< orphan*/ *);
ASN1_T61STRING *ASN1_T61STRING_new(void) {
  return (ASN1_T61STRING *)ASN1_item_new(&ASN1_T61STRING_it);
}


x86 assembly (clang, -O0):
<ASN1_T61STRING_new>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rdi
call   1030 <ASN1_item_new@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ASN1_T61STRING_new>:
mov    0x2ec9(%rip),%rdi
jmp    1030 <ASN1_item_new@plt>

LLVM IR (-O0):
@ASN1_T61STRING_it = global i32 0
define i32* @ASN1_T61STRING_new() {
%1 = call i64 @ASN1_item_new(i32* @ASN1_T61STRING_it)
%2 = inttoptr i64 %1 to i32*
ret i32* %2
}

LLVM IR (-O2):
@ASN1_T61STRING_it = global i32 0
define i32* @ASN1_T61STRING_new() {
%1 = tail call i64 @ASN1_item_new(i32* @ASN1_T61STRING_it)
%2 = inttoptr i64 %1 to i32*
ret i32* %2
}
int f_3x(void) { return 3; }


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

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

LLVM IR (-O0):
define i32 @f_3x() {
ret i32 3
}

LLVM IR (-O2):
define i32 @f_3x() {
ret i32 3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, ...);
void main() {
  int i = 8;
  printf("%d %d %d %d \n", ++i, ++i, --i, --i);
  printf("%d \n", ++i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x8,-0x4(%rbp)
mov    -0x4(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
add    $0x1,%edx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
mov    -0x4(%rbp),%r8d
add    $0xffffffff,%r8d
mov    %r8d,-0x4(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x4(%rbp)
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x9,%esi
mov    $0xa,%edx
mov    $0x9,%ecx
mov    $0x8,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
mov    $0x9,%esi
xor    %eax,%eax
pop    %rcx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"%d %d %d %d \0A\00"
@.str.1 = [5 x i8] c"%d \0A\00"
define void @main() {
%1 = alloca i32
store i32 8, i32* %1
%2 = load i32, i32* %1
%3 = add nsw i32 %2, 1
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 1
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = add nsw i32 %6, -1
store i32 %7, i32* %1
%8 = load i32, i32* %1
%9 = add nsw i32 %8, -1
store i32 %9, i32* %1
%10 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %5, i32 %7, i32 %9)
%11 = load i32, i32* %1
%12 = add nsw i32 %11, 1
store i32 %12, i32* %1
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %12)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%d %d %d %d \0A\00"
@.str.1 = [5 x i8] c"%d \0A\00"
define void @main() {
%1 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 9, i32 10, i32 9, i32 8)
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 9)
ret void
}
/* Variables and functions */
void *getbytes(size_t);
void *getzbytes(size_t nbytes) { return (getbytes(nbytes)); }


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

x86 assembly (clang, -O2):
<getzbytes>:
jmp    1030 <getbytes@plt>

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

LLVM IR (-O2):
define i8* @getzbytes(i64 %0) {
%2 = tail call i8* @getbytes(i64 %0)
ret i8* %2
}
/* Type definitions */
struct treenode {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ findmaxleaf(struct treenode *, int /*<<< orphan*/,
                               struct treenode **);
int /*<<< orphan*/ printpath(struct treenode *, struct treenode *);
void findmaxpath(struct treenode *root) {
  struct treenode *maxleaf;
  findmaxleaf(root, 0, &maxleaf);
  printpath(root, maxleaf);
}


x86 assembly (clang, -O0):
<findmaxpath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
lea    -0x10(%rbp),%rdx
call   1040 <findmaxleaf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <printpath@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findmaxpath>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdx
xor    %esi,%esi
call   1040 <findmaxleaf@plt>
mov    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <printpath@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.treenode = type { i32 }
define void @findmaxpath(%struct.treenode* %0) {
%2 = alloca %struct.treenode*
%3 = alloca %struct.treenode*
store %struct.treenode* %0, %struct.treenode** %2
%4 = load %struct.treenode*, %struct.treenode** %2
%5 = call i32 @findmaxleaf(%struct.treenode* %4, i32 0, %struct.treenode** %3)
%6 = load %struct.treenode*, %struct.treenode** %2
%7 = load %struct.treenode*, %struct.treenode** %3
%8 = call i32 @printpath(%struct.treenode* %6, %struct.treenode* %7)
ret void
}

LLVM IR (-O2):
%struct.treenode = type { i32 }
define void @findmaxpath(%struct.treenode* %0) {
%2 = alloca %struct.treenode*
%3 = bitcast %struct.treenode** %2 to i8*
%4 = call i32 @findmaxleaf(%struct.treenode* %0, i32 0, %struct.treenode** %2)
%5 = load %struct.treenode*, %struct.treenode** %2
%6 = call i32 @printpath(%struct.treenode* %0, %struct.treenode* %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ UpdateDACchip(int);
int /*<<< orphan*/ UpdateDAchannel(int);
int /*<<< orphan*/ UpdateIOchip(int);
void UpdateCard(int card_no) {
  int chip_no;
  chip_no = card_no * 2;
  UpdateIOchip(chip_no);
  UpdateIOchip(chip_no + 1);
  UpdateDACchip(card_no);
  UpdateDAchannel(card_no + 1);
}


x86 assembly (clang, -O0):
<UpdateCard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <UpdateIOchip@plt>
mov    -0x8(%rbp),%edi
add    $0x1,%edi
call   1030 <UpdateIOchip@plt>
mov    -0x4(%rbp),%edi
call   1040 <UpdateDACchip@plt>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
call   1050 <UpdateDAchannel@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UpdateCard>:
push   %rbx
mov    %edi,%ebx
lea    (%rbx,%rbx,1),%edi
call   1030 <UpdateIOchip@plt>
lea    (%rbx,%rbx,1),%edi
add    $0x1,%edi
call   1030 <UpdateIOchip@plt>
mov    %ebx,%edi
call   1040 <UpdateDACchip@plt>
add    $0x1,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1050 <UpdateDAchannel@plt>

LLVM IR (-O0):
define void @UpdateCard(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = mul nsw i32 %4, 2
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @UpdateIOchip(i32 %6)
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
%10 = call i32 @UpdateIOchip(i32 %9)
%11 = load i32, i32* %2
%12 = call i32 @UpdateDACchip(i32 %11)
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
%15 = call i32 @UpdateDAchannel(i32 %14)
ret void
}

LLVM IR (-O2):
define void @UpdateCard(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = tail call i32 @UpdateIOchip(i32 %2)
%4 = or i32 %2, 1
%5 = tail call i32 @UpdateIOchip(i32 %4)
%6 = tail call i32 @UpdateDACchip(i32 %0)
%7 = add nsw i32 %0, 1
%8 = tail call i32 @UpdateDAchannel(i32 %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fb_ConsolePrintBufferEx(char const *, int /*<<< orphan*/,
                                           int);
int /*<<< orphan*/ strlen(char const *);
void fb_ConsolePrintBuffer(const char *buffer, int mask) {
  fb_ConsolePrintBufferEx(buffer, strlen(buffer), mask);
}


x86 assembly (clang, -O0):
<fb_ConsolePrintBuffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
mov    -0xc(%rbp),%edx
call   1040 <fb_ConsolePrintBufferEx@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fb_ConsolePrintBuffer>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fb_ConsolePrintBufferEx@plt>

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

LLVM IR (-O2):
define void @fb_ConsolePrintBuffer(i8* %0, i32 %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @fb_ConsolePrintBufferEx(i8* %0, i32 %3, i32 %1)
ret void
}
int S_GetVoiceAmplitude(int entityNum) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @S_GetVoiceAmplitude(i32 %0) {
ret i32 0
}
/* Variables and functions */
int *realloc(int *, int);
void add_do(int *ndo, int **todo, int act) {
  *todo = realloc(*todo, (*ndo + 1) * sizeof(int));
  (*todo)[*ndo] = act;
  *ndo += 1;
}


x86 assembly (clang, -O0):
<add_do>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
add    $0x1,%eax
cltq
shl    $0x2,%rax
mov    %eax,%esi
call   1030 <realloc@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x8(%rbp),%rcx
movslq (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_do>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    (%rsi),%rdi
mov    0x0(%rbp),%eax
lea    0x4(,%rax,4),%esi
call   1030 <realloc@plt>
mov    %rax,(%rbx)
movslq 0x0(%rbp),%rcx
mov    %r14d,(%rax,%rcx,4)
addl   $0x1,0x0(%rbp)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @add_do(i32* %0, i32** %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32**
%6 = alloca i32
store i32* %0, i32** %4
store i32** %1, i32*** %5
store i32 %2, i32* %6
%7 = load i32**, i32*** %5
%8 = load i32*, i32** %7
%9 = load i32*, i32** %4
%10 = load i32, i32* %9
%11 = add nsw i32 %10, 1
%12 = sext i32 %11 to i64
%13 = mul i64 %12, 4
%14 = trunc i64 %13 to i32
%15 = call i32* @realloc(i32* %8, i32 %14)
%16 = load i32**, i32*** %5
store i32* %15, i32** %16
%17 = load i32, i32* %6
%18 = load i32**, i32*** %5
%19 = load i32*, i32** %18
%20 = load i32*, i32** %4
%21 = load i32, i32* %20
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %19, i64 %22
store i32 %17, i32* %23
%24 = load i32*, i32** %4
%25 = load i32, i32* %24
%26 = add nsw i32 %25, 1
store i32 %26, i32* %24
ret void
}

LLVM IR (-O2):
define void @add_do(i32* nocapture %0, i32** nocapture %1, i32 %2) {
%4 = load i32*, i32** %1
%5 = load i32, i32* %0
%6 = shl i32 %5, 2
%7 = add i32 %6, 4
%8 = tail call i32* @realloc(i32* %4, i32 %7)
store i32* %8, i32** %1
%9 = load i32, i32* %0
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
store i32 %2, i32* %11
%12 = load i32, i32* %0
%13 = add nsw i32 %12, 1
store i32 %13, i32* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int getc(int /*<<< orphan*/ *);
void skip(FILE *in) {
  int c;
  for (;;) {
    c = getc(in);
    if (c == '\n' || c == EOF)
      return;
  }
}


x86 assembly (clang, -O0):
<skip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
je     1144 <skip+0x34>
mov    -0xc(%rbp),%eax
mov    0x2eac(%rip),%rcx
cmp    (%rcx),%eax
jne    114a <skip+0x3a>
add    $0x10,%rsp
pop    %rbp
ret
jmp    111c <skip+0xc>

x86 assembly (clang, -O2):
<skip>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eca(%rip),%r14
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <getc@plt>
cmp    $0xa,%eax
je     1132 <skip+0x22>
cmp    (%r14),%eax
jne    1120 <skip+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i32 0
define void @skip(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
br label %4
4: ; preds = %14, %1
%5 = load i32*, i32** %2
%6 = call i32 @getc(i32* %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 10
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = load i32, i32* %3
%11 = load i32, i32* @EOF
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %9, %4
ret void
14: ; preds = %9
br label %4
}

LLVM IR (-O2):
@EOF = global i32 0
define void @skip(i32* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @getc(i32* %0)
%4 = icmp eq i32 %3, 10
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %3, %5
%7 = select i1 %4, i1 true, i1 %6
br i1 %7, label %8, label %2
8: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ comment();
int /*<<< orphan*/ ol(char *);
trailer() {
  comment();
  ol("-= END =-");
}


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

x86 assembly (clang, -O2):
<trailer>:
push   %rax
xor    %eax,%eax
call   1030 <comment@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1040 <ol@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"-= END =-\00"
define i32 @trailer() {
%1 = alloca i32
%2 = call i32 (...) @comment()
%3 = call i32 @ol(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
@.str = [10 x i8] c"-= END =-\00"
define i32 @trailer() {
%1 = tail call i32 (...) @comment()
%2 = tail call i32 @ol(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
int __attribute__((weak)) _wait() { return -1; }


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

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

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

LLVM IR (-O2):
define weak i32 @_wait() {
ret i32 -1
}
/* Variables and functions */
int cbuf(int, int, int);
cbuf38(int f, int n) { return (cbuf(f, n, 38)); }


x86 assembly (clang, -O0):
<cbuf38>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x26,%edx
call   1030 <cbuf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbuf38>:
mov    $0x26,%edx
jmp    1030 <cbuf@plt>

LLVM IR (-O0):
define i32 @cbuf38(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 = call i32 @cbuf(i32 %5, i32 %6, i32 38)
ret i32 %7
}

LLVM IR (-O2):
define i32 @cbuf38(i32 %0, i32 %1) {
%3 = tail call i32 @cbuf(i32 %0, i32 %1, i32 38)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void announce(void) {
  printf("\n\nWelcome to the demonstration CD catalog database              "
         "program\n");
}


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

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

LLVM IR (-O0):
@.str = [73 x i8] c"\0A\0AWelcome to the demonstration CD catalog database program\0A\00"
define void @announce() {
%1 = call i32 @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [72 x i8] c"\0A\0AWelcome to the demonstration CD catalog database program\00"
define void @announce() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
int strlen(char const *);
char *strdup(const char *s) {
  size_t sz = strlen(s) + 1;
  char *d = malloc(sz);
  memcpy(d, s, sz);
  return d;
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
add    $0x1,%eax
movslq %eax,%r15
mov    %r15,%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
store i64 %8, i64* %3
%9 = load i64, i64* %3
%10 = call i8* @malloc(i64 %9)
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = load i8*, i8** %2
%13 = load i64, i64* %3
%14 = call i32 @memcpy(i8* %11, i8* %12, i64 %13)
%15 = load i8*, i8** %4
ret i8* %15
}

LLVM IR (-O2):
define i8* @strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = sext i32 %3 to i64
%5 = tail call i8* @malloc(i64 %4)
%6 = tail call i32 @memcpy(i8* %5, i8* %0, i64 %4)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ output(int, int);
void right_backward() {
  output(25, 0);
  output(24, 1);
}


x86 assembly (clang, -O0):
<right_backward>:
push   %rbp
mov    %rsp,%rbp
mov    $0x19,%edi
xor    %esi,%esi
call   1030 <output@plt>
mov    $0x18,%edi
mov    $0x1,%esi
call   1030 <output@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<right_backward>:
push   %rax
mov    $0x19,%edi
xor    %esi,%esi
call   1030 <output@plt>
mov    $0x18,%edi
mov    $0x1,%esi
pop    %rax
jmp    1030 <output@plt>

LLVM IR (-O0):
define void @right_backward() {
%1 = call i32 @output(i32 25, i32 0)
%2 = call i32 @output(i32 24, i32 1)
ret void
}

LLVM IR (-O2):
define void @right_backward() {
%1 = tail call i32 @output(i32 25, i32 0)
%2 = tail call i32 @output(i32 24, i32 1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fdopen(int, char *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ putchar(int);
void read_from_pipe(int file) {
  FILE *stream;
  int c;
  stream = fdopen(file, "r");
  while ((c = fgetc(stream)) != EOF)
    putchar(c);
  fclose(stream);
}


x86 assembly (clang, -O0):
<read_from_pipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0xeab(%rip),%rsi
call   1060 <fdopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <fgetc@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e77(%rip),%rcx
cmp    (%rcx),%eax
je     1186 <read_from_pipe+0x46>
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
jmp    115e <read_from_pipe+0x1e>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_from_pipe>:
push   %r14
push   %rbx
push   %rax
lea    0xeb5(%rip),%rsi
call   1060 <fdopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <fgetc@plt>
mov    0x2e86(%rip),%r14
cmp    (%r14),%eax
je     1184 <read_from_pipe+0x44>
nopw   0x0(%rax,%rax,1)
mov    %eax,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1050 <fgetc@plt>
cmp    (%r14),%eax
jne    1170 <read_from_pipe+0x30>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fclose@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@EOF = global i32 0
define void @read_from_pipe(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i32* @fdopen(i32 %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %3
br label %7
7: ; preds = %12, %1
%8 = load i32*, i32** %3
%9 = call i32 @fgetc(i32* %8)
store i32 %9, i32* %4
%10 = load i32, i32* @EOF
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load i32, i32* %4
%14 = call i32 @putchar(i32 %13)
br label %7
15: ; preds = %7
%16 = load i32*, i32** %3
%17 = call i32 @fclose(i32* %16)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@EOF = global i32 0
define void @read_from_pipe(i32 %0) {
%2 = tail call i32* @fdopen(i32 %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @fgetc(i32* %2)
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %12, label %6
6: ; preds = %1, %6
%7 = phi i32 [ %9, %6 ], [ %3, %1 ]
%8 = tail call i32 @putchar(i32 %7)
%9 = tail call i32 @fgetc(i32* %2)
%10 = load i32, i32* @EOF
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %6
12: ; preds = %6, %1
%13 = tail call i32 @fclose(i32* %2)
ret void
}
/* Variables and functions */
int tuner_i2c_write(void *, unsigned short, unsigned char, int, unsigned char *,
                    int);
int fc8300_write(void *handle, unsigned short devid, unsigned char addr,
                 unsigned char data) {
  int res;
  res = tuner_i2c_write(handle, devid, addr, 1, &data, 1);
  return res;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %si,%dx
mov    %rdi,-0x8(%rbp)
mov    %dx,-0xa(%rbp)
mov    %cl,-0xb(%rbp)
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
mov    $0x1,%r9d
lea    -0xc(%rbp),%r8
movzwl %ax,%esi
movzbl -0xb(%rbp),%edx
mov    %r9d,%ecx
call   1030 <tuner_i2c_write@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rax
mov    %cl,0x7(%rsp)
lea    0x7(%rsp),%r8
mov    $0x1,%ecx
mov    $0x1,%r9d
call   1030 <tuner_i2c_write@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @fc8300_write(i8* %0, i16 zeroext %1, i8 zeroext %2, i8 zeroext %3) {
%5 = alloca i8*
%6 = alloca i16
%7 = alloca i8
%8 = alloca i8
%9 = alloca i32
store i8* %0, i8** %5
store i16 %1, i16* %6
store i8 %2, i8* %7
store i8 %3, i8* %8
%10 = load i8*, i8** %5
%11 = load i16, i16* %6
%12 = load i8, i8* %7
%13 = call i32 @tuner_i2c_write(i8* %10, i16 zeroext %11, i8 zeroext %12, i32 1, i8* %8, i32 1)
store i32 %13, i32* %9
%14 = load i32, i32* %9
ret i32 %14
}

LLVM IR (-O2):
define i32 @fc8300_write(i8* %0, i16 zeroext %1, i8 zeroext %2, i8 zeroext %3) {
%5 = alloca i8
store i8 %3, i8* %5
%6 = call i32 @tuner_i2c_write(i8* %0, i16 zeroext %1, i8 zeroext %2, i32 1, i8* %5, i32 1)
ret i32 %6
}
char *fgaj_blue(int c) { return c ? "[0;34m" : ""; }


x86 assembly (clang, -O0):
<fgaj_blue>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xef6(%rip),%rax
lea    0xee8(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgaj_blue>:
test   %edi,%edi
lea    0xefe(%rip),%rcx
lea    0xef0(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [8 x i8] c"\1B[0;34m\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @fgaj_blue(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0)
ret i8* %6
}

LLVM IR (-O2):
@.str = [8 x i8] c"\1B[0;34m\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @fgaj_blue(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
/* Type definitions */
struct vec3 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ vec3_reflect(float *, float *, float *);
__attribute__((always_)) struct vec3 *
psvec3_reflect(struct vec3 *result, struct vec3 *a, struct vec3 *b) {
  vec3_reflect((float *)result, (float *)a, (float *)b);
  return result;
}


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

x86 assembly (clang, -O2):
<psvec3_reflect>:
push   %rbx
mov    %rdi,%rbx
call   1030 <vec3_reflect@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.vec3 = type { i32 }
define %struct.vec3* @psvec3_reflect(%struct.vec3* %0, %struct.vec3* %1, %struct.vec3* %2) {
%4 = alloca %struct.vec3*
%5 = alloca %struct.vec3*
%6 = alloca %struct.vec3*
store %struct.vec3* %0, %struct.vec3** %4
store %struct.vec3* %1, %struct.vec3** %5
store %struct.vec3* %2, %struct.vec3** %6
%7 = load %struct.vec3*, %struct.vec3** %4
%8 = bitcast %struct.vec3* %7 to float*
%9 = load %struct.vec3*, %struct.vec3** %5
%10 = bitcast %struct.vec3* %9 to float*
%11 = load %struct.vec3*, %struct.vec3** %6
%12 = bitcast %struct.vec3* %11 to float*
%13 = call i32 @vec3_reflect(float* %8, float* %10, float* %12)
%14 = load %struct.vec3*, %struct.vec3** %4
ret %struct.vec3* %14
}

LLVM IR (-O2):
%struct.vec3 = type { i32 }
define %struct.vec3* @psvec3_reflect(%struct.vec3* returned %0, %struct.vec3* %1, %struct.vec3* %2) {
%4 = bitcast %struct.vec3* %0 to float*
%5 = bitcast %struct.vec3* %1 to float*
%6 = bitcast %struct.vec3* %2 to float*
%7 = tail call i32 @vec3_reflect(float* %4, float* %5, float* %6)
ret %struct.vec3* %0
}
/* Variables and functions */
int /*<<< orphan*/ gen_call(char *);
void gen_complement(void) { gen_call("cccom"); }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"cccom\00"
define void @gen_complement() {
%1 = call i32 @gen_call(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"cccom\00"
define void @gen_complement() {
%1 = tail call i32 @gen_call(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(float *, int /*<<< orphan*/, int);
void clear_mtx44(float *m) { memset(m, 0, 16 * sizeof(float)); }


x86 assembly (clang, -O0):
<clear_mtx44>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1030 <memset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_mtx44>:
xor    %esi,%esi
mov    $0x40,%edx
jmp    1030 <memset@plt>

LLVM IR (-O0):
define void @clear_mtx44(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
%4 = call i32 @memset(float* %3, i32 0, i32 64)
ret void
}

LLVM IR (-O2):
define void @clear_mtx44(float* %0) {
%2 = tail call i32 @memset(float* %0, i32 0, i32 64)
ret void
}
void foo432() {}


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

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

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

LLVM IR (-O2):
define void @foo432() {
ret void
}
int getBit(int number, int position) {
  unsigned int bitmask = 1 << position;
  return (number & bitmask) ? 1 : 0;
}


x86 assembly (clang, -O0):
<getBit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edx
and    -0xc(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getBit>:
mov    %esi,%ecx
mov    %edi,%eax
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @getBit(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = shl i32 1, %6
store i32 %7, i32* %5
%8 = load i32, i32* %3
%9 = load i32, i32* %5
%10 = and i32 %8, %9
%11 = icmp ne i32 %10, 0
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 1, i32 0
ret i32 %13
}

LLVM IR (-O2):
define i32 @getBit(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
%4 = and i32 %3, 1
ret i32 %4
}
void plugin_exit_test(void) {}


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

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

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

LLVM IR (-O2):
define void @plugin_exit_test() {
ret void
}
/* Variables and functions */
int serial_init(char *, int);
int InitPort(char *port) { return serial_init(port, 115200); }


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

x86 assembly (clang, -O2):
<InitPort>:
mov    $0x1c200,%esi
jmp    1030 <serial_init@plt>

LLVM IR (-O0):
define i32 @InitPort(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @serial_init(i8* %3, i32 115200)
ret i32 %4
}

LLVM IR (-O2):
define i32 @InitPort(i8* %0) {
%2 = tail call i32 @serial_init(i8* %0, i32 115200)
ret i32 %2
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int Evt_id(void const *);
uint32_t Evt_pureId(const void *my) { return Evt_id(my) & 0x7fffffffUL; }


x86 assembly (clang, -O0):
<Evt_pureId>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <Evt_id@plt>
cltq
and    $0x7fffffff,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Evt_pureId>:
push   %rax
call   1030 <Evt_id@plt>
and    $0x7fffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @Evt_pureId(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @Evt_id(i8* %3)
%5 = sext i32 %4 to i64
%6 = and i64 %5, 2147483647
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @Evt_pureId(i8* %0) {
%2 = tail call i32 @Evt_id(i8* %0)
%3 = and i32 %2, 2147483647
ret i32 %3
}