xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ ltoa(unsigned long, unsigned char *, unsigned char);
unsigned char *_ltoa(unsigned long l, unsigned char *buf, unsigned char radix) {
  return ((char *)ltoa(l, buf, radix));
}


x86 assembly (clang, -O0):
<_ltoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movzbl -0x11(%rbp),%edx
call   1030 <ltoa@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @_ltoa(i64 %0, i8* %1, i8 zeroext %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i8
store i64 %0, i64* %4
store i8* %1, i8** %5
store i8 %2, i8* %6
%7 = load i64, i64* %4
%8 = load i8*, i8** %5
%9 = load i8, i8* %6
%10 = call i64 @ltoa(i64 %7, i8* %8, i8 zeroext %9)
%11 = inttoptr i64 %10 to i8*
ret i8* %11
}

LLVM IR (-O2):
define i8* @_ltoa(i64 %0, i8* %1, i8 zeroext %2) {
%4 = tail call i64 @ltoa(i64 %0, i8* %1, i8 zeroext %2)
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}
/* Variables and functions */
int get_word(char *);
int is_point_to_forward_ptr(char *p) {
  int tag = get_word(p);
  return (tag & 0xFF) == 0x47;
}


x86 assembly (clang, -O0):
<is_point_to_forward_ptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <get_word@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
cmp    $0x47,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_point_to_forward_ptr>:
push   %rax
call   1030 <get_word@plt>
xor    %ecx,%ecx
cmp    $0x47,%al
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @is_point_to_forward_ptr(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @get_word(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = and i32 %6, 255
%8 = icmp eq i32 %7, 71
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @is_point_to_forward_ptr(i8* %0) {
%2 = tail call i32 @get_word(i8* %0)
%3 = and i32 %2, 255
%4 = icmp eq i32 %3, 71
%5 = zext i1 %4 to i32
ret i32 %5
}
double fisProbOr(double x, double y) { return (x + y - x * y); }


x86 assembly (clang, -O0):
<fisProbOr>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fisProbOr>:
movapd %xmm0,%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm0
subsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @fisProbOr(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fadd double %5, %6
%8 = load double, double* %3
%9 = load double, double* %4
%10 = fneg double %8
%11 = call double @llvm.fmuladd.f64(double %10, double %9, double %7)
ret double %11
}

LLVM IR (-O2):
define double @fisProbOr(double %0, double %1) {
%3 = fadd double %0, %1
%4 = fneg double %0
%5 = tail call double @llvm.fmuladd.f64(double %4, double %1, double %3)
ret double %5
}
int floor_div(int value, int divisor) { return value - value % divisor; }


x86 assembly (clang, -O0):
<floor_div>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    -0xc(%rbp),%eax
sub    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<floor_div>:
mov    %edi,%eax
cltd
idiv   %esi
sub    %edx,%edi
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @floor_div(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* %3
%7 = load i32, i32* %4
%8 = srem i32 %6, %7
%9 = sub nsw i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @floor_div(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
%4 = sub nsw i32 %0, %3
ret i32 %4
}
void dtp_set_max_depth(int depth) {}


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

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

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

LLVM IR (-O2):
define void @dtp_set_max_depth(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __softboundcets_abort();
int /*<<< orphan*/ printf(char *);
__attribute__((__weak__, __always___)) void
__softboundcets_memset_check(void *dest, size_t size, void *dest_base,
                             void *dest_bound, size_t dest_key,
                             void *dest_lock) {
  printf("not handled\n");
  __softboundcets_abort();
}


x86 assembly (clang, -O0):
<__softboundcets_memset_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <__softboundcets_abort@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__softboundcets_memset_check>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <__softboundcets_abort@plt>

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

LLVM IR (-O2):
@str = [12 x i8] c"not handled\00"
define weak void @__softboundcets_memset_check(i8* %0, i64 %1, i8* %2, i8* %3, i64 %4, i8* %5) {
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (...) @__softboundcets_abort()
ret void
}
/* Variables and functions */
scalar_t__ RAND_MAX;
double rand();
double randminus1to1() { return rand() * (2.0 / (double)RAND_MAX) - 1.0; }


x86 assembly (clang, -O0):
<randminus1to1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
mov    0x2ec6(%rip),%rax
cvtsi2sdq (%rax),%xmm2
movsd  0xed9(%rip),%xmm1
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xec1(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<randminus1to1>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
mov    0x2ec9(%rip),%rax
cvtsi2sdq (%rax),%xmm1
movsd  0xed4(%rip),%xmm2
divsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm0
addsd  0xecc(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define double @randminus1to1() {
%1 = call double (...) @rand()
%2 = load i64, i64* @RAND_MAX
%3 = sitofp i64 %2 to double
%4 = fdiv double 2.000000e+00, %3
%5 = call double @llvm.fmuladd.f64(double %1, double %4, double -1.000000e+00)
ret double %5
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define double @randminus1to1() {
%1 = tail call double (...) @rand()
%2 = load i64, i64* @RAND_MAX
%3 = sitofp i64 %2 to double
%4 = fdiv double 2.000000e+00, %3
%5 = tail call double @llvm.fmuladd.f64(double %1, double %4, double -1.000000e+00)
ret double %5
}
reg0indreg1(r0, r1, x0, x1, p0, p1) unsigned char r0, r1;
unsigned char *p0, *p1;
{
  if (r0 <= (*p1))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<reg0indreg1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %dil,%sil
mov    %sil,-0x5(%rbp)
mov    %al,-0x6(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
movzbl -0x5(%rbp),%eax
mov    -0x20(%rbp),%rcx
movzbl (%rcx),%ecx
cmp    %ecx,%eax
jg     113d <reg0indreg1+0x3d>
movl   $0x1,-0x4(%rbp)
jmp    1144 <reg0indreg1+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reg0indreg1>:
movzbl %dil,%ecx
movzbl (%r9),%edx
xor    %eax,%eax
cmp    %edx,%ecx
setbe  %al
ret

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

LLVM IR (-O2):
define i32 @reg0indreg1(i32 %0, i32 %1, i32 %2, i32 %3, i8* nocapture readnone %4, i8* nocapture %5) {
%7 = and i32 %0, 255
%8 = load i8, i8* %5
%9 = zext i8 %8 to i32
%10 = icmp ule i32 %7, %9
%11 = zext i1 %10 to i32
ret i32 %11
}
float findvafrom_x_t(float x, float t) { return x / t; }


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

x86 assembly (clang, -O2):
<findvafrom_x_t>:
divss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @findvafrom_x_t(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 = fdiv float %5, %6
ret float %7
}

LLVM IR (-O2):
define float @findvafrom_x_t(float %0, float %1) {
%3 = fdiv float %0, %1
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, char *);
char char_input(void) {
  char temp_character = '\0';
  scanf(" %c", &temp_character);
  return temp_character;
}


x86 assembly (clang, -O0):
<char_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x0,-0x1(%rbp)
lea    0xedd(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1030 <scanf@plt>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<char_input>:
push   %rax
movb   $0x0,0x7(%rsp)
lea    0xee3(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1030 <scanf@plt>
mov    0x7(%rsp),%al
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c" %c\00"
define signext i8 @char_input() {
%1 = alloca i8
store i8 0, i8* %1
%2 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = load i8, i8* %1
ret i8 %3
}
int strcmp(const char *s1, const char *s2) {
  for (; *s1 == *s2 && *s1 != '\0'; s1++, s2++)
    ;
  return ((unsigned char)*s1 - (unsigned char)*s2);
}


x86 assembly (clang, -O0):
<strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    -0x10(%rbp),%rax
movsbl (%rax),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x11(%rbp)
jne    1137 <strcmp+0x37>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1147 <strcmp+0x47>
jmp    1169 <strcmp+0x69>
jmp    114c <strcmp+0x4c>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110c <strcmp+0xc>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movzbl (%rcx),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp>:
mov    (%rdi),%al
mov    (%rsi),%cl
test   %al,%al
je     1134 <strcmp+0x34>
cmp    %cl,%al
jne    1134 <strcmp+0x34>
mov    $0x1,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%rdi,%rdx,1),%eax
movzbl (%rsi,%rdx,1),%ecx
test   %al,%al
je     1134 <strcmp+0x34>
add    $0x1,%rdx
cmp    %cl,%al
je     1120 <strcmp+0x20>
movzbl %al,%eax
movzbl %cl,%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp ne i8 %3, %4
%6 = icmp eq i8 %3, 0
%7 = or i1 %6, %5
br i1 %7, label %18, label %8
8: ; preds = %2, %8
%9 = phi i8* [ %12, %8 ], [ %1, %2 ]
%10 = phi i8* [ %11, %8 ], [ %0, %2 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = getelementptr inbounds i8, i8* %9, i64 1
%13 = load i8, i8* %11
%14 = load i8, i8* %12
%15 = icmp ne i8 %13, %14
%16 = icmp eq i8 %13, 0
%17 = or i1 %16, %15
br i1 %17, label %18, label %8
18: ; preds = %8, %2
%19 = phi i8 [ %3, %2 ], [ %13, %8 ]
%20 = phi i8 [ %4, %2 ], [ %14, %8 ]
%21 = zext i8 %19 to i32
%22 = zext i8 %20 to i32
%23 = sub nsw i32 %21, %22
ret i32 %23
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void scgi_header_status_free_data(void *data) {
  if (data) {
    free(data);
    data = NULL;
  }
}


x86 assembly (clang, -O0):
<scgi_header_status_free_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1138 <scgi_header_status_free_data+0x28>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @scgi_header_status_free_data(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
store i8* null, i8** %2
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @scgi_header_status_free_data(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
int SDL_main(int argc, char *argv[]) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @SDL_main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
unsigned int ClearN(unsigned int val, unsigned int n) {
  return val & ~(1 << n);
}


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

x86 assembly (clang, -O2):
<ClearN>:
mov    %edi,%eax
btr    %esi,%eax
ret

LLVM IR (-O0):
define i32 @ClearN(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 = shl i32 1, %6
%8 = xor i32 %7, -1
%9 = and i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @ClearN(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = xor i32 %3, -1
%5 = and i32 %4, %0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ NumberIO_CardToStr(unsigned int, unsigned int, char *, int);
int /*<<< orphan*/ StrIO_WriteString(char *, int);
void NumberIO_WriteCard(unsigned int x, unsigned int n) {
  typedef struct _T2_a _T2;
  struct _T2_a {
    char array[79 + 1];
  };
  _T2 a;
  NumberIO_CardToStr(x, n, (char *)&a.array[0], 79);
  StrIO_WriteString((char *)&a.array[0], 79);
}


x86 assembly (clang, -O0):
<NumberIO_WriteCard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    -0x58(%rbp),%rdx
mov    $0x4f,%ecx
call   1040 <NumberIO_CardToStr@plt>
lea    -0x58(%rbp),%rdi
mov    $0x4f,%esi
call   1030 <StrIO_WriteString@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NumberIO_WriteCard>:
push   %rbx
sub    $0x50,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdx
mov    $0x4f,%ecx
call   1040 <NumberIO_CardToStr@plt>
mov    %rbx,%rdi
mov    $0x4f,%esi
call   1030 <StrIO_WriteString@plt>
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct._T2_a = type { [80 x i8] }
define void @NumberIO_WriteCard(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct._T2_a
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = getelementptr inbounds %struct._T2_a, %struct._T2_a* %5, i32 0, i32 0
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%10 = call i32 @NumberIO_CardToStr(i32 %6, i32 %7, i8* %9, i32 79)
%11 = getelementptr inbounds %struct._T2_a, %struct._T2_a* %5, i32 0, i32 0
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %11, i64 0, i64 0
%13 = call i32 @StrIO_WriteString(i8* %12, i32 79)
ret void
}

LLVM IR (-O2):
%struct._T2_a = type { [80 x i8] }
define void @NumberIO_WriteCard(i32 %0, i32 %1) {
%3 = alloca %struct._T2_a
%4 = getelementptr inbounds %struct._T2_a, %struct._T2_a* %3, i64 0, i32 0, i64 0
%5 = call i32 @NumberIO_CardToStr(i32 %0, i32 %1, i8* %4, i32 79)
%6 = call i32 @StrIO_WriteString(i8* %4, i32 79)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int find_first_bit(int, int *);
int /*<<< orphan*/ printf(char *);
void find_first_bit_test() {
  int bit;
  int a[3] = {0x80000000, 0x00000100, 0xf1fff000};
  printf("Testing find_first_bit...");
  bit = find_first_bit(sizeof(a) * 32, a);
  assert(bit == 31);
  printf("[OK]\n");
}


x86 assembly (clang, -O0):
<find_first_bit_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xebf(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
lea    -0x10(%rbp),%rsi
mov    $0x180,%edi
call   1050 <find_first_bit@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x1f,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_first_bit_test>:
sub    $0x18,%rsp
mov    0xebe(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xeab(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    $0x180,%edi
call   1060 <find_first_bit@plt>
xor    %edi,%edi
cmp    $0x1f,%eax
sete   %dil
call   1050 <assert@plt>
lea    0xe9c(%rip),%rdi
call   1030 <puts@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.find_first_bit_test.a = [3 x i32] [i32 -2147483648, i32 256, i32 -234885120]
@.str = [26 x i8] c"Testing find_first_bit...\00"
@.str.1 = [6 x i8] c"[OK]\0A\00"
define void @find_first_bit_test() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = bitcast [3 x i32]* %2 to i8*
%4 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%6 = call i32 @find_first_bit(i32 384, i32* %5)
store i32 %6, i32* %1
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, 31
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__const.find_first_bit_test.a = [3 x i32] [i32 -2147483648, i32 256, i32 -234885120]
@.str = [26 x i8] c"Testing find_first_bit...\00"
@str = [5 x i8] c"[OK]\00"
define void @find_first_bit_test() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%5 = call i32 @find_first_bit(i32 384, i32* %4)
%6 = icmp eq i32 %5, 31
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret void
}
void X509V3_add_value_bool(void) {}


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

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

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

LLVM IR (-O2):
define void @X509V3_add_value_bool() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char t = 50;
  char *z1 = &t;
  void *z2 = z1;
  unsigned int *pi = z2;
  printf("pi = %u\n", *pi);
  if (*pi != 50) {
    printf("UNSAFE\n");
    goto ERROR;
  }
  printf("SAFE\n");
  return (0);
ERROR:
  return (-1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x32,-0x5(%rbp)
lea    -0x5(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
cmpl   $0x32,(%rax)
je     116f <main+0x5f>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1189 <main+0x79>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1190 <main+0x80>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [9 x i8] c"pi = %u\0A\00"
@str = [5 x i8] c"SAFE\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 50)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int fread(char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdin;
int hell(char *buf, int bytes_to_read) {
  printf("Reading %d bytes... but you cannot do whatever you want in hell!\n",
         bytes_to_read);
  bytes_to_read = 10;
  return fread(buf, 1, bytes_to_read, stdin);
}


x86 assembly (clang, -O0):
<hell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xec7(%rip),%rdi
call   1040 <printf@plt>
movl   $0xa,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    0x2e95(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%esi
call   1030 <fread@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hell>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
mov    0x2eb1(%rip),%rax
mov    (%rax),%ecx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0xa,%edx
pop    %rbx
jmp    1030 <fread@plt>

LLVM IR (-O0):
@.str = [66 x i8] c"Reading %d bytes... but you cannot do whatever you want in hell!\0A\00"
@stdin = global i32 0
define i32 @hell(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i32 %5)
store i32 10, i32* %4
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = load i32, i32* @stdin
%10 = call i32 @fread(i8* %7, i32 1, i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
@.str = [66 x i8] c"Reading %d bytes... but you cannot do whatever you want in hell!\0A\00"
@stdin = global i32 0
define i32 @hell(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0), i32 %1)
%4 = load i32, i32* @stdin
%5 = tail call i32 @fread(i8* %0, i32 1, i32 10, i32 %4)
ret i32 %5
}
void g_relation_destroy() {}


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

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

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

LLVM IR (-O2):
define void @g_relation_destroy() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gmx_isdorder(int, char **);
int main(int argc, char *argv[]) {
  gmx_isdorder(argc, argv);
  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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <gmx_isdorder@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
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 i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @gmx_isdorder(i32 %6, i8** %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @gmx_isdorder(i32 %0, i8** %1)
ret i32 0
}
void initializeMatrix(int matrix[5][5]) {
  int row, column;
  for (row = 0; row < 5; row++) {
    for (column = 0; column < 5; column++) {
      matrix[row][column] = 0;
    }
  }
}


x86 assembly (clang, -O0):
<initializeMatrix>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    1165 <initializeMatrix+0x65>
movl   $0x0,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jge    1152 <initializeMatrix+0x52>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1120 <initializeMatrix+0x20>
jmp    1157 <initializeMatrix+0x57>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <initializeMatrix+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<initializeMatrix>:
xorps  %xmm0,%xmm0
movups %xmm0,0x50(%rdi)
movups %xmm0,0x40(%rdi)
movups %xmm0,0x30(%rdi)
movups %xmm0,0x20(%rdi)
movups %xmm0,0x10(%rdi)
movups %xmm0,(%rdi)
movl   $0x0,0x60(%rdi)
ret

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

LLVM IR (-O2):
define void @initializeMatrix([5 x i32]* nocapture writeonly %0) {
%2 = bitcast [5 x i32]* %0 to i8*
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void statusOK(const char *string) {
  printf("[\033[32mpass\033[0m] %s\n", string);
}


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

x86 assembly (clang, -O2):
<statusOK>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [20 x i8] c"[\1B[32mpass\1B[0m] %s\0A\00"
define void @statusOK(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
char *strchr(char *, int);
char *next_token(char *q, int sep) {
  if (q)
    q = strchr(q, sep);
  if (q)
    q++;
  return q;
}


x86 assembly (clang, -O0):
<next_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     113a <next_token+0x2a>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1151 <next_token+0x41>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_token>:
test   %rdi,%rdi
je     1121 <next_token+0x11>
push   %rax
call   1030 <strchr@plt>
add    $0x8,%rsp
jmp    1123 <next_token+0x13>
xor    %eax,%eax
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rax,%rcx
mov    %rcx,%rax
ret

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

LLVM IR (-O2):
define i8* @next_token(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i8* @strchr(i8* %0, i32 %1)
br label %6
6: ; preds = %4, %2
%7 = phi i8* [ %5, %4 ], [ null, %2 ]
%8 = icmp eq i8* %7, null
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = select i1 %8, i8* null, i8* %9
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void test_ffi3(void (*cb)(void)) {
  printf("Before calling callback\n");
  cb();
  printf("After calling callback\n");
}


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

x86 assembly (clang, -O2):
<test_ffi3>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
call   *%rbx
lea    0xeef(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Before calling callback\0A\00"
@.str.1 = [24 x i8] c"After calling callback\0A\00"
define void @test_ffi3(void ()* %0) {
%2 = alloca void ()*
store void ()* %0, void ()** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%4 = load void ()*, void ()** %2
%5 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [24 x i8] c"Before calling callback\00"
@str.2 = [23 x i8] c"After calling callback\00"
define void @test_ffi3(void ()* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
tail call void %0()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __builtin_outw(unsigned short, unsigned short);
void outw(unsigned short value, unsigned short port) {
  __builtin_outw(value, port);
}


x86 assembly (clang, -O0):
<outw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x2(%rbp),%ax
movzwl %ax,%edi
movzwl -0x4(%rbp),%esi
call   1030 <__builtin_outw@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @outw(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = load i16, i16* %4
%7 = call i32 @__builtin_outw(i16 zeroext %5, i16 zeroext %6)
ret void
}

LLVM IR (-O2):
define void @outw(i16 zeroext %0, i16 zeroext %1) {
%3 = tail call i32 @__builtin_outw(i16 zeroext %0, i16 zeroext %1)
ret void
}
/* Type definitions */
struct volshow_cmdline_parser_params {
  int dummy;
};
struct volshow_args_info {
  int dummy;
};

/* Variables and functions */
int volshow_cmdline_parser_internal(int, char **, struct volshow_args_info *,
                                    struct volshow_cmdline_parser_params *,
                                    int /*<<< orphan*/);
int volshow_cmdline_parser_ext(int argc, char **argv,
                               struct volshow_args_info *args_info,
                               struct volshow_cmdline_parser_params *params) {
  int result;
  result = volshow_cmdline_parser_internal(argc, argv, args_info, params, 0);
  return result;
}


x86 assembly (clang, -O0):
<volshow_cmdline_parser_ext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
xor    %r8d,%r8d
call   1030 <volshow_cmdline_parser_internal@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<volshow_cmdline_parser_ext>:
xor    %r8d,%r8d
jmp    1030 <volshow_cmdline_parser_internal@plt>

LLVM IR (-O0):
%struct.volshow_args_info = type { i32 }
%struct.volshow_cmdline_parser_params = type { i32 }
define i32 @volshow_cmdline_parser_ext(i32 %0, i8** %1, %struct.volshow_args_info* %2, %struct.volshow_cmdline_parser_params* %3) {
%5 = alloca i32
%6 = alloca i8**
%7 = alloca %struct.volshow_args_info*
%8 = alloca %struct.volshow_cmdline_parser_params*
%9 = alloca i32
store i32 %0, i32* %5
store i8** %1, i8*** %6
store %struct.volshow_args_info* %2, %struct.volshow_args_info** %7
store %struct.volshow_cmdline_parser_params* %3, %struct.volshow_cmdline_parser_params** %8
%10 = load i32, i32* %5
%11 = load i8**, i8*** %6
%12 = load %struct.volshow_args_info*, %struct.volshow_args_info** %7
%13 = load %struct.volshow_cmdline_parser_params*, %struct.volshow_cmdline_parser_params** %8
%14 = call i32 @volshow_cmdline_parser_internal(i32 %10, i8** %11, %struct.volshow_args_info* %12, %struct.volshow_cmdline_parser_params* %13, i32 0)
store i32 %14, i32* %9
%15 = load i32, i32* %9
ret i32 %15
}

LLVM IR (-O2):
%struct.volshow_args_info = type { i32 }
%struct.volshow_cmdline_parser_params = type { i32 }
define i32 @volshow_cmdline_parser_ext(i32 %0, i8** %1, %struct.volshow_args_info* %2, %struct.volshow_cmdline_parser_params* %3) {
%5 = tail call i32 @volshow_cmdline_parser_internal(i32 %0, i8** %1, %struct.volshow_args_info* %2, %struct.volshow_cmdline_parser_params* %3, i32 0)
ret i32 %5
}
/* Type definitions */
struct world {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fix_coords(struct world const *, int *, int *);
int get_cell(struct world const *, int, int);
bool world_get_cell(const struct world *w, int x, int y) {
  fix_coords(w, &x, &y);
  return get_cell(w, x, y);
}


x86 assembly (clang, -O0):
<world_get_cell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1030 <fix_coords@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <get_cell@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<world_get_cell>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    %esi,0xc(%rsp)
mov    %edx,0x8(%rsp)
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1030 <fix_coords@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
call   1040 <get_cell@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.world = type { i32 }
define i32 @world_get_cell(%struct.world* %0, i32 %1, i32 %2) {
%4 = alloca %struct.world*
%5 = alloca i32
%6 = alloca i32
store %struct.world* %0, %struct.world** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load %struct.world*, %struct.world** %4
%8 = call i32 @fix_coords(%struct.world* %7, i32* %5, i32* %6)
%9 = load %struct.world*, %struct.world** %4
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = call i32 @get_cell(%struct.world* %9, i32 %10, i32 %11)
ret i32 %12
}

LLVM IR (-O2):
%struct.world = type { i32 }
define i32 @world_get_cell(%struct.world* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
store i32 %1, i32* %4
store i32 %2, i32* %5
%6 = call i32 @fix_coords(%struct.world* %0, i32* %4, i32* %5)
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = call i32 @get_cell(%struct.world* %0, i32 %7, i32 %8)
ret i32 %9
}
int execute_shmget() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_shmget() {
ret i32 0
}
/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ syscall(int, int /*<<< orphan*/, int /*<<< orphan*/);
int kmode() {
  printf("Proc[%d] goining into KMode ....\n", getpid());
  syscall(3, 0, 0);
  printf("Proc[%d] back from the Kernel!\n", getpid());
}


x86 assembly (clang, -O0):
<kmode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
mov    $0x3,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1050 <syscall@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kmode>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x3,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <syscall@plt>
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xec0(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"Proc[%d] goining into KMode ....\0A\00"
@.str.1 = [32 x i8] c"Proc[%d] back from the Kernel!\0A\00"
define i32 @kmode() {
%1 = alloca i32
%2 = call i32 (...) @getpid()
%3 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 @syscall(i32 3, i32 0, i32 0)
%5 = call i32 (...) @getpid()
%6 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
@.str = [34 x i8] c"Proc[%d] goining into KMode ....\0A\00"
@.str.1 = [32 x i8] c"Proc[%d] back from the Kernel!\0A\00"
define i32 @kmode() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @syscall(i32 3, i32 0, i32 0)
%4 = tail call i32 (...) @getpid()
%5 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 undef
}
void main() {
  volatile char *serial_base = (char *)0x20000000;
  while (1) {
    char ready = 0;
    while (!ready) {
      ready = *(serial_base + 1);
    }
    char val = *serial_base;
    ready = 0;
    while (!ready) {
      ready = *(serial_base + 2);
    }
    *serial_base = val;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x20000000,%eax
mov    %rax,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
cmpb   $0x0,-0x9(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1127 <main+0x27>
jmp    1136 <main+0x36>
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0x9(%rbp)
jmp    1111 <main+0x11>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0xa(%rbp)
movb   $0x0,-0x9(%rbp)
cmpb   $0x0,-0x9(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1159 <main+0x59>
jmp    1168 <main+0x68>
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%al
mov    %al,-0x9(%rbp)
jmp    1143 <main+0x43>
mov    -0xa(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
jmp    110d <main+0xd>

x86 assembly (clang, -O2):
<main>:
cmpb   $0x0,0x20000001
je     1100 <main>
mov    0x20000000,%al
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmpb   $0x0,0x20000002
je     1120 <main+0x20>
mov    %al,0x20000000
jmp    1100 <main>

LLVM IR (-O0):
define void @main() {
%1 = alloca i8*
%2 = alloca i8
%3 = alloca i8
store i8* inttoptr (i64 536870912 to i8*), i8** %1
br label %4
4: ; preds = %0, %24
store i8 0, i8* %2
br label %5
5: ; preds = %9, %4
%6 = load i8, i8* %2
%7 = icmp ne i8 %6, 0
%8 = xor i1 %7, true
br i1 %8, label %9, label %13
9: ; preds = %5
%10 = load i8*, i8** %1
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load volatile i8, i8* %11
store i8 %12, i8* %2
br label %5
13: ; preds = %5
%14 = load i8*, i8** %1
%15 = load volatile i8, i8* %14
store i8 %15, i8* %3
store i8 0, i8* %2
br label %16
16: ; preds = %20, %13
%17 = load i8, i8* %2
%18 = icmp ne i8 %17, 0
%19 = xor i1 %18, true
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i8*, i8** %1
%22 = getelementptr inbounds i8, i8* %21, i64 2
%23 = load volatile i8, i8* %22
store i8 %23, i8* %2
br label %16
24: ; preds = %16
%25 = load i8, i8* %3
%26 = load i8*, i8** %1
store volatile i8 %25, i8* %26
br label %4
}

LLVM IR (-O2):
define void @main() {
br label %1
1: ; preds = %4, %0
%2 = load volatile i8, i8* inttoptr (i64 536870913 to i8*)
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %1, %10
br label %1
5: ; preds = %1
%6 = load volatile i8, i8* inttoptr (i64 536870912 to i8*)
br label %7
7: ; preds = %5, %7
%8 = load volatile i8, i8* inttoptr (i64 536870914 to i8*)
%9 = icmp eq i8 %8, 0
br i1 %9, label %7, label %10
10: ; preds = %7
store volatile i8 %6, i8* inttoptr (i64 536870912 to i8*)
br label %4
}
void cmd_help(struct pot *pot) {}


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

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

LLVM IR (-O0):
%struct.pot = type opaque
define void @cmd_help(%struct.pot* %0) {
%2 = alloca %struct.pot*
store %struct.pot* %0, %struct.pot** %2
ret void
}

LLVM IR (-O2):
%struct.pot = type opaque
define void @cmd_help(%struct.pot* nocapture %0) {
ret void
}
/* Variables and functions */
double fmod(double, double);
double m_mod_d(double a, double n) { return fmod(a, n); }


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

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

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

LLVM IR (-O2):
define double @m_mod_d(double %0, double %1) {
%3 = tail call double @fmod(double %0, double %1)
ret double %3
}
/* Variables and functions */
int getchar();
void wait_enter(void) {
  int c;
  do {
    c = getchar();
  } while ((c != '\n') && (c != '\r'));
}


x86 assembly (clang, -O0):
<wait_enter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0xa,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     113b <wait_enter+0x2b>
cmpl   $0xd,-0x4(%rbp)
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    1118 <wait_enter+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_enter>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xd,%eax
je     1131 <wait_enter+0x21>
cmp    $0xa,%eax
jne    1120 <wait_enter+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @wait_enter() {
%1 = alloca i32
br label %2
2: ; preds = %10, %0
%3 = call i32 (...) @getchar()
store i32 %3, i32* %1
br label %4
4: ; preds = %2
%5 = load i32, i32* %1
%6 = icmp ne i32 %5, 10
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = load i32, i32* %1
%9 = icmp ne i32 %8, 13
br label %10
10: ; preds = %7, %4
%11 = phi i1 [ false, %4 ], [ %9, %7 ]
br i1 %11, label %2, label %12
12: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @wait_enter() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @getchar()
switch i32 %2, label %1 [
i32 13, label %3
i32 10, label %3
]
3: ; preds = %1, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clog_flush(int *);
void clog_flush__(int *flag) { clog_flush(flag); }


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

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

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

LLVM IR (-O2):
define void @clog_flush__(i32* %0) {
%2 = tail call i32 @clog_flush(i32* %0)
ret void
}
int foo(int i, int j) { return i + j; }


x86 assembly (clang, -O0):
<foo>:
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):
<foo>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @foo(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 @foo(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}