xunge/DecIR huggingface dataset:
char is_knight(char p) { return (p & (1 << 1)) == (1 << 1); }


x86 assembly (clang, -O0):
<is_knight>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
and    $0x2,%eax
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_knight>:
mov    %edi,%eax
shr    %al
and    $0x1,%al
ret

LLVM IR (-O0):
define signext i8 @is_knight(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 2
%6 = icmp eq i32 %5, 2
%7 = zext i1 %6 to i32
%8 = trunc i32 %7 to i8
ret i8 %8
}

LLVM IR (-O2):
define signext i8 @is_knight(i8 signext %0) {
%2 = lshr i8 %0, 1
%3 = and i8 %2, 1
ret i8 %3
}
double nearbyint(double x) { return __builtin_nearbyint(x); }


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

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

LLVM IR (-O0):
define double @nearbyint(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.nearbyint.f64(double %3)
ret double %4
}

LLVM IR (-O2):
define double @nearbyint(double %0) {
%2 = tail call double @llvm.nearbyint.f64(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ app_init(char *, int);
int dpdk_linux_tcpip_init(int, char **);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  int ret = dpdk_linux_tcpip_init(argc, argv);
  if (ret < 0) {
    printf("Invalid arguments\n");
    return 1;
  }
  app_init("192.168.1.1", 89);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <dpdk_linux_tcpip_init@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1177 <main+0x47>
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    118f <main+0x5f>
lea    0xe95(%rip),%rdi
mov    $0x59,%esi
call   1030 <app_init@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1050 <dpdk_linux_tcpip_init@plt>
test   %eax,%eax
js     114f <main+0x1f>
lea    0xebf(%rip),%rdi
mov    $0x59,%esi
call   1030 <app_init@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xeb6(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Invalid arguments\0A\00"
@.str.1 = [12 x i8] c"192.168.1.1\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = call i32 @dpdk_linux_tcpip_init(i32 %7, i8** %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %16
14: ; preds = %2
%15 = call i32 @app_init(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 89)
store i32 0, i32* %3
br label %16
16: ; preds = %14, %12
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"192.168.1.1\00"
@str = [18 x i8] c"Invalid arguments\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @dpdk_linux_tcpip_init(i32 %0, i8** %1)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %9
7: ; preds = %2
%8 = tail call i32 @app_init(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 89)
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ 1, %5 ], [ 0, %7 ]
ret i32 %10
}
void WaitReceiveTaskEnd(void **Thread) {}


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

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

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

LLVM IR (-O2):
define void @WaitReceiveTaskEnd(i8** nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int input;
  int result;
  scanf("%d", &input);
  for (int i = 3; i <= input; i++) {
    printf("B");
  }
  printf("%d", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x3,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     116e <main+0x4e>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1146 <main+0x26>
mov    -0xc(%rbp),%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x3,0xc(%rsp)
jl     1173 <main+0x43>
mov    $0x2,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x42,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    0xc(%rsp),%ebx
jl     1160 <main+0x30>
lea    0xe86(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"B\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 3, i32* %4
br label %6
6: ; preds = %12, %0
%7 = load i32, i32* %4
%8 = load i32, i32* %2
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 1
store i32 %14, i32* %4
br label %6
15: ; preds = %6
%16 = load i32, i32* %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 3
br i1 %5, label %6, label %8
6: ; preds = %8, %0
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 undef)
ret i32 0
8: ; preds = %0, %8
%9 = phi i32 [ %11, %8 ], [ 3, %0 ]
%10 = call i32 @putchar(i32 66)
%11 = add nuw nsw i32 %9, 1
%12 = load i32, i32* %1
%13 = icmp slt i32 %9, %12
br i1 %13, label %8, label %6
}
/* Type definitions */
struct section_list {
  int dummy;
};
struct section {
  int dummy;
};
struct genlist {
  int dummy;
};

/* Variables and functions */
scalar_t__ genlist_get(struct genlist const *, int);
struct section *section_list_get(const struct section_list *tthis, int index) {
  return ((struct section *)genlist_get((const struct genlist *)tthis, index));
}


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

x86 assembly (clang, -O2):
<section_list_get>:
jmp    1030 <genlist_get@plt>

LLVM IR (-O0):
%struct.section = type { i32 }
%struct.section_list = type { i32 }
%struct.genlist = type { i32 }
define %struct.section* @section_list_get(%struct.section_list* %0, i32 %1) {
%3 = alloca %struct.section_list*
%4 = alloca i32
store %struct.section_list* %0, %struct.section_list** %3
store i32 %1, i32* %4
%5 = load %struct.section_list*, %struct.section_list** %3
%6 = bitcast %struct.section_list* %5 to %struct.genlist*
%7 = load i32, i32* %4
%8 = call i64 @genlist_get(%struct.genlist* %6, i32 %7)
%9 = inttoptr i64 %8 to %struct.section*
ret %struct.section* %9
}

LLVM IR (-O2):
%struct.section = type { i32 }
%struct.section_list = type { i32 }
%struct.genlist = type { i32 }
define %struct.section* @section_list_get(%struct.section_list* %0, i32 %1) {
%3 = bitcast %struct.section_list* %0 to %struct.genlist*
%4 = tail call i64 @genlist_get(%struct.genlist* %3, i32 %1)
%5 = inttoptr i64 %4 to %struct.section*
ret %struct.section* %5
}
unsigned int get_total_context_switches() { return 600000; }


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

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

LLVM IR (-O0):
define i32 @get_total_context_switches() {
ret i32 600000
}

LLVM IR (-O2):
define i32 @get_total_context_switches() {
ret i32 600000
}
void set_sr(int n, int val) {}


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

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

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

LLVM IR (-O2):
define void @set_sr(i32 %0, i32 %1) {
ret void
}
int quit_server(void) { return (1); }


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

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

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

LLVM IR (-O2):
define i32 @quit_server() {
ret i32 1
}
int test_signbit(double x) { return __builtin_signbit(x); }


x86 assembly (clang, -O0):
<test_signbit>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
cmp    $0x0,%rax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_signbit>:
movmskpd %xmm0,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @test_signbit(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = bitcast double %3 to i64
%5 = icmp slt i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @test_signbit(double %0) {
%2 = bitcast double %0 to i64
%3 = lshr i64 %2, 63
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
float fabs(float n) { return n > 0 ? n : -n; }


x86 assembly (clang, -O0):
<fabs>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1129 <fabs+0x29>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    1140 <fabs+0x40>
movss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fabs>:
movaps 0xef9(%rip),%xmm1
xorps  %xmm0,%xmm1
xorps  %xmm2,%xmm2
cmpltss %xmm0,%xmm2
andps  %xmm2,%xmm0
andnps %xmm1,%xmm2
orps   %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @fabs(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp ogt float %3, 0.000000e+00
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load float, float* %2
br label %10
7: ; preds = %1
%8 = load float, float* %2
%9 = fneg float %8
br label %10
10: ; preds = %7, %5
%11 = phi float [ %6, %5 ], [ %9, %7 ]
ret float %11
}

LLVM IR (-O2):
define float @fabs(float %0) {
%2 = fcmp ogt float %0, 0.000000e+00
%3 = fneg float %0
%4 = select i1 %2, float %0, float %3
ret float %4
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void bmp_print(uint8_t *buf, size_t buflen) {
  size_t i;
  for (i = 0; i < buflen; i++) {
    printf("%02X", buf[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<bmp_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1160 <bmp_print+0x50>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <bmp_print+0x18>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [5 x i8] c"%02X\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @bmp_print(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %6
6: ; preds = %16, %2
%7 = load i64, i64* %5
%8 = load i64, i64* %4
%9 = icmp ult i64 %7, %8
br i1 %9, label %10, label %19
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i64, i64* %5
%13 = getelementptr inbounds i32, i32* %11, i64 %12
%14 = load i32, i32* %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %10
%17 = load i64, i64* %5
%18 = add i64 %17, 1
store i64 %18, i64* %5
br label %6
19: ; preds = %6
%20 = 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 = [5 x i8] c"%02X\00"
define void @bmp_print(i32* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %11, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %9, %4 ], [ 0, %2 ]
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = load i32, i32* %6
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = add nuw i64 %5, 1
%10 = icmp eq i64 %9, %1
br i1 %10, label %11, label %4
11: ; preds = %4, %2
%12 = tail call i32 @putchar(i32 10)
ret void
}
int systemInitialize(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @systemInitialize() {
ret i32 0
}
/* Type definitions */
struct _mesa_symbol_table_iterator {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct _mesa_symbol_table_iterator *);
void _mesa_symbol_table_iterator_dtor(
    struct _mesa_symbol_table_iterator *iter) {
  free(iter);
}


x86 assembly (clang, -O0):
<_mesa_symbol_table_iterator_dtor>:
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):
<_mesa_symbol_table_iterator_dtor>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct._mesa_symbol_table_iterator = type { i32 }
define void @_mesa_symbol_table_iterator_dtor(%struct._mesa_symbol_table_iterator* nocapture %0) {
%2 = tail call i32 @free(%struct._mesa_symbol_table_iterator* %0)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
uint32_t timeout_decode(uint16_t t) {
  uint8_t pow = t >> 8;
  uint8_t base_mult = t & 0xff;
  uint32_t mult = 1 << pow;
  return base_mult * mult + 1;
}


x86 assembly (clang, -O0):
<timeout_decode>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeout_decode>:
movzbl %dil,%eax
mov    %edi,%ecx
shr    $0x8,%ecx
shl    %cl,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @timeout_decode(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = ashr i32 %6, 8
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = and i32 %8, 255
store i32 %9, i32* %4
%10 = load i32, i32* %3
%11 = shl i32 1, %10
store i32 %11, i32* %5
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = mul nsw i32 %12, %13
%15 = add nsw i32 %14, 1
ret i32 %15
}

LLVM IR (-O2):
define i32 @timeout_decode(i32 %0) {
%2 = ashr i32 %0, 8
%3 = and i32 %0, 255
%4 = shl i32 %3, %2
%5 = add nsw i32 %4, 1
ret i32 %5
}
void ASN1_sign(void) {}


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

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

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

LLVM IR (-O2):
define void @ASN1_sign() {
ret void
}
unsigned atomHashFunction(register int *parameters) {
  register int *ip;
  register unsigned index;
  index = 0;
  for (ip = parameters; *ip != -1; ++ip)
    index += *ip;
  return (index < 1021 ? index : index % 1021);
}


x86 assembly (clang, -O0):
<atomHashFunction>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0xffffffff,(%rax)
je     1141 <atomHashFunction+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
jmp    1117 <atomHashFunction+0x17>
cmpl   $0x3fd,-0x14(%rbp)
jae    1159 <atomHashFunction+0x59>
mov    -0x14(%rbp),%edx
mov    %edx,-0x18(%rbp)
jmp    1168 <atomHashFunction+0x68>
mov    -0x14(%rbp),%eax
mov    $0x3fd,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<atomHashFunction>:
mov    (%rdi),%ecx
cmp    $0xffffffff,%ecx
je     1145 <atomHashFunction+0x45>
add    $0x4,%rdi
xor    %eax,%eax
nopl   (%rax)
add    %ecx,%eax
mov    (%rdi),%ecx
add    $0x4,%rdi
cmp    $0xffffffff,%ecx
jne    1110 <atomHashFunction+0x10>
cmp    $0x3fc,%eax
jbe    1144 <atomHashFunction+0x44>
mov    %eax,%ecx
imul   $0xc0906d,%rcx,%rcx
shr    $0x20,%rcx
mov    %eax,%edx
sub    %ecx,%edx
shr    %edx
add    %ecx,%edx
shr    $0x9,%edx
imul   $0x3fd,%edx,%ecx
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @atomHashFunction(i32* %0) {
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %4
%5 = load i32*, i32** %2
store i32* %5, i32** %3
br label %6
6: ; preds = %15, %1
%7 = load i32*, i32** %3
%8 = load i32, i32* %7
%9 = icmp ne i32 %8, -1
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %11
%13 = load i32, i32* %4
%14 = add i32 %13, %12
store i32 %14, i32* %4
br label %15
15: ; preds = %10
%16 = load i32*, i32** %3
%17 = getelementptr inbounds i32, i32* %16, i32 1
store i32* %17, i32** %3
br label %6
18: ; preds = %6
%19 = load i32, i32* %4
%20 = icmp ult i32 %19, 1021
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = load i32, i32* %4
br label %26
23: ; preds = %18
%24 = load i32, i32* %4
%25 = urem i32 %24, 1021
br label %26
26: ; preds = %23, %21
%27 = phi i32 [ %22, %21 ], [ %25, %23 ]
ret i32 %27
}

LLVM IR (-O2):
define i32 @atomHashFunction(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, -1
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %10, %4 ], [ %2, %1 ]
%6 = phi i32 [ %8, %4 ], [ 0, %1 ]
%7 = phi i32* [ %9, %4 ], [ %0, %1 ]
%8 = add i32 %5, %6
%9 = getelementptr inbounds i32, i32* %7, i64 1
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %4
12: ; preds = %4
%13 = icmp ult i32 %8, 1021
%14 = urem i32 %8, 1021
br i1 %13, label %15, label %17
15: ; preds = %1, %12
%16 = phi i32 [ %8, %12 ], [ 0, %1 ]
br label %17
17: ; preds = %12, %15
%18 = phi i32 [ %16, %15 ], [ %14, %12 ]
ret i32 %18
}
/* Variables and functions */
scalar_t__ SDL_sin(double);
float SDL_sinf(float x) { return (float)SDL_sin((double)x); }


x86 assembly (clang, -O0):
<SDL_sinf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <SDL_sin@plt>
cvtsi2ss %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SDL_sinf>:
push   %rax
cvtss2sd %xmm0,%xmm0
call   1030 <SDL_sin@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @SDL_sinf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = call i64 @SDL_sin(double %4)
%6 = sitofp i64 %5 to float
ret float %6
}

LLVM IR (-O2):
define float @SDL_sinf(float %0) {
%2 = fpext float %0 to double
%3 = tail call i64 @SDL_sin(double %2)
%4 = sitofp i64 %3 to float
ret float %4
}
/* Type definitions */
typedef int u_int8_t;

/* Variables and functions */
u_int8_t eshadow(u_int8_t a, u_int8_t d) { return ((d << 8) - a * d) >> 8; }


x86 assembly (clang, -O0):
<eshadow>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x8,%eax
mov    -0x4(%rbp),%ecx
imul   -0x8(%rbp),%ecx
sub    %ecx,%eax
sar    $0x8,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<eshadow>:
mov    $0x100,%eax
sub    %edi,%eax
imul   %esi,%eax
sar    $0x8,%eax
ret

LLVM IR (-O0):
define i32 @eshadow(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = shl i32 %5, 8
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = mul nsw i32 %7, %8
%10 = sub nsw i32 %6, %9
%11 = ashr i32 %10, 8
ret i32 %11
}

LLVM IR (-O2):
define i32 @eshadow(i32 %0, i32 %1) {
%3 = sub i32 256, %0
%4 = mul i32 %3, %1
%5 = ashr i32 %4, 8
ret i32 %5
}
unsigned char PLAL_FS450_i2c_address(void) { return (0x4A); }


x86 assembly (clang, -O0):
<PLAL_FS450_i2c_address>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4a,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<PLAL_FS450_i2c_address>:
mov    $0x4a,%al
ret

LLVM IR (-O0):
define zeroext i8 @PLAL_FS450_i2c_address() {
ret i8 74
}

LLVM IR (-O2):
define zeroext i8 @PLAL_FS450_i2c_address() {
ret i8 74
}
void bzero(s, len) char *s;
int len;
{
  for (; len > 0; len--)
    *s++ = (char)0;
}


x86 assembly (clang, -O0):
<bzero>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1135 <bzero+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x0,(%rax)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    110b <bzero+0xb>
pop    %rbp
ret

x86 assembly (clang, -O2):
<bzero>:
test   %esi,%esi
jle    1122 <bzero+0x12>
push   %rax
mov    %esi,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @bzero(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %2
ret void
}
void stats_deinit(void) {}


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

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

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

LLVM IR (-O2):
define void @stats_deinit() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EPRIME();
int /*<<< orphan*/ T();
void E() {
  T();
  EPRIME();
}


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

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

LLVM IR (-O0):
define void @E() {
%1 = call i32 (...) @T()
%2 = call i32 (...) @EPRIME()
ret void
}

LLVM IR (-O2):
define void @E() {
%1 = tail call i32 (...) @T()
%2 = tail call i32 (...) @EPRIME()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  printf("Course: EG1302A - Spring 2014\n");
  printf("Name: Fernando Urbina\n");
  printf("Date Created: %d/%d/%d\n", 1, 28, 2014);
  printf("Assignment: Assignment 05\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
mov    $0x1,%esi
mov    $0x1c,%edx
mov    $0x7de,%ecx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
lea    0xf02(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rdi
mov    $0x1,%esi
mov    $0x1c,%edx
mov    $0x7de,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeef(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Course: EG1302A - Spring 2014\0A\00"
@.str.1 = [23 x i8] c"Name: Fernando Urbina\0A\00"
@.str.2 = [24 x i8] c"Date Created: %d/%d/%d\0A\00"
@.str.3 = [27 x i8] c"Assignment: Assignment 05\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 28, i32 2014)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [24 x i8] c"Date Created: %d/%d/%d\0A\00"
@str = [30 x i8] c"Course: EG1302A - Spring 2014\00"
@str.4 = [22 x i8] c"Name: Fernando Urbina\00"
@str.5 = [26 x i8] c"Assignment: Assignment 05\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 28, i32 2014)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ p;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int *p = NULL;
  printf("%ld\n", sizeof(p));
  if (sizeof(p) == 4)
    printf("Machine is 32 bit\n");
  else
    printf("Machine is 64 bit\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"%ld\0A\00"
@.str.1 = [19 x i8] c"Machine is 64 bit\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
store i32* null, i32** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 8)
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%ld\0A\00"
@str = [18 x i8] c"Machine is 64 bit\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 8)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void phoneHome() { printf("Phoning home!  The flag is..."); }


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

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

LLVM IR (-O0):
@.str = [30 x i8] c"Phoning home! The flag is...\00"
define void @phoneHome() {
%1 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"Phoning home! The flag is...\00"
define void @phoneHome() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int rand();
void randomizeArray(unsigned char *pArray, int len) {
  int i;
  for (i = 0; i < len; i++) {
    pArray[i] = rand() % 255;
  }
}


x86 assembly (clang, -O0):
<randomizeArray>:
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 <randomizeArray+0x4a>
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0xff,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <randomizeArray+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomizeArray>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    115f <randomizeArray+0x4f>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0xffffffff80808081,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
shr    $0x7,%ecx
add    %edx,%ecx
add    %eax,%ecx
mov    %cl,(%r14,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <randomizeArray+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @randomizeArray(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 = %18, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %21
10: ; preds = %6
%11 = call i32 (...) @rand()
%12 = srem i32 %11, 255
%13 = trunc i32 %12 to i8
%14 = load i8*, i8** %3
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
store i8 %13, i8* %17
br label %18
18: ; preds = %10
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @randomizeArray(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = tail call i32 (...) @rand()
%9 = srem i32 %8, 255
%10 = trunc i32 %9 to i8
%11 = getelementptr inbounds i8, i8* %0, i64 %7
store i8 %10, i8* %11
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
unsigned int normalize(unsigned int, unsigned int);
unsigned int ringbuffer_normalize(unsigned int a, unsigned int begin,
                                  unsigned int end) {
  assert(end >= begin);
  assert(a >= begin);
  return normalize(a, end - begin);
}


x86 assembly (clang, -O0):
<ringbuffer_normalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
sub    -0x8(%rbp),%esi
call   1030 <normalize@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ringbuffer_normalize>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r14d
xor    %edi,%edi
sub    %esi,%ebx
setae  %dil
call   1040 <assert@plt>
xor    %edi,%edi
cmp    %ebp,%r14d
setae  %dil
call   1040 <assert@plt>
mov    %r14d,%edi
mov    %ebx,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <normalize@plt>

LLVM IR (-O0):
define i32 @ringbuffer_normalize(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* %6
%8 = load i32, i32* %5
%9 = icmp uge i32 %7, %8
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = icmp uge i32 %12, %13
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load i32, i32* %4
%18 = load i32, i32* %6
%19 = load i32, i32* %5
%20 = sub i32 %18, %19
%21 = call i32 @normalize(i32 %17, i32 %20)
ret i32 %21
}

LLVM IR (-O2):
define i32 @ringbuffer_normalize(i32 %0, i32 %1, i32 %2) {
%4 = icmp uge i32 %2, %1
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = icmp uge i32 %0, %1
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = sub i32 %2, %1
%11 = tail call i32 @normalize(i32 %0, i32 %10)
ret i32 %11
}
/* Variables and functions */
int testLibCycleB3();
int testLibCycleA3(void) { return testLibCycleB3(); }


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

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

LLVM IR (-O0):
define i32 @testLibCycleA3() {
%1 = call i32 (...) @testLibCycleB3()
ret i32 %1
}

LLVM IR (-O2):
define i32 @testLibCycleA3() {
%1 = tail call i32 (...) @testLibCycleB3()
ret i32 %1
}
int cairo_code_draw_envMinimumLabel_get_width() { return 7; }


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

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

LLVM IR (-O0):
define i32 @cairo_code_draw_envMinimumLabel_get_width() {
ret i32 7
}

LLVM IR (-O2):
define i32 @cairo_code_draw_envMinimumLabel_get_width() {
ret i32 7
}
int _cmp_int(const void *_a, const void *_b) {
  const int *a = _a, *b = _b;
  if (*a < *b)
    return -1;
  else if (*a > *b)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<_cmp_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jge    113a <_cmp_int+0x3a>
movl   $0xffffffff,-0x4(%rbp)
jmp    115f <_cmp_int+0x5f>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jle    1158 <_cmp_int+0x58>
movl   $0x1,-0x4(%rbp)
jmp    115f <_cmp_int+0x5f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cmp_int>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @_cmp_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp slt i32 %5, %6
%8 = icmp sgt i32 %5, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ MYSQL_RES;

/* Variables and functions */
int mysql_num_fields(int /*<<< orphan*/ *);
int MysqlGetNumColumns(MYSQL_RES *sqlResult) {
  if (sqlResult == NULL)
    return 0;
  return mysql_num_fields(sqlResult);
}


x86 assembly (clang, -O0):
<MysqlGetNumColumns>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <MysqlGetNumColumns+0x23>
movl   $0x0,-0x4(%rbp)
jmp    113f <MysqlGetNumColumns+0x2f>
mov    -0x10(%rbp),%rdi
call   1030 <mysql_num_fields@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MysqlGetNumColumns>:
test   %rdi,%rdi
je     111a <MysqlGetNumColumns+0xa>
jmp    1030 <mysql_num_fields@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @MysqlGetNumColumns(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %10
7: ; preds = %1
%8 = load i32*, i32** %3
%9 = call i32 @mysql_num_fields(i32* %8)
store i32 %9, i32* %2
br label %10
10: ; preds = %7, %6
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
define i32 @MysqlGetNumColumns(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @mysql_num_fields(i32* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 0, %1 ]
ret i32 %6
}
/* Variables and functions */
int PTR_ERR(const void *ptr) { return (int)(uintptr_t)ptr; }


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

x86 assembly (clang, -O2):
<PTR_ERR>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
define i32 @PTR_ERR(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i64
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @PTR_ERR(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Type definitions */
struct termios {
  int /*<<< orphan*/ c_lflag;
};

/* Variables and functions */
int /*<<< orphan*/ ISIG;
int /*<<< orphan*/ TCSANOW;
int /*<<< orphan*/ tcgetattr(int /*<<< orphan*/, struct termios *);
int /*<<< orphan*/ tcsetattr(int /*<<< orphan*/, int /*<<< orphan*/,
                             struct termios *);
void disable_signals(void) {
  struct termios term;
  tcgetattr(0, &term);
  term.c_lflag &= ~ISIG;
  tcsetattr(0, TCSANOW, &term);
}


x86 assembly (clang, -O0):
<disable_signals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
lea    -0x8(%rbp),%rsi
call   1030 <tcgetattr@plt>
mov    0x2ea6(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e9c(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
lea    -0x8(%rbp),%rdx
call   1040 <tcsetattr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disable_signals>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rbx
xor    %edi,%edi
mov    %rbx,%rsi
call   1030 <tcgetattr@plt>
mov    0x2ea5(%rip),%rax
mov    (%rax),%eax
not    %eax
and    %eax,0x8(%rsp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
mov    %rbx,%rdx
call   1040 <tcsetattr@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.termios = type { i32 }
@ISIG = global i32 0
@TCSANOW = global i32 0
define void @disable_signals() {
%1 = alloca %struct.termios
%2 = call i32 @tcgetattr(i32 0, %struct.termios* %1)
%3 = load i32, i32* @ISIG
%4 = xor i32 %3, -1
%5 = getelementptr inbounds %struct.termios, %struct.termios* %1, i32 0, i32 0
%6 = load i32, i32* %5
%7 = and i32 %6, %4
store i32 %7, i32* %5
%8 = load i32, i32* @TCSANOW
%9 = call i32 @tcsetattr(i32 0, i32 %8, %struct.termios* %1)
ret void
}

LLVM IR (-O2):
%struct.termios = type { i32 }
@ISIG = global i32 0
@TCSANOW = global i32 0
define void @disable_signals() {
%1 = alloca %struct.termios
%2 = bitcast %struct.termios* %1 to i8*
%3 = call i32 @tcgetattr(i32 0, %struct.termios* %1)
%4 = load i32, i32* @ISIG
%5 = xor i32 %4, -1
%6 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 0
%7 = load i32, i32* %6
%8 = and i32 %7, %5
store i32 %8, i32* %6
%9 = load i32, i32* @TCSANOW
%10 = call i32 @tcsetattr(i32 0, i32 %9, %struct.termios* %1)
ret void
}
int test_unsignedint() {
  int i;
  unsigned int sums[2] = {0};
#pragma acc parallel loop
  for (i = 0; i < 8192; i++) {
#pragma acc atomic
    sums[0]++;
#pragma acc atomic
    ++sums[1];
  }
  for (i = 0; i < 2; i++) {
    if (sums[i] != (8192)) {
      return i + 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<test_unsignedint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <memset@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x2000,-0x8(%rbp)
jge    115c <test_unsignedint+0x4c>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112f <test_unsignedint+0x1f>
movl   $0x0,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11a0 <test_unsignedint+0x90>
movslq -0x8(%rbp),%rax
cmpl   $0x2000,-0x10(%rbp,%rax,4)
je     118d <test_unsignedint+0x7d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11a7 <test_unsignedint+0x97>
jmp    1192 <test_unsignedint+0x82>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1163 <test_unsignedint+0x53>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_unsignedint() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [2 x i32]
%4 = bitcast [2 x i32]* %3 to i8*
store i32 0, i32* %2
br label %5
5: ; preds = %15, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 8192
br i1 %7, label %8, label %18
8: ; preds = %5
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%10 = load i32, i32* %9
%11 = add i32 %10, 1
store i32 %11, i32* %9
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%13 = load i32, i32* %12
%14 = add i32 %13, 1
store i32 %14, i32* %12
br label %15
15: ; preds = %8
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %5
18: ; preds = %5
store i32 0, i32* %2
br label %19
19: ; preds = %32, %18
%20 = load i32, i32* %2
%21 = icmp slt i32 %20, 2
br i1 %21, label %22, label %35
22: ; preds = %19
%23 = load i32, i32* %2
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = icmp ne i32 %26, 8192
br i1 %27, label %28, label %31
28: ; preds = %22
%29 = load i32, i32* %2
%30 = add nsw i32 %29, 1
store i32 %30, i32* %1
br label %36
31: ; preds = %22
br label %32
32: ; preds = %31
%33 = load i32, i32* %2
%34 = add nsw i32 %33, 1
store i32 %34, i32* %2
br label %19
35: ; preds = %19
store i32 0, i32* %1
br label %36
36: ; preds = %35, %28
%37 = load i32, i32* %1
ret i32 %37
}

LLVM IR (-O2):
define i32 @test_unsignedint() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print(int *cells, int lenght) {
  int i;
  for (i = 0; i < lenght; i++) {
    if (cells[i] == 0) {
      printf(".");
    } else {
      printf("*");
    }
  }
}


x86 assembly (clang, -O0):
<print>:
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    1174 <print+0x64>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    1155 <print+0x45>
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
jmp    1161 <print+0x51>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
jmp    1166 <print+0x56>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    114f <print+0x3f>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
cmpl   $0x0,(%r14,%rbx,4)
sete   %al
lea    0x2a(,%rax,4),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <print+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

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