xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ gmx_rotacf(int, char **);
int main(int argc, char *argv[]) {
  gmx_rotacf(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_rotacf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1030 <gmx_rotacf@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_rotacf(i32 %6, i8** %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @gmx_rotacf(i32 %0, i8** %1)
ret i32 0
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
bool twi_addr_is_write(uint8_t addr) { return !!(addr & 1); }


x86 assembly (clang, -O0):
<twi_addr_is_write>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @twi_addr_is_write(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 1
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = xor i1 %6, true
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @twi_addr_is_write(i32 %0) {
%2 = and i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ execv(char *, int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  (void)argc;
  (void)argv;
  execv("helloworld", NULL);
  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)
lea    0xed3(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <execv@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [11 x i8] c"helloworld\00"
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 @execv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* null)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"helloworld\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @execv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* null)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isdigit(int);
void t_isdigit_0x2c() {
  Assert_real((isdigit(44) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isdigit.c",
              225, ("isdigit should be 0 for ,"));
}


x86 assembly (clang, -O0):
<t_isdigit_0x2c>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2c,%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0xe1,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isdigit_0x2c>:
push   %rax
mov    $0x2c,%edi
call   1030 <isdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0xe1,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [26 x i8] c"isdigit should be 0 for ,\00"
define void @t_isdigit_0x2c() {
%1 = call i64 @isdigit(i32 44)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 225, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [26 x i8] c"isdigit should be 0 for ,\00"
define void @t_isdigit_0x2c() {
%1 = tail call i64 @isdigit(i32 44)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 225, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int Join(int a, int b) {
  int ret = a * 10000 + b;
  return ret;
}


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

x86 assembly (clang, -O2):
<Join>:
imul   $0x2710,%edi,%eax
add    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @Join(i32 %0, i32 %1) {
%3 = mul nsw i32 %0, 10000
%4 = add nsw i32 %3, %1
ret i32 %4
}
int cfs_size_round0(int val) {
  if (!val)
    return 0;
  return (val + 1 + 7) & (~0x7);
}


x86 assembly (clang, -O0):
<cfs_size_round0>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <cfs_size_round0+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    112c <cfs_size_round0+0x2c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
add    $0x7,%eax
and    $0xfffffff8,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cfs_size_round0>:
lea    0x8(%rdi),%eax
and    $0xfffffff8,%eax
test   %edi,%edi
cmove  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @cfs_size_round0(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = add nsw i32 %0, 8
%4 = and i32 %3, -8
%5 = select i1 %2, i32 0, i32 %4
ret i32 %5
}
/* Variables and functions */
long xy2d(int, int, int);
long row_xy2d(int n, int x, int y) {
  int y2 = y % n;
  long nsq = (long)n * (long)n;
  return xy2d(n, y2, x) + nsq * (y / n);
}


x86 assembly (clang, -O0):
<row_xy2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %edx,-0x10(%rbp)
movslq -0x4(%rbp),%rax
movslq -0x4(%rbp),%rcx
imul   %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1030 <xy2d@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0xc(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,%edx
mov    -0x20(%rbp),%rax
movslq %edx,%rdx
imul   %rdx,%rcx
add    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<row_xy2d>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%eax
mov    %esi,%ecx
movslq %edi,%rdi
mov    %rdi,%rbx
imul   %rdi,%rbx
cltd
idiv   %edi
mov    %eax,%ebp
mov    %edx,%esi
mov    %ecx,%edx
call   1030 <xy2d@plt>
movslq %ebp,%rcx
imul   %rbx,%rcx
add    %rcx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i64 @row_xy2d(i32 %0, i32 %1, i32 %2) {
%4 = srem i32 %2, %0
%5 = sext i32 %0 to i64
%6 = mul nsw i64 %5, %5
%7 = tail call i64 @xy2d(i32 %0, i32 %4, i32 %1)
%8 = sdiv i32 %2, %0
%9 = sext i32 %8 to i64
%10 = mul nsw i64 %6, %9
%11 = add nsw i64 %10, %7
ret i64 %11
}
/* Variables and functions */
double log(int);
double atan(double x) { return log((1 + x) / (1 - x)) / 2.0; }


x86 assembly (clang, -O0):
<atan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xee3(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
subsd  -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
movsd  0xeb4(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atan>:
push   %rax
movsd  0xee7(%rip),%xmm1
movapd %xmm0,%xmm2
addsd  %xmm1,%xmm2
subsd  %xmm0,%xmm1
divsd  %xmm1,%xmm2
cvttsd2si %xmm2,%edi
call   1030 <log@plt>
mulsd  0xece(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @atan(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fadd double 1.000000e+00, %3
%5 = load double, double* %2
%6 = fsub double 1.000000e+00, %5
%7 = fdiv double %4, %6
%8 = fptosi double %7 to i32
%9 = call double @log(i32 %8)
%10 = fdiv double %9, 2.000000e+00
ret double %10
}

LLVM IR (-O2):
define double @atan(double %0) {
%2 = fadd double %0, 1.000000e+00
%3 = fsub double 1.000000e+00, %0
%4 = fdiv double %2, %3
%5 = fptosi double %4 to i32
%6 = tail call double @log(i32 %5)
%7 = fmul double %6, 5.000000e-01
ret double %7
}
/* Variables and functions */
int /*<<< orphan*/ bcm2835_i2c_begin();
void ope_i2c_begin(void) { bcm2835_i2c_begin(); }


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

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

LLVM IR (-O0):
define void @ope_i2c_begin() {
%1 = call i32 (...) @bcm2835_i2c_begin()
ret void
}

LLVM IR (-O2):
define void @ope_i2c_begin() {
%1 = tail call i32 (...) @bcm2835_i2c_begin()
ret void
}
/* Variables and functions */
char base64_encode_value(char value_in) {
  static const char *encoding =
      "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  if (value_in > 63) {
    return '=';
  }
  return encoding[(int)value_in];
}


x86 assembly (clang, -O0):
<base64_encode_value>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x3f,%eax
jle    1120 <base64_encode_value+0x20>
movb   $0x3d,-0x1(%rbp)
jmp    1134 <base64_encode_value+0x34>
mov    0x2ef9(%rip),%rax
movsbl -0x2(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<base64_encode_value>:
mov    $0x3d,%al
cmp    $0x3f,%dil
jg     1116 <base64_encode_value+0x16>
movsbq %dil,%rax
lea    0xeed(%rip),%rcx
mov    (%rax,%rcx,1),%al
ret

LLVM IR (-O0):
@base64_encode_value.encoding = internal global i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i32 0, i32 0)
@.str = [65 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\00"
define signext i8 @base64_encode_value(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sgt i32 %5, 63
br i1 %6, label %7, label %8
7: ; preds = %1
store i8 61, i8* %2
br label %15
8: ; preds = %1
%9 = load i8*, i8** @base64_encode_value.encoding
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %9, i64 %12
%14 = load i8, i8* %13
store i8 %14, i8* %2
br label %15
15: ; preds = %8, %7
%16 = load i8, i8* %2
ret i8 %16
}

LLVM IR (-O2):
@.str = [65 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\00"
define signext i8 @base64_encode_value(i8 signext %0) {
%2 = icmp sgt i8 %0, 63
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = sext i8 %0 to i64
%5 = getelementptr inbounds [65 x i8], [65 x i8]* @.str, i64 0, i64 %4
%6 = load i8, i8* %5
br label %7
7: ; preds = %1, %3
%8 = phi i8 [ %6, %3 ], [ 61, %1 ]
ret i8 %8
}
/* Type definitions */
struct context {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void about_dasher(struct context *ctx) { printf("dasher prototype 0.1\n"); }


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

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

LLVM IR (-O0):
%struct.context = type { i32 }
@.str = [22 x i8] c"dasher prototype 0.1\0A\00"
define void @about_dasher(%struct.context* %0) {
%2 = alloca %struct.context*
store %struct.context* %0, %struct.context** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.context = type { i32 }
@str = [21 x i8] c"dasher prototype 0.1\00"
define void @about_dasher(%struct.context* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
double gsw_ct_from_pt(double, double);
double gsw_pt0_from_t(double, double, double);
double gsw_ct_from_t(double sa, double t, double p) {
  double pt0;
  pt0 = gsw_pt0_from_t(sa, t, p);
  return (gsw_ct_from_pt(sa, pt0));
}


x86 assembly (clang, -O0):
<gsw_ct_from_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
call   1040 <gsw_pt0_from_t@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1030 <gsw_ct_from_pt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gsw_ct_from_t>:
push   %rax
movsd  %xmm0,(%rsp)
call   1040 <gsw_pt0_from_t@plt>
movaps %xmm0,%xmm1
movsd  (%rsp),%xmm0
pop    %rax
jmp    1030 <gsw_ct_from_pt@plt>

LLVM IR (-O0):
define double @gsw_ct_from_t(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%8 = load double, double* %4
%9 = load double, double* %5
%10 = load double, double* %6
%11 = call double @gsw_pt0_from_t(double %8, double %9, double %10)
store double %11, double* %7
%12 = load double, double* %4
%13 = load double, double* %7
%14 = call double @gsw_ct_from_pt(double %12, double %13)
ret double %14
}

LLVM IR (-O2):
define double @gsw_ct_from_t(double %0, double %1, double %2) {
%4 = tail call double @gsw_pt0_from_t(double %0, double %1, double %2)
%5 = tail call double @gsw_ct_from_pt(double %0, double %4)
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ closelog();
void sbus_stop_logger(void) { closelog(); }


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

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

LLVM IR (-O0):
define void @sbus_stop_logger() {
%1 = call i32 (...) @closelog()
ret void
}

LLVM IR (-O2):
define void @sbus_stop_logger() {
%1 = tail call i32 (...) @closelog()
ret void
}
int rvb2ram_offs(int curr, int space, int iOff) {
  iOff += curr;
  if (iOff >= 0x40000)
    iOff -= space;
  return iOff;
}


x86 assembly (clang, -O0):
<rvb2ram_offs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x40000,-0xc(%rbp)
jl     112e <rvb2ram_offs+0x2e>
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rvb2ram_offs>:
lea    (%rdi,%rdx,1),%eax
xor    %ecx,%ecx
cmp    $0x40000,%eax
cmovge %esi,%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @rvb2ram_offs(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* %4
%8 = load i32, i32* %6
%9 = add nsw i32 %8, %7
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp sge i32 %10, 262144
br i1 %11, label %12, label %16
12: ; preds = %3
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = sub nsw i32 %14, %13
store i32 %15, i32* %6
br label %16
16: ; preds = %12, %3
%17 = load i32, i32* %6
ret i32 %17
}

LLVM IR (-O2):
define i32 @rvb2ram_offs(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %2, %0
%5 = icmp sgt i32 %4, 262143
%6 = select i1 %5, i32 %1, i32 0
%7 = sub nsw i32 %4, %6
ret i32 %7
}
int find_num_bits_set(int num) {
  int total = 0;
  if (num & (1 << (sizeof(int) * 8 - 1))) {
    ++total;
  }
  num &= ~(1 << (sizeof(int) * 8 - 1));
  while (num != 0) {
    if ((num & 1) == 1) {
      ++total;
    }
    num = num >> 1;
  }
  return (total);
}


x86 assembly (clang, -O0):
<find_num_bits_set>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x80000000,%eax
cmp    $0x0,%eax
je     1128 <find_num_bits_set+0x28>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7fffffff,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1163 <find_num_bits_set+0x63>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x1,%eax
jne    1155 <find_num_bits_set+0x55>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1133 <find_num_bits_set+0x33>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_num_bits_set>:
mov    %edi,%eax
shr    $0x1f,%eax
and    $0x7fffffff,%edi
je     1120 <find_num_bits_set+0x20>
mov    %edi,%ecx
nop
mov    %edi,%edx
and    $0x1,%edx
add    %edx,%eax
shr    %ecx
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <find_num_bits_set+0x10>
ret

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

LLVM IR (-O2):
define i32 @find_num_bits_set(i32 %0) {
%2 = lshr i32 %0, 31
%3 = and i32 %0, 2147483647
%4 = icmp eq i32 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %1, %5
%6 = phi i32 [ %9, %5 ], [ %2, %1 ]
%7 = phi i32 [ %10, %5 ], [ %3, %1 ]
%8 = and i32 %7, 1
%9 = add nuw nsw i32 %6, %8
%10 = lshr i32 %7, 1
%11 = icmp ult i32 %7, 2
br i1 %11, label %12, label %5
12: ; preds = %5, %1
%13 = phi i32 [ %2, %1 ], [ %9, %5 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int a = 1;
  int *b = &a;
  int **c = &b;
  **c = 42;
  assert(a == 42);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x1,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movl   $0x2a,(%rax)
cmpl   $0x2a,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32**
store i32 1, i32* %1
store i32* %1, i32** %2
store i32** %2, i32*** %3
%4 = load i32**, i32*** %3
%5 = load i32*, i32** %4
store i32 42, i32* %5
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 42
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int digitalRead(int pin) {
  printf("digitalRead: pin=%d\n", pin);
  return 1;
}


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

x86 assembly (clang, -O2):
<digitalRead>:
push   %rax
mov    %edi,%esi
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [21 x i8] c"digitalRead: pin=%d\0A\00"
define i32 @digitalRead(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 1
}
void str_trim(buf) char *buf;
{
  char *p = buf;
  while (*p)
    p++;
  while (--p >= buf) {
    if (*p == ' ')
      *p = '\0';
    else
      break;
  }
}


x86 assembly (clang, -O0):
<str_trim>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     112e <str_trim+0x2e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <str_trim+0x10>
jmp    1133 <str_trim+0x33>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
cmp    -0x8(%rbp),%rax
jb     116f <str_trim+0x6f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1165 <str_trim+0x65>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
jmp    116a <str_trim+0x6a>
jmp    116f <str_trim+0x6f>
jmp    1133 <str_trim+0x33>
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_trim>:
lea    -0x2(%rdi),%rax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpb   $0x0,0x2(%rax)
lea    0x1(%rax),%rax
jne    1110 <str_trim+0x10>
jmp    1127 <str_trim+0x27>
nopl   0x0(%rax)
movb   $0x0,(%rax)
add    $0xffffffffffffffff,%rax
cmp    %rdi,%rax
jb     1131 <str_trim+0x31>
cmpb   $0x20,(%rax)
je     1120 <str_trim+0x20>
ret

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

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

/* Variables and functions */
uint32_t reverseBits(uint32_t n) {
  uint32_t final = 0;
  for (uint32_t i = 0; n != 0; i++, n >>= 1) {
    final |= (n & 1) << (31 - i);
  }
  return final;
}


x86 assembly (clang, -O0):
<reverseBits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     114c <reverseBits+0x4c>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
mov    $0x1f,%ecx
sub    -0xc(%rbp),%ecx
shl    %cl,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1115 <reverseBits+0x15>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverseBits>:
xor    %eax,%eax
test   %edi,%edi
je     1125 <reverseBits+0x25>
mov    $0x1f,%ecx
mov    %edi,%edx
nopl   (%rax)
mov    %edi,%esi
and    $0x1,%esi
shl    %cl,%esi
or     %esi,%eax
sar    %edx
add    $0xffffffff,%ecx
cmp    $0x2,%edi
mov    %edx,%edi
jae    1110 <reverseBits+0x10>
ret

LLVM IR (-O0):
define i32 @reverseBits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %16, %1
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %21
8: ; preds = %5
%9 = load i32, i32* %2
%10 = and i32 %9, 1
%11 = load i32, i32* %4
%12 = sub nsw i32 31, %11
%13 = shl i32 %10, %12
%14 = load i32, i32* %3
%15 = or i32 %14, %13
store i32 %15, i32* %3
br label %16
16: ; preds = %8
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
%19 = load i32, i32* %2
%20 = ashr i32 %19, 1
store i32 %20, i32* %2
br label %5
21: ; preds = %5
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @reverseBits(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %5, %1
%4 = phi i32 [ 0, %1 ], [ %12, %5 ]
ret i32 %4
5: ; preds = %1, %5
%6 = phi i32 [ %13, %5 ], [ 0, %1 ]
%7 = phi i32 [ %12, %5 ], [ 0, %1 ]
%8 = phi i32 [ %14, %5 ], [ %0, %1 ]
%9 = and i32 %8, 1
%10 = sub nsw i32 31, %6
%11 = shl nuw i32 %9, %10
%12 = or i32 %11, %7
%13 = add nuw nsw i32 %6, 1
%14 = ashr i32 %8, 1
%15 = icmp ult i32 %8, 2
br i1 %15, label %3, label %5
}
int Cyc_AssnDef_hash_ptr(void *s) {
  void *_T0;
  int _T1;
  _T0 = s;
  _T1 = (int)_T0;
  return _T1;
}


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

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

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

LLVM IR (-O2):
define i32 @Cyc_AssnDef_hash_ptr(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
ret i32 %3
}
char *basename(s)
char *s;
{
  register char *p;
  if (p = strrchr(s, '/'))
    return 1 + p;
  return s;
}


x86 assembly (clang, -O0):
<basename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1149 <basename+0x39>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1151 <basename+0x41>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basename>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @basename(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i32 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ setled(unsigned char, unsigned char, int /*<<< orphan*/);
clearmatrix() {
  unsigned char r, c;
  for (r = 0; r < 32; r++) {
    for (c = 0; c < 32; c++) {
      setled(r, c, 0);
    }
  }
}


x86 assembly (clang, -O0):
<clearmatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x0,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jge    116a <clearmatrix+0x5a>
movb   $0x0,-0x6(%rbp)
movzbl -0x6(%rbp),%eax
cmp    $0x20,%eax
jge    1158 <clearmatrix+0x48>
mov    -0x5(%rbp),%al
xor    %edx,%edx
movzbl %al,%edi
movzbl -0x6(%rbp),%esi
call   1030 <setled@plt>
mov    -0x6(%rbp),%al
add    $0x1,%al
mov    %al,-0x6(%rbp)
jmp    112d <clearmatrix+0x1d>
jmp    115d <clearmatrix+0x4d>
mov    -0x5(%rbp),%al
add    $0x1,%al
mov    %al,-0x5(%rbp)
jmp    111c <clearmatrix+0xc>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearmatrix>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl %bpl,%edi
movzbl %bl,%ebx
mov    %ebx,%esi
xor    %edx,%edx
call   1030 <setled@plt>
add    $0x1,%bl
cmp    $0x20,%bl
jne    1130 <clearmatrix+0x20>
add    $0x1,%bpl
cmp    $0x20,%bpl
jne    1120 <clearmatrix+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @clearmatrix() {
br label %1
1: ; preds = %0, %8
%2 = phi i8 [ 0, %0 ], [ %9, %8 ]
br label %3
3: ; preds = %1, %3
%4 = phi i8 [ 0, %1 ], [ %6, %3 ]
%5 = tail call i32 @setled(i8 zeroext %2, i8 zeroext %4, i32 0)
%6 = add nuw nsw i8 %4, 1
%7 = icmp eq i8 %6, 32
br i1 %7, label %8, label %3
8: ; preds = %3
%9 = add nuw nsw i8 %2, 1
%10 = icmp eq i8 %9, 32
br i1 %10, label %11, label %1
11: ; preds = %8
ret i32 undef
}
/* Variables and functions */
void free(void *);
void fastFree(void *p) { return free(p); }


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

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

LLVM IR (-O2):
define void @fastFree(i8* nocapture %0) {
tail call void @free(i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ block128_f;
typedef int /*<<< orphan*/ CAMELLIA_KEY;

/* Variables and functions */
int /*<<< orphan*/ CRYPTO_cfb128_1_encrypt(unsigned char const *,
                                           unsigned char *, size_t,
                                           int /*<<< orphan*/ const *,
                                           unsigned char *, int *, int const,
                                           int /*<<< orphan*/);
scalar_t__ Camellia_encrypt;
void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out,
                           size_t length, const CAMELLIA_KEY *key,
                           unsigned char *ivec, int *num, const int enc) {
  CRYPTO_cfb128_1_encrypt(in, out, length, key, ivec, num, enc,
                          (block128_f)Camellia_encrypt);
}


x86 assembly (clang, -O0):
<Camellia_cfb1_encrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    0x10(%rbp),%r10d
mov    0x2ea2(%rip),%rax
mov    (%rax),%rax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <CRYPTO_cfb128_1_encrypt@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Camellia_cfb1_encrypt>:
push   %rax
mov    0x10(%rsp),%r10d
mov    0x2edb(%rip),%rax
mov    (%rax),%eax
push   %rax
push   %r10
call   1030 <CRYPTO_cfb128_1_encrypt@plt>
add    $0x10,%rsp
pop    %rax
ret

LLVM IR (-O0):
@Camellia_encrypt = global i64 0
define void @Camellia_cfb1_encrypt(i8* %0, i8* %1, i64 %2, i32* %3, i8* %4, i32* %5, i32 %6) {
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32*
%12 = alloca i8*
%13 = alloca i32*
%14 = alloca i32
store i8* %0, i8** %8
store i8* %1, i8** %9
store i64 %2, i64* %10
store i32* %3, i32** %11
store i8* %4, i8** %12
store i32* %5, i32** %13
store i32 %6, i32* %14
%15 = load i8*, i8** %8
%16 = load i8*, i8** %9
%17 = load i64, i64* %10
%18 = load i32*, i32** %11
%19 = load i8*, i8** %12
%20 = load i32*, i32** %13
%21 = load i32, i32* %14
%22 = load i64, i64* @Camellia_encrypt
%23 = trunc i64 %22 to i32
%24 = call i32 @CRYPTO_cfb128_1_encrypt(i8* %15, i8* %16, i64 %17, i32* %18, i8* %19, i32* %20, i32 %21, i32 %23)
ret void
}

LLVM IR (-O2):
@Camellia_encrypt = global i64 0
define void @Camellia_cfb1_encrypt(i8* %0, i8* %1, i64 %2, i32* %3, i8* %4, i32* %5, i32 %6) {
%8 = load i64, i64* @Camellia_encrypt
%9 = trunc i64 %8 to i32
%10 = tail call i32 @CRYPTO_cfb128_1_encrypt(i8* %0, i8* %1, i64 %2, i32* %3, i8* %4, i32* %5, i32 %6, i32 %9)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int myvariable;
  printf("Enter a number:");
  scanf("%d", &myvariable);
  printf("%d", myvariable);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%esi
lea    0xec0(%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    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed6(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"Enter a number:\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int SEM_VALUE_MAX;
int main(void) { return SEM_VALUE_MAX; }


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

x86 assembly (clang, -O2):
<main>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

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

LLVM IR (-O2):
@SEM_VALUE_MAX = global i32 0
define i32 @main() {
%1 = load i32, i32* @SEM_VALUE_MAX
ret i32 %1
}
/* Variables and functions */
double M_PI;
double sin(double);
double imag(double magn, double angle) {
  return magn * sin((angle * M_PI / 180));
}


x86 assembly (clang, -O0):
<imag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    0x2eb0(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xebc(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imag>:
push   %rax
movsd  %xmm0,(%rsp)
mov    0x2ecb(%rip),%rax
mulsd  (%rax),%xmm1
divsd  0xed7(%rip),%xmm1
movapd %xmm1,%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @imag(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 = load double, double* @M_PI
%8 = fmul double %6, %7
%9 = fdiv double %8, 1.800000e+02
%10 = call double @sin(double %9)
%11 = fmul double %5, %10
ret double %11
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @imag(double %0, double %1) {
%3 = load double, double* @M_PI
%4 = fmul double %3, %1
%5 = fdiv double %4, 1.800000e+02
%6 = tail call double @sin(double %5)
%7 = fmul double %6, %0
ret double %7
}
int main() {
  int x;
  asm("movl $26, %0 # 26 |-> reg \n\t"
      "movl $28, %0"
      : "=r"(x));
  if (x != 28)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1a,%eax
mov    $0x1c,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x1c,-0x8(%rbp)
je     114b <main+0x2b>
call   1030 <abort@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1a,%eax
mov    $0x1c,%eax
cmp    $0x1c,%eax
jne    1137 <main+0x17>
xor    %edi,%edi
call   1040 <exit@plt>
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 asm "movl $$26, $0 # 26 $|-> reg \0A\09movl $$28, $0", "=r,~{dirflag},~{fpsr},~{flags}"()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 28
br i1 %5, label %6, label %7
6: ; preds = %0
unreachable
7: ; preds = %0
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 asm "movl $$26, $0 # 26 $|-> reg \0A\09movl $$28, $0", "=r,~{dirflag},~{fpsr},~{flags}"()
%2 = icmp eq i32 %1, 28
br i1 %2, label %4, label %3
3: ; preds = %0
tail call void @abort()
unreachable
4: ; preds = %0
tail call void @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ f(int);
main() {
  if (!f(9))
    abort();
  if (f(-9))
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x9,%edi
call   1040 <f@plt>
cmp    $0x0,%rax
jne    115a <main+0x2a>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0xfffffff7,%edi
call   1040 <f@plt>
cmp    $0x0,%rax
je     1175 <main+0x45>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x9,%edi
call   1040 <f@plt>
test   %rax,%rax
je     1156 <main+0x26>
mov    $0xfffffff7,%edi
call   1040 <f@plt>
test   %rax,%rax
jne    1156 <main+0x26>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @f(i32 9)
%3 = icmp ne i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = call i64 @f(i32 -9)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %6
%12 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @f(i32 9)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i64 @f(i32 -9)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %5
%11 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ errx(int, char *, int /*<<< orphan*/);
int pthread_join(int /*<<< orphan*/, void **);
int /*<<< orphan*/ strerror(int);
void checked_thread_join(pthread_t t, void **retval) {
  int err = pthread_join(t, retval);
  if (err != 0) {
    errx(1, "Failed to join a thread: %s", strerror(err));
  }
}


x86 assembly (clang, -O0):
<checked_thread_join>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <pthread_join@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1173 <checked_thread_join+0x43>
mov    -0x14(%rbp),%edi
call   1050 <strerror@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xe92(%rip),%rsi
call   1030 <errx@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checked_thread_join>:
push   %rax
call   1040 <pthread_join@plt>
test   %eax,%eax
je     1155 <checked_thread_join+0x25>
mov    %eax,%edi
call   1050 <strerror@plt>
lea    0xeb8(%rip),%rsi
mov    $0x1,%edi
mov    %eax,%edx
pop    %rax
jmp    1030 <errx@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Failed to join a thread: %s\00"
define void @checked_thread_join(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = load i32, i32* %3
%7 = load i8**, i8*** %4
%8 = call i32 @pthread_join(i32 %6, i8** %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* %5
%13 = call i32 @strerror(i32 %12)
%14 = call i32 @errx(i32 1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %11, %2
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"Failed to join a thread: %s\00"
define void @checked_thread_join(i32 %0, i8** %1) {
%3 = tail call i32 @pthread_join(i32 %0, i8** %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @strerror(i32 %3)
%7 = tail call i32 @errx(i32 1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %8
8: ; preds = %5, %2
ret void
}
/* Type definitions */
struct lexer_token {
  int dummy;
};

/* Variables and functions */
scalar_t__ lexer_token_to_unsigned_long(struct lexer_token *);
extern int lexer_token_to_int(struct lexer_token *tok) {
  return (int)lexer_token_to_unsigned_long(tok);
}


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

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

LLVM IR (-O0):
%struct.lexer_token = type { i32 }
define i32 @lexer_token_to_int(%struct.lexer_token* %0) {
%2 = alloca %struct.lexer_token*
store %struct.lexer_token* %0, %struct.lexer_token** %2
%3 = load %struct.lexer_token*, %struct.lexer_token** %2
%4 = call i64 @lexer_token_to_unsigned_long(%struct.lexer_token* %3)
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
%struct.lexer_token = type { i32 }
define i32 @lexer_token_to_int(%struct.lexer_token* %0) {
%2 = tail call i64 @lexer_token_to_unsigned_long(%struct.lexer_token* %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Variables and functions */
int test_clock_gettime();
int main(int argc, char **argv) { return test_clock_gettime(); }


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    $0x0,%al
call   1030 <test_clock_gettime@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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 = call i32 (...) @test_clock_gettime()
ret i32 %6
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test_clock_gettime()
ret i32 %3
}
void miniSize() { ; }


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

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

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

LLVM IR (-O2):
define void @miniSize() {
ret void
}
void genbc1f_idle() {}


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

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

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

LLVM IR (-O2):
define void @genbc1f_idle() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ GenerateHash(int, char const *, int, char *, int);
void http_auth(char *hash, const char *path, int reqid) {
  GenerateHash(3, path, 2, hash, reqid);
}


x86 assembly (clang, -O0):
<http_auth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    $0x3,%edi
mov    $0x2,%edx
call   1030 <GenerateHash@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<http_auth>:
mov    %edx,%r8d
mov    %rdi,%rcx
mov    $0x3,%edi
mov    $0x2,%edx
jmp    1030 <GenerateHash@plt>

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

LLVM IR (-O2):
define void @http_auth(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @GenerateHash(i32 3, i8* %1, i32 2, i8* %0, i32 %2)
ret void
}