xunge/DecIR huggingface dataset:
/* Type definitions */
struct array {
  int dummy;
};

/* Variables and functions */
int array_size(struct array const *);
int queue_size(const struct array *q) { return array_size(q); }


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

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

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

LLVM IR (-O2):
%struct.array = type { i32 }
define i32 @queue_size(%struct.array* %0) {
%2 = tail call i32 @array_size(%struct.array* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ test();
void test_basics(void) {
  test();
  test();
  test();
  test();
  test();
}


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

x86 assembly (clang, -O2):
<test_basics>:
push   %rax
xor    %eax,%eax
call   1030 <test@plt>
xor    %eax,%eax
call   1030 <test@plt>
xor    %eax,%eax
call   1030 <test@plt>
xor    %eax,%eax
call   1030 <test@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <test@plt>

LLVM IR (-O0):
define void @test_basics() {
%1 = call i32 (...) @test()
%2 = call i32 (...) @test()
%3 = call i32 (...) @test()
%4 = call i32 (...) @test()
%5 = call i32 (...) @test()
ret void
}

LLVM IR (-O2):
define void @test_basics() {
%1 = tail call i32 (...) @test()
%2 = tail call i32 (...) @test()
%3 = tail call i32 (...) @test()
%4 = tail call i32 (...) @test()
%5 = tail call i32 (...) @test()
ret void
}
int fun353() { return 353; }


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

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

LLVM IR (-O0):
define i32 @fun353() {
ret i32 353
}

LLVM IR (-O2):
define i32 @fun353() {
ret i32 353
}
/* Variables and functions */
size_t strlen(char *);
bool trim_newline(char *str) {
  const size_t length = strlen(str);
  if (length == 0) {
    return false;
  } else {
    if (str[length - 1] == '\n') {
      str[length - 1] = '\0';
      return true;
    } else {
      return false;
    }
  }
}


x86 assembly (clang, -O0):
<trim_newline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1140 <trim_newline+0x30>
movl   $0x0,-0x4(%rbp)
jmp    117c <trim_newline+0x6c>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    1175 <trim_newline+0x65>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x1,-0x4(%rbp)
jmp    117c <trim_newline+0x6c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trim_newline>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1134 <trim_newline+0x24>
cmpb   $0xa,-0x1(%rcx,%rbx,1)
jne    1134 <trim_newline+0x24>
movb   $0x0,-0x1(%rbx,%rcx,1)
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @trim_newline(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = add i64 %2, -1
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 10
br i1 %8, label %9, label %10
9: ; preds = %4
store i8 0, i8* %6
br label %10
10: ; preds = %4, %1, %9
%11 = phi i32 [ 1, %9 ], [ 0, %1 ], [ 0, %4 ]
ret i32 %11
}
void ScaleRowDown2_SSSE3() {}


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

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

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

LLVM IR (-O2):
define void @ScaleRowDown2_SSSE3() {
ret void
}
double amax(double u, double v) {
  if (u > v)
    return (u);
  return (v);
}


x86 assembly (clang, -O0):
<amax>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    112d <amax+0x2d>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1137 <amax+0x37>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<amax>:
maxsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @amax(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = load double, double* %5
%8 = fcmp ogt double %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load double, double* %4
store double %10, double* %3
br label %13
11: ; preds = %2
%12 = load double, double* %5
store double %12, double* %3
br label %13
13: ; preds = %11, %9
%14 = load double, double* %3
ret double %14
}

LLVM IR (-O2):
define double @amax(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
double gsl_pow_4(const double x) {
  double x2 = x * x;
  return x2 * x2;
}


x86 assembly (clang, -O0):
<gsl_pow_4>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<gsl_pow_4>:
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @gsl_pow_4(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = load double, double* %2
%6 = fmul double %4, %5
store double %6, double* %3
%7 = load double, double* %3
%8 = load double, double* %3
%9 = fmul double %7, %8
ret double %9
}

LLVM IR (-O2):
define double @gsl_pow_4(double %0) {
%2 = fmul double %0, %0
%3 = fmul double %2, %2
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void free_vector(double *v, int nl, int nh) { free((char *)(v + nl)); }


x86 assembly (clang, -O0):
<free_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_vector>:
movslq %esi,%rax
lea    (%rdi,%rax,8),%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_vector(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load double*, double** %4
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds double, double* %7, i64 %9
%11 = bitcast double* %10 to i8*
%12 = call i32 @free(i8* %11)
ret void
}

LLVM IR (-O2):
define void @free_vector(double* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds double, double* %0, i64 %4
%6 = bitcast double* %5 to i8*
%7 = tail call i32 @free(i8* %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ op_write1(int);
void op_enc_inc_de(void) { op_write1(0x13); }


x86 assembly (clang, -O0):
<op_enc_inc_de>:
push   %rbp
mov    %rsp,%rbp
mov    $0x13,%edi
call   1030 <op_write1@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_enc_inc_de>:
mov    $0x13,%edi
jmp    1030 <op_write1@plt>

LLVM IR (-O0):
define void @op_enc_inc_de() {
%1 = call i32 @op_write1(i32 19)
ret void
}

LLVM IR (-O2):
define void @op_enc_inc_de() {
%1 = tail call i32 @op_write1(i32 19)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int);
void print_size(int i, char *s) { printf("sizeof %s: %d\n", s, i); }


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

x86 assembly (clang, -O2):
<print_size>:
mov    %edi,%edx
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"sizeof %s: %d\0A\00"
define void @print_size(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i32, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"sizeof %s: %d\0A\00"
define void @print_size(i32 %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %0)
ret void
}
/* Variables and functions */
short printNumber(unsigned long, int);
scalar_t__ println();
short printNumber_UI_ln(unsigned int n, int base) {
  short a = 0;
  a = printNumber((unsigned long)n, base);
  a += println();
  return (a);
}


x86 assembly (clang, -O0):
<printNumber_UI_ln>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movw   $0x0,-0xa(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%edi
mov    -0x8(%rbp),%esi
call   1040 <printNumber@plt>
mov    %ax,-0xa(%rbp)
mov    $0x0,%al
call   1030 <println@plt>
mov    %rax,%rcx
movswq -0xa(%rbp),%rax
add    %rcx,%rax
mov    %ax,-0xa(%rbp)
movswl -0xa(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printNumber_UI_ln>:
push   %rbx
mov    %edi,%edi
call   1040 <printNumber@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <println@plt>
add    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i16 @printNumber_UI_ln(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i16
store i32 %0, i32* %3
store i32 %1, i32* %4
store i16 0, i16* %5
%6 = load i32, i32* %3
%7 = zext i32 %6 to i64
%8 = load i32, i32* %4
%9 = call signext i16 @printNumber(i64 %7, i32 %8)
store i16 %9, i16* %5
%10 = call i64 (...) @println()
%11 = load i16, i16* %5
%12 = sext i16 %11 to i64
%13 = add nsw i64 %12, %10
%14 = trunc i64 %13 to i16
store i16 %14, i16* %5
%15 = load i16, i16* %5
ret i16 %15
}

LLVM IR (-O2):
define signext i16 @printNumber_UI_ln(i32 %0, i32 %1) {
%3 = zext i32 %0 to i64
%4 = tail call signext i16 @printNumber(i64 %3, i32 %1)
%5 = tail call i64 (...) @println()
%6 = trunc i64 %5 to i16
%7 = add i16 %4, %6
ret i16 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int, char *, char *);
int test_assertions() {
  {
    if (!(1)) {
      printf("%s:%d '%s' %s\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/5821gkv/lipo-sapr-lab4/refs/heads/"
             "master/yla_test_test.c",
             25, "1", "true assertion incorrect");
      return -1;
    }
  };
  {
    if ((0)) {
      printf("%s:%d '%s' %s\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/5821gkv/lipo-sapr-lab4/refs/heads/"
             "master/yla_test_test.c",
             26, "0", "false assertion incorrect");
      return -1;
    }
  };
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @test_assertions() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
unsigned long strtoul(char const *, char **, int);
unsigned long int wcstoul(const wchar_t *nptr, wchar_t **endptr, int base) {
  return strtoul((const char *)nptr, (char **)endptr, base);
}


x86 assembly (clang, -O0):
<wcstoul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <strtoul@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @wcstoul(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 = bitcast i32* %7 to i8*
%9 = load i32**, i32*** %5
%10 = bitcast i32** %9 to i8**
%11 = load i32, i32* %6
%12 = call i64 @strtoul(i8* %8, i8** %10, i32 %11)
ret i64 %12
}

LLVM IR (-O2):
define i64 @wcstoul(i32* %0, i32** nocapture %1, i32 %2) {
%4 = bitcast i32* %0 to i8*
%5 = bitcast i32** %1 to i8**
%6 = tail call i64 @strtoul(i8* %4, i8** %5, i32 %2)
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ thr1(int /*<<< orphan*/);
int /*<<< orphan*/ thr2(int /*<<< orphan*/);
int /*<<< orphan*/ thr3(int /*<<< orphan*/);
int /*<<< orphan*/ thr4(int /*<<< orphan*/);
int main() {
__CPROVER_ASYNC_0:
  thr1(0);
__CPROVER_ASYNC_1:
  thr2(0);
__CPROVER_ASYNC_2:
  thr3(0);
__CPROVER_ASYNC_3:
  thr4(0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1030 <thr1@plt>
xor    %edi,%edi
call   1050 <thr2@plt>
xor    %edi,%edi
call   1060 <thr3@plt>
xor    %edi,%edi
call   1040 <thr4@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <thr1@plt>
xor    %edi,%edi
call   1050 <thr2@plt>
xor    %edi,%edi
call   1060 <thr3@plt>
xor    %edi,%edi
call   1040 <thr4@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0
%3 = call i32 @thr1(i32 0)
br label %4
4: ; preds = %2
%5 = call i32 @thr2(i32 0)
br label %6
6: ; preds = %4
%7 = call i32 @thr3(i32 0)
br label %8
8: ; preds = %6
%9 = call i32 @thr4(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @thr1(i32 0)
%2 = tail call i32 @thr2(i32 0)
%3 = tail call i32 @thr3(i32 0)
%4 = tail call i32 @thr4(i32 0)
ret i32 0
}
int round_up_modulo(int x, int m) {
  return ({
           typeof(x) __a = (x);
           typeof(m) __b = (m);
           (__a - 1) / __b + 1;
         }) *
         m;
}


x86 assembly (clang, -O0):
<round_up_modulo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cltd
idivl  -0x10(%rbp)
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_up_modulo>:
lea    -0x1(%rdi),%eax
cltd
idiv   %esi
add    $0x1,%eax
imul   %esi,%eax
ret

LLVM IR (-O0):
define i32 @round_up_modulo(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = load i32, i32* %3
store i32 %8, i32* %5
%9 = load i32, i32* %4
store i32 %9, i32* %6
%10 = load i32, i32* %5
%11 = sub nsw i32 %10, 1
%12 = load i32, i32* %6
%13 = sdiv i32 %11, %12
%14 = add nsw i32 %13, 1
store i32 %14, i32* %7
%15 = load i32, i32* %7
%16 = load i32, i32* %4
%17 = mul nsw i32 %15, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @round_up_modulo(i32 %0, i32 %1) {
%3 = add nsw i32 %0, -1
%4 = sdiv i32 %3, %1
%5 = add nsw i32 %4, 1
%6 = mul nsw i32 %5, %1
ret i32 %6
}
void bsh_loop(void) {
  char *line;
  char **args;
  int status;
  do {
    printf("bsh> ");
    line = bsh_read_line();
    args = bsh_split_line(line);
    status = bsh_execute(args);
    free(line);
    free(args);
  } while (status);
}


x86 assembly (clang, -O0):
<bsh_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1040 <bsh_read_line@plt>
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1050 <bsh_split_line@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1070 <bsh_execute@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x14(%rbp)
jne    1158 <bsh_loop+0x8>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bsh_loop>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xea2(%rip),%r14
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1040 <bsh_read_line@plt>
movslq %eax,%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <bsh_split_line@plt>
movslq %eax,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <bsh_execute@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
test   %ebp,%ebp
jne    1160 <bsh_loop+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"bsh> \00"
define void @bsh_loop() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @bsh_read_line()
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @bsh_split_line to i32 (i8*, ...)*)(i8* %5)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8**
%9 = tail call i32 (i8**, ...) bitcast (i32 (...)* @bsh_execute to i32 (i8**, ...)*)(i8** %8)
tail call void @free(i8* %5)
%10 = inttoptr i64 %7 to i8*
tail call void @free(i8* %10)
%11 = icmp eq i32 %9, 0
br i1 %11, label %12, label %1
12: ; preds = %1
ret void
}
/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, int);
int syscall(int);
int main(int argc, char **argv) {
  int pid;
  pid = syscall(20);
  printf("SYSCALL PID = %d\n", pid);
  pid = getpid();
  printf("GETPID PID = %d\n", pid);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x14,%edi
call   1050 <syscall@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x14,%edi
call   1050 <syscall@plt>
lea    0xebe(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xebb(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"SYSCALL PID = %d\0A\00"
@.str.1 = [17 x i8] c"GETPID PID = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @syscall(i32 20)
store i32 %7, i32* %6
%8 = load i32, i32* %6
%9 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 (...) @getpid()
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"SYSCALL PID = %d\0A\00"
@.str.1 = [17 x i8] c"GETPID PID = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @syscall(i32 20)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 (...) @getpid()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
scalar_t__ is_palindrome(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int num = 0;
  scanf("%d", &num);
  for (; is_palindrome(num) == 0; num++)
    ;
  printf("%X", num);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1030 <is_palindrome@plt>
cmp    $0x0,%rax
jne    117b <main+0x4b>
jmp    116d <main+0x3d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1156 <main+0x26>
mov    -0x8(%rbp),%esi
lea    0xe7e(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xec0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
xchg   %ax,%ax
call   1030 <is_palindrome@plt>
test   %rax,%rax
jne    1167 <main+0x37>
mov    0x4(%rsp),%edi
add    $0x1,%edi
mov    %edi,0x4(%rsp)
jmp    1150 <main+0x20>
mov    0x4(%rsp),%esi
lea    0xe91(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%X\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i64 @is_palindrome(i32 %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %0, %7
%8 = load i32, i32* %1
%9 = add nsw i32 %8, 1
store i32 %9, i32* %1
%10 = call i64 @is_palindrome(i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %7, label %12
12: ; preds = %7, %0
%13 = load i32, i32* %1
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %13)
ret i32 0
}
/* Variables and functions */
int bit_propagate_ones_towards_right(int);
int bit_get_msb_val(int n) {
  n = bit_propagate_ones_towards_right(n);
  return (n & ~(n >> 1));
}


x86 assembly (clang, -O0):
<bit_get_msb_val>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <bit_propagate_ones_towards_right@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x1,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_get_msb_val>:
push   %rax
call   1030 <bit_propagate_ones_towards_right@plt>
mov    %eax,%ecx
sar    %ecx
not    %ecx
and    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @bit_get_msb_val(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @bit_propagate_ones_towards_right(i32 %3)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* %2
%7 = ashr i32 %6, 1
%8 = xor i32 %7, -1
%9 = and i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @bit_get_msb_val(i32 %0) {
%2 = tail call i32 @bit_propagate_ones_towards_right(i32 %0)
%3 = ashr i32 %2, 1
%4 = xor i32 %3, -1
%5 = and i32 %2, %4
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ CheckedCommand(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                  char *, int, int, int, int);
void SetTextColor(FILE *p_cmd, FILE *p_res, int i_overlay, int i_red,
                  int i_green, int i_blue) {
  CheckedCommand(p_cmd, p_res, "SetTextColor %d %d %d %d\n", i_overlay, i_red,
                 i_green, i_blue);
}


x86 assembly (clang, -O0):
<SetTextColor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
mov    -0x20(%rbp),%eax
lea    0xeb5(%rip),%rdx
mov    %eax,(%rsp)
call   1030 <CheckedCommand@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetTextColor>:
push   %rax
mov    %r8d,%eax
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %r9d,(%rsp)
lea    0xedc(%rip),%rdx
mov    %eax,%r9d
call   1030 <CheckedCommand@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [26 x i8] c"SetTextColor %d %d %d %d\0A\00"
define void @SetTextColor(i32* %0, i32* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32* %0, i32** %7
store i32* %1, i32** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load i32*, i32** %7
%14 = load i32*, i32** %8
%15 = load i32, i32* %9
%16 = load i32, i32* %10
%17 = load i32, i32* %11
%18 = load i32, i32* %12
%19 = call i32 @CheckedCommand(i32* %13, i32* %14, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %15, i32 %16, i32 %17, i32 %18)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"SetTextColor %d %d %d %d\0A\00"
define void @SetTextColor(i32* %0, i32* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @CheckedCommand(i32* %0, i32* %1, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3, i32 %4, i32 %5)
ret void
}
int test_imm_57int64_lowword_mem(long long *val) {
  return ((*val) & (0x57 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_57int64_lowword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
and    $0x57,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_57int64_lowword_mem>:
testb  $0x57,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_57int64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 87
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_57int64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 87
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int isnewline(int c) { return (c == 0x000a) || (c == 0x000d) || (c == 0x0085); }


x86 assembly (clang, -O0):
<isnewline>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0xa,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1132 <isnewline+0x32>
mov    $0x1,%al
cmpl   $0xd,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1132 <isnewline+0x32>
cmpl   $0x85,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isnewline>:
mov    $0x1,%eax
cmp    $0xa,%edi
je     110f <isnewline+0xf>
cmp    $0xd,%edi
jne    1110 <isnewline+0x10>
ret
xor    %eax,%eax
cmp    $0x85,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @isnewline(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 10
br i1 %4, label %11, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 13
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 133
br label %11
11: ; preds = %8, %5, %1
%12 = phi i1 [ true, %5 ], [ true, %1 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @isnewline(i32 %0) {
switch i32 %0, label %2 [
i32 13, label %5
i32 10, label %5
]
2: ; preds = %1
%3 = icmp eq i32 %0, 133
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ]
ret i32 %6
}
long fifidint(double a) { return (long)(a); }


x86 assembly (clang, -O0):
<fifidint>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fifidint>:
cvttsd2si %xmm0,%rax
ret

LLVM IR (-O0):
define i64 @fifidint(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i64
ret i64 %4
}

LLVM IR (-O2):
define i64 @fifidint(double %0) {
%2 = fptosi double %0 to i64
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ assertTrue(char *, int);
void *do_alloc(int);
int receive_ptr(void *);
void test_param() {
  void *p = do_alloc(4);
  int total_count = receive_ptr(p);
  assertTrue("total_count == 0", total_count == 0);
  ;
}


x86 assembly (clang, -O0):
<test_param>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1050 <do_alloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <receive_ptr@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xe9b(%rip),%rdi
call   1040 <assertTrue@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_param>:
push   %rax
mov    $0x4,%edi
call   1050 <do_alloc@plt>
mov    %rax,%rdi
call   1030 <receive_ptr@plt>
xor    %esi,%esi
test   %eax,%eax
sete   %sil
lea    0xeae(%rip),%rdi
pop    %rax
jmp    1040 <assertTrue@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"total_count == 0\00"
define void @test_param() {
%1 = alloca i8*
%2 = alloca i32
%3 = call i8* @do_alloc(i32 4)
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = call i32 @receive_ptr(i8* %4)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
%9 = call i32 @assertTrue(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %8)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"total_count == 0\00"
define void @test_param() {
%1 = tail call i8* @do_alloc(i32 4)
%2 = tail call i32 @receive_ptr(i8* %1)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @assertTrue(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ readfifo();
int main(int argc, char *argv[]) {
  readfifo();
  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    $0x0,%al
call   1030 <readfifo@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <readfifo@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 = call i32 (...) @readfifo()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @readfifo()
ret i32 0
}
int function(int x) {
  int multipleOf4 = x / 4;
  int multipleOf100 = x / 100;
  int multipleOf400 = x / 400;
  return multipleOf4 - multipleOf100 + multipleOf400;
}


x86 assembly (clang, -O0):
<function>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<function>:
lea    0x3(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
sar    $0x2,%eax
movslq %edi,%rcx
imul   $0xffffffffae147ae1,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x25,%rdx
add    %esi,%edx
add    %eax,%edx
imul   $0x51eb851f,%rcx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x27,%rax
add    %ecx,%eax
add    %edx,%eax
ret

LLVM IR (-O0):
define i32 @function(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = sdiv i32 %6, 4
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = sdiv i32 %8, 100
store i32 %9, i32* %4
%10 = load i32, i32* %2
%11 = sdiv i32 %10, 400
store i32 %11, i32* %5
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = sub nsw i32 %12, %13
%15 = load i32, i32* %5
%16 = add nsw i32 %14, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @function(i32 %0) {
%2 = sdiv i32 %0, 4
%3 = sdiv i32 %0, -100
%4 = sdiv i32 %0, 400
%5 = add nsw i32 %3, %2
%6 = add nsw i32 %5, %4
ret i32 %6
}
/* Variables and functions */
int rts_error(int, int const, int, unsigned int, unsigned char *, unsigned int);
int sgnl_assert(unsigned int filesz, unsigned char *file,
                unsigned int linenum) {
  extern const int ERR_ASSERT;
  return rts_error(5, ERR_ASSERT, 3, filesz, file, linenum);
}


x86 assembly (clang, -O0):
<sgnl_assert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2eb7(%rip),%rax
mov    (%rax),%esi
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%r8
mov    -0x14(%rbp),%r9d
mov    $0x5,%edi
mov    $0x3,%edx
call   1030 <rts_error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sgnl_assert>:
mov    %edx,%r9d
mov    %rsi,%r8
mov    %edi,%ecx
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
mov    $0x5,%edi
mov    $0x3,%edx
jmp    1030 <rts_error@plt>

LLVM IR (-O0):
@ERR_ASSERT = external constant i32
define i32 @sgnl_assert(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* @ERR_ASSERT
%8 = load i32, i32* %4
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 @rts_error(i32 5, i32 %7, i32 3, i32 %8, i8* %9, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
@ERR_ASSERT = external constant i32
define i32 @sgnl_assert(i32 %0, i8* %1, i32 %2) {
%4 = load i32, i32* @ERR_ASSERT
%5 = tail call i32 @rts_error(i32 5, i32 %4, i32 3, i32 %0, i8* %1, i32 %2)
ret i32 %5
}
long extract_nsi(unsigned long insn, int dialect __attribute__((unused)),
                 int *invalid) {
  *invalid = 1;
  return -(((insn & 0xffff) ^ 0x8000) - 0x8000);
}


x86 assembly (clang, -O0):
<extract_nsi>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x8(%rbp),%rcx
and    $0xffff,%rcx
xor    $0x8000,%rcx
sub    $0x8000,%rcx
xor    %eax,%eax
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_nsi>:
movl   $0x1,(%rdx)
movswq %di,%rax
neg    %rax
ret

LLVM IR (-O0):
define i64 @extract_nsi(i64 %0, i32 %1, i32* %2) {
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32*
store i64 %0, i64* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i32*, i32** %6
store i32 1, i32* %7
%8 = load i64, i64* %4
%9 = and i64 %8, 65535
%10 = xor i64 %9, 32768
%11 = sub i64 %10, 32768
%12 = sub i64 0, %11
ret i64 %12
}

LLVM IR (-O2):
define i64 @extract_nsi(i64 %0, i32 %1, i32* nocapture writeonly %2) {
store i32 1, i32* %2
%4 = shl i64 %0, 48
%5 = ashr exact i64 %4, 48
%6 = sub nsw i64 0, %5
ret i64 %6
}
int SE_utils_powerof2(int number) {
  if (number & (number - 1) != 0) {
    return 0;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<SE_utils_powerof2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    $0x0,%ecx
setne  %cl
and    $0x1,%cl
movzbl %cl,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1133 <SE_utils_powerof2+0x33>
movl   $0x0,-0x4(%rbp)
jmp    113a <SE_utils_powerof2+0x3a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SE_utils_powerof2>:
xor    %eax,%eax
cmp    $0x1,%edi
setne  %al
and    %edi,%eax
xor    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @SE_utils_powerof2(i32 %0) {
%2 = icmp ne i32 %0, 1
%3 = zext i1 %2 to i32
%4 = and i32 %3, %0
%5 = xor i32 %4, 1
ret i32 %5
}
int strlens(char *s) {
  int i;
  for (i = 0; *s != '\0'; s++) {
    i++;
  }
  return i;
}


x86 assembly (clang, -O0):
<strlens>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1139 <strlens+0x39>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <strlens+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @strlens(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = add nuw nsw i32 %5, 1
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %12
}
int test_imm_60uint32_reg(unsigned int val) {
  return ((val) & (0x60 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_60uint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x60,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_60uint32_reg>:
test   $0x60,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_60uint32_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 96
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 -20, i32 -40
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_imm_60uint32_reg(i32 %0) {
%2 = and i32 %0, 96
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ cc2420_set_channel(unsigned int);
void do_set_channel(unsigned int chan) { cc2420_set_channel(chan); }


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

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

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

LLVM IR (-O2):
define void @do_set_channel(i32 %0) {
%2 = tail call i32 @cc2420_set_channel(i32 %0)
ret void
}
int vde_chain_nm7_work(int *sz_arg, int *sz_res, int *sz_iw, int *sz_w) {
  if (sz_arg)
    *sz_arg = 4;
  if (sz_res)
    *sz_res = 3;
  if (sz_iw)
    *sz_iw = 0;
  if (sz_w)
    *sz_w = 81;
  return 0;
}


x86 assembly (clang, -O0):
<vde_chain_nm7_work>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1129 <vde_chain_nm7_work+0x29>
mov    -0x8(%rbp),%rax
movl   $0x4,(%rax)
cmpq   $0x0,-0x10(%rbp)
je     113e <vde_chain_nm7_work+0x3e>
mov    -0x10(%rbp),%rax
movl   $0x3,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     1153 <vde_chain_nm7_work+0x53>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     1168 <vde_chain_nm7_work+0x68>
mov    -0x20(%rbp),%rax
movl   $0x51,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vde_chain_nm7_work>:
test   %rdi,%rdi
je     110b <vde_chain_nm7_work+0xb>
movl   $0x4,(%rdi)
test   %rsi,%rsi
je     1116 <vde_chain_nm7_work+0x16>
movl   $0x3,(%rsi)
test   %rdx,%rdx
je     1121 <vde_chain_nm7_work+0x21>
movl   $0x0,(%rdx)
test   %rcx,%rcx
je     112c <vde_chain_nm7_work+0x2c>
movl   $0x51,(%rcx)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @vde_chain_nm7_work(i32* writeonly %0, i32* writeonly %1, i32* writeonly %2, i32* writeonly %3) {
%5 = icmp eq i32* %0, null
br i1 %5, label %7, label %6
6: ; preds = %4
store i32 4, i32* %0
br label %7
7: ; preds = %6, %4
%8 = icmp eq i32* %1, null
br i1 %8, label %10, label %9
9: ; preds = %7
store i32 3, i32* %1
br label %10
10: ; preds = %9, %7
%11 = icmp eq i32* %2, null
br i1 %11, label %13, label %12
12: ; preds = %10
store i32 0, i32* %2
br label %13
13: ; preds = %12, %10
%14 = icmp eq i32* %3, null
br i1 %14, label %16, label %15
15: ; preds = %13
store i32 81, i32* %3
br label %16
16: ; preds = %15, %13
ret i32 0
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ printf(char *, int, int);
main() {
  int c;
  while ((c = getchar()) != EOF) {
    printf("%c is EOF: %d\n", c, c == EOF);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea8(%rip),%rcx
cmp    (%rcx),%eax
je     1170 <main+0x50>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%eax
mov    0x2e93(%rip),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edx
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb6(%rip),%r14
cmp    (%r14),%eax
je     1158 <main+0x38>
lea    0xec2(%rip),%rbx
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%eax
jne    1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [15 x i8] c"%c is EOF: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %7, %0
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
%5 = load i32, i32* @EOF
%6 = icmp ne i32 %4, %5
br i1 %6, label %7, label %14
7: ; preds = %3
%8 = load i32, i32* %2
%9 = load i32, i32* %2
%10 = load i32, i32* @EOF
%11 = icmp eq i32 %9, %10
%12 = zext i1 %11 to i32
%13 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %12)
br label %3
14: ; preds = %3
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [15 x i8] c"%c is EOF: %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %10, label %4
4: ; preds = %0, %4
%5 = phi i32 [ %7, %4 ], [ %1, %0 ]
%6 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %5, i32 0)
%7 = tail call i32 (...) @getchar()
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %4
10: ; preds = %4, %0
ret i32 0
}
unsigned long b_ethernet_rx(void *mem, unsigned long iid) {
  unsigned long tlong;
  asm volatile("call *0x00100068" : "=c"(tlong) : "D"(mem), "d"(iid));
  return tlong;
}


x86 assembly (clang, -O0):
<b_ethernet_rx>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
call   *0x100068
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<b_ethernet_rx>:
mov    %rsi,%rdx
call   *0x100068
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @b_ethernet_rx(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i64 asm sideeffect "call *0x00100068", "={cx},{di},{dx},~{dirflag},~{fpsr},~{flags}"(i8* %6, i64 %7)
store i64 %8, i64* %5
%9 = load i64, i64* %5
ret i64 %9
}

LLVM IR (-O2):
define i64 @b_ethernet_rx(i8* %0, i64 %1) {
%3 = tail call i64 asm sideeffect "call *0x00100068", "={cx},{di},{dx},~{dirflag},~{fpsr},~{flags}"(i8* %0, i64 %1)
ret i64 %3
}