xunge/DecIR huggingface dataset:
/* Variables and functions */
int checktopology(int, double *, int, int *, int, int *, int /*<<< orphan*/);
int check_mesh_topology(int nV, double *vertex, int nF, int *face, int nT,
                        int *tetra) {
  return checktopology(nV, vertex, nF, face, nT, tetra, 0);
}


x86 assembly (clang, -O0):
<check_mesh_topology>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x30(%rbp),%r9
xor    %eax,%eax
movl   $0x0,(%rsp)
call   1030 <checktopology@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_mesh_topology>:
push   %rax
movl   $0x0,(%rsp)
call   1030 <checktopology@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @check_mesh_topology(i32 %0, double* %1, i32 %2, i32* %3, i32 %4, i32* %5) {
%7 = alloca i32
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32*
store i32 %0, i32* %7
store double* %1, double** %8
store i32 %2, i32* %9
store i32* %3, i32** %10
store i32 %4, i32* %11
store i32* %5, i32** %12
%13 = load i32, i32* %7
%14 = load double*, double** %8
%15 = load i32, i32* %9
%16 = load i32*, i32** %10
%17 = load i32, i32* %11
%18 = load i32*, i32** %12
%19 = call i32 @checktopology(i32 %13, double* %14, i32 %15, i32* %16, i32 %17, i32* %18, i32 0)
ret i32 %19
}

LLVM IR (-O2):
define i32 @check_mesh_topology(i32 %0, double* %1, i32 %2, i32* %3, i32 %4, i32* %5) {
%7 = tail call i32 @checktopology(i32 %0, double* %1, i32 %2, i32* %3, i32 %4, i32* %5, i32 0)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ yyy();
int main() { yyy(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <yyy@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @yyy()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @yyy()
ret i32 0
}
/* Variables and functions */
int strlen(char s[]) {
  int i = 0, l = 0;
  while (s[i] != '\0') {
    i++;
    l++;
  }
  return l;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1142 <strlen+0x42>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <strlen+0x16>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111c <strlen+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %6, %4 ], [ 0, %1 ]
%6 = add nuw nsw i64 %5, 1
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %10, label %4
10: ; preds = %4
%11 = trunc i64 %6 to i32
br label %12
12: ; preds = %10, %1
%13 = phi i32 [ 0, %1 ], [ %11, %10 ]
ret i32 %13
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double now(void) {
  struct timeval now;
  gettimeofday(&now, NULL);
  return (double)now.tv_sec + (double)now.tv_usec / 1000000.;
}


x86 assembly (clang, -O0):
<now>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq -0x8(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
movsd  0xec7(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<now>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdq 0x8(%rsp),%xmm0
divsd  0xeca(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define double @now() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%4 = load i64, i64* %3
%5 = sitofp i64 %4 to double
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%7 = load i64, i64* %6
%8 = sitofp i64 %7 to double
%9 = fdiv double %8, 1.000000e+06
%10 = fadd double %5, %9
ret double %10
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define double @now() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = fdiv double %9, 1.000000e+06
%11 = fadd double %10, %6
ret double %11
}
/* Variables and functions */
int /*<<< orphan*/ getCommandLine(int *, int, char **);
int /*<<< orphan*/ printHeader(int);
int /*<<< orphan*/ printSet(int);
void main(int argc, char **argv) {
  int inputs;
  getCommandLine(&inputs, argc, argv);
  printHeader(inputs);
  printSet(inputs);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rdi
call   1040 <getCommandLine@plt>
mov    -0x14(%rbp),%edi
call   1030 <printHeader@plt>
mov    -0x14(%rbp),%edi
call   1050 <printSet@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %rsi,%rdx
mov    %edi,%esi
lea    0x4(%rsp),%rdi
call   1040 <getCommandLine@plt>
mov    0x4(%rsp),%edi
call   1030 <printHeader@plt>
mov    0x4(%rsp),%edi
call   1050 <printSet@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = load i32, i32* %3
%7 = load i8**, i8*** %4
%8 = call i32 @getCommandLine(i32* %5, i32 %6, i8** %7)
%9 = load i32, i32* %5
%10 = call i32 @printHeader(i32 %9)
%11 = load i32, i32* %5
%12 = call i32 @printSet(i32 %11)
ret void
}

LLVM IR (-O2):
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @getCommandLine(i32* %3, i32 %0, i8** %1)
%6 = load i32, i32* %3
%7 = call i32 @printHeader(i32 %6)
%8 = load i32, i32* %3
%9 = call i32 @printSet(i32 %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void put_stars(int no) {
  while (no-- > 0)
    putchar('*');
}


x86 assembly (clang, -O0):
<put_stars>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
jle    113e <put_stars+0x2e>
mov    $0x2a,%edi
call   1030 <putchar@plt>
jmp    111b <put_stars+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_stars>:
push   %rbx
test   %edi,%edi
jle    1132 <put_stars+0x22>
mov    %edi,%ebx
add    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1120 <put_stars+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @put_stars(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = load i32, i32* %2
%5 = add nsw i32 %4, -1
store i32 %5, i32* %2
%6 = icmp sgt i32 %4, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = call i32 @putchar(i8 signext 42)
br label %3
9: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @put_stars(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %5, %3 ], [ %0, %1 ]
%5 = add nsw i32 %4, -1
%6 = tail call i32 @putchar(i8 signext 42)
%7 = icmp ugt i32 %4, 1
br i1 %7, label %3, label %8
8: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_array(char **ptr, int num) {
  int i;
  for (i = 0; i < num; i++)
    printf("%s ", ptr[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<print_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115a <print_array+0x4a>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_array+0x16>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <print_array+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print_array+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s \00"
define void @print_array(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ ntohs(int /*<<< orphan*/);
uint16_t chitcp_ntohs(uint16_t netshort) { return ntohs(netshort); }


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

x86 assembly (clang, -O2):
<chitcp_ntohs>:
jmp    1030 <ntohs@plt>

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

LLVM IR (-O2):
define i32 @chitcp_ntohs(i32 %0) {
%2 = tail call i32 @ntohs(i32 %0)
ret i32 %2
}
int cairo_code_draw_cheapTitle_get_width() { return 252; }


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

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

LLVM IR (-O0):
define i32 @cairo_code_draw_cheapTitle_get_width() {
ret i32 252
}

LLVM IR (-O2):
define i32 @cairo_code_draw_cheapTitle_get_width() {
ret i32 252
}
void cleanup2(void *arg) { *(int *)arg = 3; }


x86 assembly (clang, -O0):
<cleanup2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x3,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanup2>:
movl   $0x3,(%rdi)
ret

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

LLVM IR (-O2):
define void @cleanup2(i8* nocapture writeonly %0) {
%2 = bitcast i8* %0 to i32*
store i32 3, i32* %2
ret void
}
/* Variables and functions */
float DistanceBetween(int, int, int, int);
float CostOfGoal(int X1, int Y1, int X2, int Y2, int (*GetMap)(int, int)) {
  return DistanceBetween(X1, Y1, X2, Y2);
}


x86 assembly (clang, -O0):
<CostOfGoal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1030 <DistanceBetween@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CostOfGoal>:
jmp    1030 <DistanceBetween@plt>

LLVM IR (-O0):
define float @CostOfGoal(i32 %0, i32 %1, i32 %2, i32 %3, i32 (i32, i32)* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32 (i32, i32)*
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 (i32, i32)* %4, i32 (i32, i32)** %10
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = call float @DistanceBetween(i32 %11, i32 %12, i32 %13, i32 %14)
ret float %15
}

LLVM IR (-O2):
define float @CostOfGoal(i32 %0, i32 %1, i32 %2, i32 %3, i32 (i32, i32)* nocapture readnone %4) {
%6 = tail call float @DistanceBetween(i32 %0, i32 %1, i32 %2, i32 %3)
ret float %6
}
int cairo_code_draw_envMidiLabel_get_width() { return 38; }


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

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

LLVM IR (-O0):
define i32 @cairo_code_draw_envMidiLabel_get_width() {
ret i32 38
}

LLVM IR (-O2):
define i32 @cairo_code_draw_envMidiLabel_get_width() {
ret i32 38
}
int function_receive_and_return_something(int a, int b) { return (a + b); }


x86 assembly (clang, -O0):
<function_receive_and_return_something>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<function_receive_and_return_something>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @function_receive_and_return_something(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 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @function_receive_and_return_something(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Type definitions */
struct pqueue {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
scalar_t__ pqueue_size(struct pqueue *);
int /*<<< orphan*/ printf(char *);
void assertEmptyQueue(struct pqueue *queue) {
  printf("Checking size is 0...");
  assert(pqueue_size(queue) == 0);
  printf("OK\n");
}


x86 assembly (clang, -O0):
<assertEmptyQueue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <pqueue_size@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assertEmptyQueue>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rdi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <pqueue_size@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1060 <assert@plt>
lea    0xea9(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
%struct.pqueue = type { i32 }
@.str = [22 x i8] c"Checking size is 0...\00"
@.str.1 = [4 x i8] c"OK\0A\00"
define void @assertEmptyQueue(%struct.pqueue* %0) {
%2 = alloca %struct.pqueue*
store %struct.pqueue* %0, %struct.pqueue** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = load %struct.pqueue*, %struct.pqueue** %2
%5 = call i64 @pqueue_size(%struct.pqueue* %4)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.pqueue = type { i32 }
@.str = [22 x i8] c"Checking size is 0...\00"
@str = [3 x i8] c"OK\00"
define void @assertEmptyQueue(%struct.pqueue* %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = tail call i64 @pqueue_size(%struct.pqueue* %0)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int f290(int *);
int f291(int *p) { return f290(p); }


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

x86 assembly (clang, -O2):
<f291>:
jmp    1030 <f290@plt>

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

LLVM IR (-O2):
define i32 @f291(i32* %0) {
%2 = tail call i32 @f290(i32* %0)
ret i32 %2
}
float srelerr(float a, float b) { return (a - b) / a; }


x86 assembly (clang, -O0):
<srelerr>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
divss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<srelerr>:
movaps %xmm0,%xmm2
subss  %xmm1,%xmm2
divss  %xmm0,%xmm2
movaps %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @srelerr(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 = fsub float %5, %6
%8 = load float, float* %3
%9 = fdiv float %7, %8
ret float %9
}

LLVM IR (-O2):
define float @srelerr(float %0, float %1) {
%3 = fsub float %0, %1
%4 = fdiv float %3, %0
ret float %4
}
/* Variables and functions */
char *get_processor() { return NULL; }


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

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

LLVM IR (-O0):
define i8* @get_processor() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @get_processor() {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) { printf("hello there\n"); }


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"hello there\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int const);
main() {
  const int i = 100;
  int *p = &i;
  *p = 200;
  printf("%d\n", i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x64,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0xc8,(%rax)
lea    0xec8(%rip),%rdi
mov    $0x64,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 100)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ process_includes(char *);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  if (!argv[1])
    return 1;
  fputs("Connection: close\r\n"
        "Content-Type: text/html\r\n"
        "\r\n",
        stdout);
  process_includes(argv[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
jne    1151 <main+0x31>
movl   $0x1,-0x4(%rbp)
jmp    117a <main+0x5a>
mov    0x2e88(%rip),%rax
mov    (%rax),%esi
lea    0xe9f(%rip),%rdi
call   1030 <fputs@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <process_includes@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmpq   $0x0,0x8(%rsi)
je     114d <main+0x2d>
mov    %rsi,%rbx
mov    0x2eae(%rip),%rax
mov    (%rax),%esi
lea    0xec5(%rip),%rdi
call   1030 <fputs@plt>
mov    0x8(%rbx),%rdi
call   1040 <process_includes@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"Connection: close\0D\0AContent-Type: text/html\0D\0A\0D\0A\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = icmp ne i8* %8, null
br i1 %9, label %11, label %10
10: ; preds = %2
store i32 1, i32* %3
br label %18
11: ; preds = %2
%12 = load i32, i32* @stdout
%13 = call i32 @fputs(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @process_includes(i8* %16)
store i32 0, i32* %3
br label %18
18: ; preds = %11, %10
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@.str = [47 x i8] c"Connection: close\0D\0AContent-Type: text/html\0D\0A\0D\0A\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = load i32, i32* @stdout
%8 = tail call i32 @fputs(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i8*, i8** %3
%10 = tail call i32 @process_includes(i8* %9)
br label %11
11: ; preds = %2, %6
%12 = phi i32 [ 0, %6 ], [ 1, %2 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void SignalTermHandler() {
  printf("SIGTERM handler.\n");
  return;
}


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

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

LLVM IR (-O0):
@.str = [18 x i8] c"SIGTERM handler.\0A\00"
define void @SignalTermHandler() {
%1 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [17 x i8] c"SIGTERM handler.\00"
define void @SignalTermHandler() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
ret void
}
void g_find_program_in_path() {}


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

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

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

LLVM IR (-O2):
define void @g_find_program_in_path() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(void *);
int WM_BuildTables(void) {
  srand((unsigned int)time(((void *)0)));
  return 1;
}


x86 assembly (clang, -O0):
<WM_BuildTables>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<WM_BuildTables>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @WM_BuildTables() {
%1 = call i64 @time(i8* null)
%2 = trunc i64 %1 to i32
%3 = call i32 @srand(i32 %2)
ret i32 1
}

LLVM IR (-O2):
define i32 @WM_BuildTables() {
%1 = tail call i64 @time(i8* null)
%2 = trunc i64 %1 to i32
%3 = tail call i32 @srand(i32 %2)
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ *newwin(int, int, int, int);
int /*<<< orphan*/ wborder(int /*<<< orphan*/ *, char, char, char, char, char,
                           char, char, char);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
WINDOW *create_newwin(int height, int width, int starty, int startx) {
  WINDOW *local_win;
  local_win = newwin(height, width, starty, startx);
  wborder(local_win, '|', '|', '-', '-', '+', '+', '+', '+');
  wrefresh(local_win);
  return local_win;
}


x86 assembly (clang, -O0):
<create_newwin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1050 <newwin@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x7c,%edx
mov    $0x2d,%r8d
mov    $0x2b,%r9d
mov    %edx,%esi
mov    %r8d,%ecx
movl   $0x2b,(%rsp)
movl   $0x2b,0x8(%rsp)
movl   $0x2b,0x10(%rsp)
call   1030 <wborder@plt>
mov    -0x18(%rbp),%rdi
call   1040 <wrefresh@plt>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_newwin>:
push   %rbx
call   1050 <newwin@plt>
mov    %rax,%rbx
sub    $0x8,%rsp
mov    %rax,%rdi
mov    $0x7c,%esi
mov    $0x7c,%edx
mov    $0x2d,%ecx
mov    $0x2d,%r8d
mov    $0x2b,%r9d
push   $0x2b
push   $0x2b
push   $0x2b
call   1030 <wborder@plt>
add    $0x20,%rsp
mov    %rbx,%rdi
call   1040 <wrefresh@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i32* @create_newwin(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = call i32* @newwin(i32 %10, i32 %11, i32 %12, i32 %13)
store i32* %14, i32** %9
%15 = load i32*, i32** %9
%16 = call i32 @wborder(i32* %15, i8 signext 124, i8 signext 124, i8 signext 45, i8 signext 45, i8 signext 43, i8 signext 43, i8 signext 43, i8 signext 43)
%17 = load i32*, i32** %9
%18 = call i32 @wrefresh(i32* %17)
%19 = load i32*, i32** %9
ret i32* %19
}

LLVM IR (-O2):
define i32* @create_newwin(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32* @newwin(i32 %0, i32 %1, i32 %2, i32 %3)
%6 = tail call i32 @wborder(i32* %5, i8 signext 124, i8 signext 124, i8 signext 45, i8 signext 45, i8 signext 43, i8 signext 43, i8 signext 43, i8 signext 43)
%7 = tail call i32 @wrefresh(i32* %5)
ret i32* %5
}
/* Variables and functions */
int write(int, char const *, int);
int /*<<< orphan*/ zdie(int);
void zwrite(int fd, const char *buffer, int n) {
  if (write(fd, buffer, n) == -1)
    zdie(1);
}


x86 assembly (clang, -O0):
<zwrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <write@plt>
cmp    $0xffffffff,%eax
jne    1154 <zwrite+0x34>
mov    $0x1,%edi
call   1030 <zdie@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zwrite>:
push   %rax
call   1040 <write@plt>
cmp    $0xffffffff,%eax
je     112d <zwrite+0xd>
pop    %rax
ret
mov    $0x1,%edi
pop    %rax
jmp    1030 <zdie@plt>

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

LLVM IR (-O2):
define void @zwrite(i32 %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @zdie(i32 1)
br label %8
8: ; preds = %6, %3
ret void
}
int are_equal_uchar(const void *a, const void *b) {
  return *(unsigned char *)a == *(unsigned char *)b;
}


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

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

LLVM IR (-O0):
define i32 @are_equal_uchar(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* %5
%7 = zext i8 %6 to i32
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = icmp eq i32 %7, %10
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @are_equal_uchar(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp eq i8 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef unsigned long uint32_t;

/* Variables and functions */
void AUXTDCLimitSet(uint32_t ui32Base, uint32_t ui32Limit) {
  ;
  ;
  (*((volatile unsigned long *)(ui32Base + 0x0000000C))) = ui32Limit;
}


x86 assembly (clang, -O0):
<AUXTDCLimitSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<AUXTDCLimitSet>:
mov    %rsi,0xc(%rdi)
ret

LLVM IR (-O0):
define void @AUXTDCLimitSet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* %3
%7 = add i64 %6, 12
%8 = inttoptr i64 %7 to i64*
store volatile i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @AUXTDCLimitSet(i64 %0, i64 %1) {
%3 = add i64 %0, 12
%4 = inttoptr i64 %3 to i64*
store volatile i64 %1, i64* %4
ret void
}
/* Variables and functions */
int ui_getkey();
scalar_t__ ui_kbhit();
int is_int_pending(void) {
  int res = 0;
  while (ui_kbhit()) {
    int key = ui_getkey();
    switch (key) {
    case 0x1B:
    case 0x08:
      res = 1;
      break;
    }
  }
  return res;
}


x86 assembly (clang, -O0):
<is_int_pending>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <ui_kbhit@plt>
cmp    $0x0,%rax
je     117b <is_int_pending+0x5b>
xor    %eax,%eax
call   1030 <ui_getkey@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x8,%eax
je     116f <is_int_pending+0x4f>
jmp    115e <is_int_pending+0x3e>
mov    -0xc(%rbp),%eax
sub    $0x1b,%eax
jne    1176 <is_int_pending+0x56>
jmp    116f <is_int_pending+0x4f>
movl   $0x1,-0x4(%rbp)
jmp    112f <is_int_pending+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_int_pending>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <ui_kbhit@plt>
test   %rax,%rax
je     1164 <is_int_pending+0x44>
xor    %ebx,%ebx
jmp    1151 <is_int_pending+0x31>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x1,%ebx
xor    %eax,%eax
call   1040 <ui_kbhit@plt>
test   %rax,%rax
je     1164 <is_int_pending+0x44>
xor    %eax,%eax
call   1030 <ui_getkey@plt>
cmp    $0x1b,%eax
je     1140 <is_int_pending+0x20>
cmp    $0x8,%eax
je     1140 <is_int_pending+0x20>
jmp    1145 <is_int_pending+0x25>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_int_pending() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %10, %0
%4 = call i64 (...) @ui_kbhit()
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = call i32 (...) @ui_getkey()
store i32 %7, i32* %2
%8 = load i32, i32* %2
switch i32 %8, label %10 [
i32 27, label %9
i32 8, label %9
]
9: ; preds = %6, %6
store i32 1, i32* %1
br label %10
10: ; preds = %6, %9
br label %3
11: ; preds = %3
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
define i32 @is_int_pending() {
%1 = tail call i64 (...) @ui_kbhit()
%2 = icmp eq i64 %1, 0
br i1 %2, label %11, label %3
3: ; preds = %0, %7
%4 = phi i32 [ %8, %7 ], [ 0, %0 ]
%5 = tail call i32 (...) @ui_getkey()
switch i32 %5, label %7 [
i32 27, label %6
i32 8, label %6
]
6: ; preds = %3, %3
br label %7
7: ; preds = %3, %6
%8 = phi i32 [ %4, %3 ], [ 1, %6 ]
%9 = tail call i64 (...) @ui_kbhit()
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %3
11: ; preds = %7, %0
%12 = phi i32 [ 0, %0 ], [ %8, %7 ]
ret i32 %12
}
int foo(int *p) {
  int i = 0, *x;
  for (x = p; x < p + 2; x++)
    i++;
  return i;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
add    $0x8,%rcx
cmp    %rcx,%rax
jae    1146 <foo+0x46>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
jmp    1117 <foo+0x17>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @foo(i32* nocapture readnone %0) {
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
char *fmsg(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void log_msg(int msg_nr) {
  fprintf(stderr, fmsg(msg_nr));
  exit(-1);
}


x86 assembly (clang, -O0):
<log_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <fmsg@plt>
mov    -0x8(%rbp),%edi
mov    %rax,%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<log_msg>:
push   %rbx
mov    0x2ea8(%rip),%rax
mov    (%rax),%ebx
call   1030 <fmsg@plt>
mov    %ebx,%edi
mov    %rax,%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
define void @log_msg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stderr
%4 = load i32, i32* %2
%5 = call i8* @fmsg(i32 %4)
%6 = call i32 @fprintf(i32 %3, i8* %5)
%7 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
define void @log_msg(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i8* @fmsg(i32 %0)
%4 = tail call i32 @fprintf(i32 %2, i8* %3)
%5 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ stack_push(int);
void stack_up(int max) {
  for (int value = max; value >= 1; value--) {
    stack_push(value);
  }
}


x86 assembly (clang, -O0):
<stack_up>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     1141 <stack_up+0x31>
mov    -0x8(%rbp),%edi
call   1030 <stack_push@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1121 <stack_up+0x11>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stack_up>:
push   %rbx
test   %edi,%edi
jle    1131 <stack_up+0x21>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <stack_push@plt>
lea    -0x1(%rbx),%eax
cmp    $0x1,%ebx
mov    %eax,%ebx
ja     1120 <stack_up+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @stack_up(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %4, label %3
3: ; preds = %4, %1
ret void
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ %0, %1 ]
%6 = tail call i32 @stack_push(i32 %5)
%7 = add nsw i32 %5, -1
%8 = icmp ugt i32 %5, 1
br i1 %8, label %4, label %3
}
zysul() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @zysul() {
ret i32 0
}
unsigned long long f(unsigned long long a) { return a & 0x3000ull; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0x3000,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    %rdi,%rax
and    $0x3000,%eax
ret

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

LLVM IR (-O2):
define i64 @f(i64 %0) {
%2 = and i64 %0, 12288
ret i64 %2
}
/* Variables and functions */
int execvp(char const *, char **);
int /*<<< orphan*/ g_mk_socket_path(int /*<<< orphan*/);
int /*<<< orphan*/ g_rm_temp_dir();
int g_execvp(const char *p1, char *args[]) {
  int rv;
  g_rm_temp_dir();
  rv = execvp(p1, args);
  g_mk_socket_path(0);
  return rv;
}


x86 assembly (clang, -O0):
<g_execvp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <g_rm_temp_dir@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <execvp@plt>
mov    %eax,-0x14(%rbp)
xor    %edi,%edi
call   1040 <g_mk_socket_path@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_execvp>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <g_rm_temp_dir@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <execvp@plt>
mov    %eax,%ebx
xor    %edi,%edi
call   1040 <g_mk_socket_path@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @g_execvp(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca i32
store i8* %0, i8** %3
store i8** %1, i8*** %4
%6 = call i32 (...) @g_rm_temp_dir()
%7 = load i8*, i8** %3
%8 = load i8**, i8*** %4
%9 = call i32 @execvp(i8* %7, i8** %8)
store i32 %9, i32* %5
%10 = call i32 @g_mk_socket_path(i32 0)
%11 = load i32, i32* %5
ret i32 %11
}

LLVM IR (-O2):
define i32 @g_execvp(i8* %0, i8** %1) {
%3 = tail call i32 (...) @g_rm_temp_dir()
%4 = tail call i32 @execvp(i8* %0, i8** %1)
%5 = tail call i32 @g_mk_socket_path(i32 0)
ret i32 %4
}
int DRV_USB_PORT_TYPE_VALID_CHECK(unsigned char *pucPortType,
                                  unsigned int ulPortNum) {
  return 0;
}


x86 assembly (clang, -O0):
<DRV_USB_PORT_TYPE_VALID_CHECK>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @DRV_USB_PORT_TYPE_VALID_CHECK(i8* nocapture readnone %0, i32 %1) {
ret i32 0
}
void replace_char(char *str, char find, char replace) {
  while (*str) {
    if (*str == find) {
      *str = replace;
    }
    str++;
  }
}


x86 assembly (clang, -O0):
<replace_char>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114d <replace_char+0x4d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    113c <replace_char+0x3c>
mov    -0xa(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1113 <replace_char+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<replace_char>:
mov    (%rdi),%al
test   %al,%al
je     1125 <replace_char+0x25>
add    $0x1,%rdi
jmp    111b <replace_char+0x1b>
nopl   0x0(%rax)
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
je     1125 <replace_char+0x25>
cmp    %sil,%al
jne    1110 <replace_char+0x10>
mov    %dl,-0x1(%rdi)
jmp    1110 <replace_char+0x10>
ret

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

LLVM IR (-O2):
define void @replace_char(i8* nocapture %0, i8 signext %1, i8 signext %2) {
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %3, %11
%7 = phi i8 [ %13, %11 ], [ %4, %3 ]
%8 = phi i8* [ %12, %11 ], [ %0, %3 ]
%9 = icmp eq i8 %7, %1
br i1 %9, label %10, label %11
10: ; preds = %6
store i8 %2, i8* %8
br label %11
11: ; preds = %10, %6
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %6
15: ; preds = %11, %3
ret void
}
/* Type definitions */
struct bitset {
  int dummy;
};

/* Variables and functions */
int bitset_ffs_from(struct bitset *, int /*<<< orphan*/);
int bitset_ffs(struct bitset *bitset) { return bitset_ffs_from(bitset, 0); }


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

x86 assembly (clang, -O2):
<bitset_ffs>:
xor    %esi,%esi
jmp    1030 <bitset_ffs_from@plt>

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

LLVM IR (-O2):
%struct.bitset = type { i32 }
define i32 @bitset_ffs(%struct.bitset* %0) {
%2 = tail call i32 @bitset_ffs_from(%struct.bitset* %0, i32 0)
ret i32 %2
}
unsigned int x(unsigned int a, unsigned int b, unsigned int *c,
               unsigned int *d) {
  unsigned int z = __builtin_clz(b);
  if (a != 0)
    *c = a;
  *d = a;
  return z;
}


x86 assembly (clang, -O0):
<x>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%eax
bsr    %eax,%eax
xor    $0x1f,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1131 <x+0x31>
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<x>:
test   %edi,%edi
je     1106 <x+0x6>
mov    %edi,(%rdx)
bsr    %esi,%eax
xor    $0x1f,%eax
mov    %edi,(%rcx)
ret

LLVM IR (-O0):
define i32 @x(i32 %0, i32 %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%10 = load i32, i32* %6
%11 = call i32 @llvm.ctlz.i32(i32 %10, i1 true)
store i32 %11, i32* %9
%12 = load i32, i32* %5
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %4
%15 = load i32, i32* %5
%16 = load i32*, i32** %7
store i32 %15, i32* %16
br label %17
17: ; preds = %14, %4
%18 = load i32, i32* %5
%19 = load i32*, i32** %8
store i32 %18, i32* %19
%20 = load i32, i32* %9
ret i32 %20
}

LLVM IR (-O2):
define i32 @x(i32 %0, i32 %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = icmp eq i32 %0, 0
br i1 %5, label %7, label %6
6: ; preds = %4
store i32 %0, i32* %2
br label %7
7: ; preds = %6, %4
%8 = tail call i32 @llvm.ctlz.i32(i32 %1, i1 true)
store i32 %0, i32* %3
ret i32 %8
}
/* Variables and functions */
int shell();
int main(void) { return shell(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <shell@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
jmp    1030 <shell@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @shell()
ret i32 %1
}