xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ err(int, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ run_loop(char **);
int main(int argc, char *argv[]) {
  if (argc < 3) {
    err(10, "Usage: fabler <prefix>/<len> <healthcheck_cmd> "
            "[<healtcheck_args>...]");
  }
  run_loop(argv);
  exit(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)
cmpl   $0x3,-0x8(%rbp)
jge    1161 <main+0x31>
mov    $0xa,%edi
lea    0xea4(%rip),%rsi
call   1040 <err@plt>
mov    -0x10(%rbp),%rdi
call   1030 <run_loop@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
jg     114a <main+0x1a>
lea    0xec0(%rip),%rsi
mov    $0xa,%edi
call   1040 <err@plt>
mov    %rbx,%rdi
call   1030 <run_loop@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [70 x i8] c"Usage: fabler <prefix>/<len> <healthcheck_cmd> [<healtcheck_args>...]\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 = icmp slt i32 %6, 3
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @err(i32 10, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = load i8**, i8*** %5
%12 = call i32 @run_loop(i8** %11)
%13 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [70 x i8] c"Usage: fabler <prefix>/<len> <healthcheck_cmd> [<healtcheck_args>...]\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @err(i32 10, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = tail call i32 @run_loop(i8** %1)
%8 = tail call i32 @exit(i32 0)
unreachable
}
signed short int signedshortint_ignoring_unsignedlongint(signed short int x,
                                                         unsigned long int y) {
  return x;
}


x86 assembly (clang, -O0):
<signedshortint_ignoring_unsignedlongint>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i16 @signedshortint_ignoring_unsignedlongint(i16 signext %0, i64 %1) {
%3 = alloca i16
%4 = alloca i64
store i16 %0, i16* %3
store i64 %1, i64* %4
%5 = load i16, i16* %3
ret i16 %5
}

LLVM IR (-O2):
define signext i16 @signedshortint_ignoring_unsignedlongint(i16 returned signext %0, i64 %1) {
ret i16 %0
}
/* Variables and functions */
int /*<<< orphan*/ gpio_set_dir_with_mask(int, int);
int /*<<< orphan*/ gpio_write_data_with_mask(int, int);
int /*<<< orphan*/ set_gpio_pad_with_mask(int, int);
int /*<<< orphan*/ unfreeze_gpio_out();
void operation_i2c_start() {
  gpio_write_data_with_mask((1 << 1) | (1 << 0), (1 << 1) | (1 << 0));
  set_gpio_pad_with_mask((1 << 1) | (1 << 0), (1 << 1) | (1 << 0));
  gpio_set_dir_with_mask((1 << 1) | (1 << 0), (1 << 1) | (1 << 0));
  unfreeze_gpio_out();
  gpio_write_data_with_mask((1 << 1) | (1 << 0), (0 << 1) | (1 << 0));
  gpio_write_data_with_mask((1 << 1) | (1 << 0), (0 << 1) | (0 << 0));
}


x86 assembly (clang, -O0):
<operation_i2c_start>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%esi
mov    %esi,%edi
call   1030 <gpio_write_data_with_mask@plt>
mov    $0x3,%esi
mov    %esi,%edi
call   1060 <set_gpio_pad_with_mask@plt>
mov    $0x3,%esi
mov    %esi,%edi
call   1050 <gpio_set_dir_with_mask@plt>
mov    $0x0,%al
call   1040 <unfreeze_gpio_out@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1030 <gpio_write_data_with_mask@plt>
mov    $0x3,%edi
xor    %esi,%esi
call   1030 <gpio_write_data_with_mask@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<operation_i2c_start>:
push   %rax
mov    $0x3,%edi
mov    $0x3,%esi
call   1030 <gpio_write_data_with_mask@plt>
mov    $0x3,%edi
mov    $0x3,%esi
call   1060 <set_gpio_pad_with_mask@plt>
mov    $0x3,%edi
mov    $0x3,%esi
call   1050 <gpio_set_dir_with_mask@plt>
xor    %eax,%eax
call   1040 <unfreeze_gpio_out@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1030 <gpio_write_data_with_mask@plt>
mov    $0x3,%edi
xor    %esi,%esi
pop    %rax
jmp    1030 <gpio_write_data_with_mask@plt>

LLVM IR (-O0):
define void @operation_i2c_start() {
%1 = call i32 @gpio_write_data_with_mask(i32 3, i32 3)
%2 = call i32 @set_gpio_pad_with_mask(i32 3, i32 3)
%3 = call i32 @gpio_set_dir_with_mask(i32 3, i32 3)
%4 = call i32 (...) @unfreeze_gpio_out()
%5 = call i32 @gpio_write_data_with_mask(i32 3, i32 1)
%6 = call i32 @gpio_write_data_with_mask(i32 3, i32 0)
ret void
}

LLVM IR (-O2):
define void @operation_i2c_start() {
%1 = tail call i32 @gpio_write_data_with_mask(i32 3, i32 3)
%2 = tail call i32 @set_gpio_pad_with_mask(i32 3, i32 3)
%3 = tail call i32 @gpio_set_dir_with_mask(i32 3, i32 3)
%4 = tail call i32 (...) @unfreeze_gpio_out()
%5 = tail call i32 @gpio_write_data_with_mask(i32 3, i32 1)
%6 = tail call i32 @gpio_write_data_with_mask(i32 3, i32 0)
ret void
}
/* Variables and functions */
size_t func_count(void) { return 1; }


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

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

LLVM IR (-O0):
define i64 @func_count() {
ret i64 1
}

LLVM IR (-O2):
define i64 @func_count() {
ret i64 1
}
/* Type definitions */
struct expression {
  int dummy;
};

/* Variables and functions */
struct expression const *expr_generic();
const struct expression *expr_struct_access(const struct expression *struct_,
                                            const char *field_name) {
  return expr_generic();
}


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

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

LLVM IR (-O0):
%struct.expression = type { i32 }
define %struct.expression* @expr_struct_access(%struct.expression* %0, i8* %1) {
%3 = alloca %struct.expression*
%4 = alloca i8*
store %struct.expression* %0, %struct.expression** %3
store i8* %1, i8** %4
%5 = call %struct.expression* (...) @expr_generic()
ret %struct.expression* %5
}

LLVM IR (-O2):
%struct.expression = type { i32 }
define %struct.expression* @expr_struct_access(%struct.expression* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = tail call %struct.expression* (...) @expr_generic()
ret %struct.expression* %3
}
/* Variables and functions */
int squeeze_compare(char *, char *);
int strcmp(char *, char *);
int stable_compare(const void *p, const void *q) {
  char *x = *(char **)p;
  char *y = *(char **)q;
  int i;
  i = squeeze_compare(x, y);
  if (i == 0)
    return strcmp(x, y);
  return i;
}


x86 assembly (clang, -O0):
<stable_compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <squeeze_compare@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    1175 <stable_compare+0x55>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0x4(%rbp)
jmp    117b <stable_compare+0x5b>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stable_compare>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%rbx
mov    (%rsi),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <squeeze_compare@plt>
test   %eax,%eax
je     1141 <stable_compare+0x21>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @stable_compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @squeeze_compare(i8* %4, i8* %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
br label %11
11: ; preds = %2, %9
%12 = phi i32 [ %10, %9 ], [ %7, %2 ]
ret i32 %12
}
int _cffi_carefully_make_gil(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @_cffi_carefully_make_gil() {
ret i32 0
}
int bar(void) {
  unsigned short x;
  volatile unsigned short *z;
  foo(&x);
  const unsigned int y = x;
  z = &x;
  __asm __volatile("movb %b1,1(%2)\n\tmovb %h1,(%2)"
                   : "=m"(*z)
                   : "Q"(y), "R"(z));
  return (x & 1) == 0;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x2(%rbp),%rdi
mov    $0x0,%al
call   1030 <foo@plt>
movzwl -0x2(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    -0x2(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rdx
mov    %cl,0x1(%rdx)
mov    %ch,(%rdx)
movzwl -0x2(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rbx
sub    $0x10,%rsp
lea    0xe(%rsp),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <foo@plt>
movzwl 0xe(%rsp),%eax
mov    %al,0x1(%rbx)
mov    %ah,(%rbx)
movzwl 0xe(%rsp),%eax
not    %eax
and    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @bar() {
%1 = alloca i16
%2 = alloca i16*
%3 = alloca i32
%4 = call i32 (i16*, ...) bitcast (i32 (...)* @foo to i32 (i16*, ...)*)(i16* %1)
%5 = load i16, i16* %1
%6 = zext i16 %5 to i32
store i32 %6, i32* %3
store i16* %1, i16** %2
%7 = load i16*, i16** %2
%8 = load i32, i32* %3
%9 = load i16*, i16** %2
%10 = load i16, i16* %1
%11 = zext i16 %10 to i32
%12 = and i32 %11, 1
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @bar() {
%1 = alloca i16
%2 = bitcast i16* %1 to i8*
%3 = call i32 (i16*, ...) bitcast (i32 (...)* @foo to i32 (i16*, ...)*)(i16* %1)
%4 = load i16, i16* %1
%5 = zext i16 %4 to i32
%6 = load i16, i16* %1
%7 = and i16 %6, 1
%8 = xor i16 %7, 1
%9 = zext i16 %8 to i32
ret i32 %9
}
/* Variables and functions */
double fabs(double);
double trunc(double);
double remainder(double x, double y) {
  double q = x / y;
  double n = trunc(q);
  if (fabs(n - q) >= 0.5)
    ++n;
  return x - n * y;
}


x86 assembly (clang, -O0):
<remainder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <trunc@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movaps 0xebf(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xea3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1179 <remainder+0x69>
movsd  0xe99(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remainder>:
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
call   1030 <trunc@plt>
movapd %xmm0,%xmm1
subsd  (%rsp),%xmm1
andpd  0xec1(%rip),%xmm1
movsd  0xec9(%rip),%xmm2
addsd  %xmm0,%xmm2
movsd  0xec5(%rip),%xmm3
cmpnlesd %xmm1,%xmm3
andpd  %xmm3,%xmm0
andnpd %xmm2,%xmm3
orpd   %xmm0,%xmm3
mulsd  0x8(%rsp),%xmm3
movsd  0x10(%rsp),%xmm0
subsd  %xmm3,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @remainder(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %3
store double %1, double* %4
%7 = load double, double* %3
%8 = load double, double* %4
%9 = fdiv double %7, %8
store double %9, double* %5
%10 = load double, double* %5
%11 = call double @llvm.trunc.f64(double %10)
store double %11, double* %6
%12 = load double, double* %6
%13 = load double, double* %5
%14 = fsub double %12, %13
%15 = call double @llvm.fabs.f64(double %14)
%16 = fcmp oge double %15, 5.000000e-01
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = load double, double* %6
%19 = fadd double %18, 1.000000e+00
store double %19, double* %6
br label %20
20: ; preds = %17, %2
%21 = load double, double* %3
%22 = load double, double* %6
%23 = load double, double* %4
%24 = fneg double %22
%25 = call double @llvm.fmuladd.f64(double %24, double %23, double %21)
ret double %25
}

LLVM IR (-O2):
define double @remainder(double %0, double %1) {
%3 = fdiv double %0, %1
%4 = tail call double @llvm.trunc.f64(double %3)
%5 = fsub double %4, %3
%6 = tail call double @llvm.fabs.f64(double %5)
%7 = fcmp ult double %6, 5.000000e-01
%8 = fadd double %4, 1.000000e+00
%9 = select i1 %7, double %4, double %8
%10 = fneg double %9
%11 = tail call double @llvm.fmuladd.f64(double %10, double %1, double %0)
ret double %11
}
int set_ScrnCols(void) { return 80; }


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

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

LLVM IR (-O0):
define i32 @set_ScrnCols() {
ret i32 80
}

LLVM IR (-O2):
define i32 @set_ScrnCols() {
ret i32 80
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
char popcount(uint64_t bits) {
  bits -= ((bits & 0xAAAAAAAAAAAAAAAA) >> 1);
  bits = (bits & 0x3333333333333333) + ((bits >> 2) & 0x3333333333333333);
  bits = (bits + (bits >> 4)) & 0x0F0F0F0F0F0F0F0F;
  return (bits * 0x0101010101010101) >> 56;
}


x86 assembly (clang, -O0):
<popcount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rcx
movabs $0xaaaaaaaaaaaaaaaa,%rax
aa aa aa
and    %rax,%rcx
shr    $0x1,%rcx
movslq -0x4(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movabs $0x3333333333333333,%rcx
33 33 33
and    %rcx,%rax
mov    -0x4(%rbp),%ecx
sar    $0x2,%ecx
movslq %ecx,%rcx
movabs $0x3333333333333333,%rdx
33 33 33
and    %rdx,%rcx
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x4,%ecx
add    %ecx,%eax
cltq
movabs $0xf0f0f0f0f0f0f0f,%rcx
0f 0f 0f
and    %rcx,%rax
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movabs $0x101010101010101,%rcx
01 01 01
imul   %rcx,%rax
sar    $0x38,%rax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<popcount>:
mov    %edi,%eax
shr    %eax
and    $0x55555555,%eax
sub    %eax,%edi
mov    %edi,%eax
and    $0x33333333,%eax
shr    $0x2,%edi
and    $0x33333333,%edi
add    %edi,%eax
mov    %eax,%ecx
shr    $0x4,%ecx
add    %eax,%ecx
and    $0xf0f0f0f,%ecx
movabs $0x101010101010101,%rax
01 01 01
imul   %rcx,%rax
shr    $0x38,%rax
ret

LLVM IR (-O0):
define signext i8 @popcount(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = and i64 %4, -6148914691236517206
%6 = lshr i64 %5, 1
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = sub i64 %8, %6
%10 = trunc i64 %9 to i32
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = and i64 %12, 3689348814741910323
%14 = load i32, i32* %2
%15 = ashr i32 %14, 2
%16 = sext i32 %15 to i64
%17 = and i64 %16, 3689348814741910323
%18 = add nsw i64 %13, %17
%19 = trunc i64 %18 to i32
store i32 %19, i32* %2
%20 = load i32, i32* %2
%21 = load i32, i32* %2
%22 = ashr i32 %21, 4
%23 = add nsw i32 %20, %22
%24 = sext i32 %23 to i64
%25 = and i64 %24, 1085102592571150095
%26 = trunc i64 %25 to i32
store i32 %26, i32* %2
%27 = load i32, i32* %2
%28 = sext i32 %27 to i64
%29 = mul nsw i64 %28, 72340172838076673
%30 = ashr i64 %29, 56
%31 = trunc i64 %30 to i8
ret i8 %31
}

LLVM IR (-O2):
define signext i8 @popcount(i32 %0) {
%2 = lshr i32 %0, 1
%3 = and i32 %2, 1431655765
%4 = sub i32 %0, %3
%5 = and i32 %4, 858993459
%6 = lshr i32 %4, 2
%7 = and i32 %6, 858993459
%8 = add nuw nsw i32 %7, %5
%9 = lshr i32 %8, 4
%10 = add nuw nsw i32 %9, %8
%11 = and i32 %10, 252645135
%12 = zext i32 %11 to i64
%13 = mul nsw i64 %12, 72340172838076673
%14 = lshr i64 %13, 56
%15 = trunc i64 %14 to i8
ret i8 %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  char str[] = "just another test";
  int len0 = (&str)[1] - str;
  int len1 = *(&str + 1) - str;
  printf("char %d\n char %d\n", len0, len1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed4(%rip),%ax
mov    %ax,-0x10(%rbp)
lea    -0x20(%rbp),%rax
add    $0x12,%rax
lea    -0x20(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x24(%rbp)
lea    -0x20(%rbp),%rax
add    $0x12,%rax
lea    -0x20(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.str = [18 x i8] c"just another test\00"
@.str = [18 x i8] c"char %d\0A char %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [18 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [18 x i8]* %2 to i8*
%6 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 1
%7 = getelementptr inbounds [18 x i8], [18 x i8]* %6, i64 0, i64 0
%8 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 0
%9 = ptrtoint i8* %7 to i64
%10 = ptrtoint i8* %8 to i64
%11 = sub i64 %9, %10
%12 = trunc i64 %11 to i32
store i32 %12, i32* %3
%13 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 1
%14 = getelementptr inbounds [18 x i8], [18 x i8]* %13, i64 0, i64 0
%15 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 0
%16 = ptrtoint i8* %14 to i64
%17 = ptrtoint i8* %15 to i64
%18 = sub i64 %16, %17
%19 = trunc i64 %18 to i32
store i32 %19, i32* %4
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"char %d\0A char %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 18, i32 18)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ clang_analyzer_eval(int);
void array_different_types() {
  int array[10];
  int *a = &array[2];
  char *b = (char *)&array[5];
  clang_analyzer_eval(a != b);
  clang_analyzer_eval(a < b);
  clang_analyzer_eval(a <= b);
}


x86 assembly (clang, -O0):
<array_different_types>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x38(%rbp)
lea    -0x30(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%rcx
cmp    %rcx,%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%rcx
cmp    %rcx,%rax
setb   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%rcx
cmp    %rcx,%rax
setbe  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_different_types>:
push   %rax
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
pop    %rax
jmp    1030 <clang_analyzer_eval@plt>

LLVM IR (-O0):
define void @array_different_types() {
%1 = alloca [10 x i32]
%2 = alloca i32*
%3 = alloca i8*
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
store i32* %4, i32** %2
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%6 = bitcast i32* %5 to i8*
store i8* %6, i8** %3
%7 = load i32*, i32** %2
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to i32*
%10 = icmp ne i32* %7, %9
%11 = zext i1 %10 to i32
%12 = call i32 @clang_analyzer_eval(i32 %11)
%13 = load i32*, i32** %2
%14 = load i8*, i8** %3
%15 = bitcast i8* %14 to i32*
%16 = icmp ult i32* %13, %15
%17 = zext i1 %16 to i32
%18 = call i32 @clang_analyzer_eval(i32 %17)
%19 = load i32*, i32** %2
%20 = load i8*, i8** %3
%21 = bitcast i8* %20 to i32*
%22 = icmp ule i32* %19, %21
%23 = zext i1 %22 to i32
%24 = call i32 @clang_analyzer_eval(i32 %23)
ret void
}

LLVM IR (-O2):
define void @array_different_types() {
%1 = tail call i32 @clang_analyzer_eval(i32 1)
%2 = tail call i32 @clang_analyzer_eval(i32 1)
%3 = tail call i32 @clang_analyzer_eval(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void g1(void) {
  printf("%s:Hello World\n",
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/OrangeTide/build/refs/heads/master/example/"
         "g/g1.c");
}


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"%s:Hello World\0A\00"
@.str.1 = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/OrangeTide/build/refs/heads/master/example/g/g1.c\00"
define void @g1() {
%1 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"%s:Hello World\0A\00"
@.str.1 = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/OrangeTide/build/refs/heads/master/example/g/g1.c\00"
define void @g1() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ emit(char *);
void flags(void) {
  emit("lahf\n");
  emit("seto al\n");
}


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

x86 assembly (clang, -O2):
<flags>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <emit@plt>
lea    0xee2(%rip),%rdi
pop    %rax
jmp    1030 <emit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"lahf\0A\00"
@.str.1 = [9 x i8] c"seto al\0A\00"
define void @flags() {
%1 = call i32 @emit(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @emit(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"lahf\0A\00"
@.str.1 = [9 x i8] c"seto al\0A\00"
define void @flags() {
%1 = tail call i32 @emit(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @emit(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void XUngrabPointer() {}


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

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

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

LLVM IR (-O2):
define void @XUngrabPointer() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ IntDisable(int);
int /*<<< orphan*/ IntUnregister(int);
void ComparatorIntUnregister(unsigned long ulBase, unsigned long ulComp) {
  ;
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000008))) &= ~(1 << ulComp);
  IntDisable(41 + ulComp);
  IntUnregister(41 + ulComp);
}


x86 assembly (clang, -O0):
<ComparatorIntUnregister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
movslq %eax,%rdx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rcx
and    %rdx,%rcx
mov    %rcx,0x8(%rax)
mov    -0x10(%rbp),%rax
add    $0x29,%rax
mov    %eax,%edi
call   1030 <IntDisable@plt>
mov    -0x10(%rbp),%rax
add    $0x29,%rax
mov    %eax,%edi
call   1040 <IntUnregister@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ComparatorIntUnregister>:
push   %rbx
mov    %rsi,%rcx
mov    $0xfffffffe,%eax
rol    %cl,%eax
cltq
and    %rax,0x8(%rdi)
lea    0x29(%rsi),%ebx
mov    %ebx,%edi
call   1030 <IntDisable@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <IntUnregister@plt>

LLVM IR (-O0):
define void @ComparatorIntUnregister(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = shl i32 1, %6
%8 = xor i32 %7, -1
%9 = sext i32 %8 to i64
%10 = load i64, i64* %3
%11 = add i64 %10, 8
%12 = inttoptr i64 %11 to i64*
%13 = load volatile i64, i64* %12
%14 = and i64 %13, %9
store volatile i64 %14, i64* %12
%15 = load i64, i64* %4
%16 = add i64 41, %15
%17 = trunc i64 %16 to i32
%18 = call i32 @IntDisable(i32 %17)
%19 = load i64, i64* %4
%20 = add i64 41, %19
%21 = trunc i64 %20 to i32
%22 = call i32 @IntUnregister(i32 %21)
ret void
}

LLVM IR (-O2):
define void @ComparatorIntUnregister(i64 %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = shl nuw i32 1, %3
%5 = xor i32 %4, -1
%6 = sext i32 %5 to i64
%7 = add i64 %0, 8
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = and i64 %9, %6
store volatile i64 %10, i64* %8
%11 = add i32 %3, 41
%12 = tail call i32 @IntDisable(i32 %11)
%13 = tail call i32 @IntUnregister(i32 %11)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ japi_cliprect(int, int, int, int, int);
void j_cliprect(int arg0, int arg1, int arg2, int arg3, int arg4) {
  japi_cliprect(arg0, arg1, arg2, arg3, arg4);
}


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

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

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

LLVM IR (-O2):
define void @j_cliprect(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @japi_cliprect(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4)
ret void
}
int test_imm_43uint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x43 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_43uint64_highword_reg>:
movabs $0x4300000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_43uint64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 32
%5 = and i64 %4, 67
%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_43uint64_highword_reg(i64 %0) {
%2 = and i64 %0, 287762808832
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
double timing(void) { return 0; }


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

x86 assembly (clang, -O2):
<timing>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @timing() {
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @timing() {
ret double 0.000000e+00
}
/* Variables and functions */
size_t strlen(char *);
void truncate_newline(char *buffer) {
  size_t len = strlen(buffer);
  if (len > 0 && buffer[len - 1] == '\n') {
    buffer[len - 1] = '\0';
  }
}


x86 assembly (clang, -O0):
<truncate_newline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jbe    115d <truncate_newline+0x4d>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    115d <truncate_newline+0x4d>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<truncate_newline>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %rax,%rax
je     112a <truncate_newline+0x1a>
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    112a <truncate_newline+0x1a>
movb   $0x0,-0x1(%rbx,%rax,1)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @truncate_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 = %9, %4, %1
ret void
}
int sign(double dValue) {
  if (dValue < 0.0) {
    return -1;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<sign>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1123 <sign+0x23>
movl   $0xffffffff,-0x4(%rbp)
jmp    112a <sign+0x2a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sign>:
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
setbe  %al
add    %eax,%eax
add    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @sign(double %0) {
%2 = alloca i32
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, 0.000000e+00
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 -1, i32* %2
br label %8
7: ; preds = %1
store i32 1, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @sign(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = select i1 %2, i32 -1, i32 1
ret i32 %3
}
is_C_INSTR(str) char *str;
{
  if (*str == 'C' && *(str + 1) == '_')
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<is_C_INSTR>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x43,%eax
jne    1135 <is_C_INSTR+0x35>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x5f,%eax
jne    1135 <is_C_INSTR+0x35>
movl   $0x1,-0x4(%rbp)
jmp    113c <is_C_INSTR+0x3c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_C_INSTR>:
cmpb   $0x43,(%rdi)
jne    1110 <is_C_INSTR+0x10>
mov    $0x1,%eax
cmpb   $0x5f,0x1(%rdi)
je     1112 <is_C_INSTR+0x12>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @is_C_INSTR(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 67
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 95
br i1 %7, label %9, label %8
8: ; preds = %4, %1
br label %9
9: ; preds = %4, %8
%10 = phi i32 [ 0, %8 ], [ 1, %4 ]
ret i32 %10
}
/* Type definitions */
struct _urb {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ kfree(struct _urb *);
void _urb_free(struct _urb *_urb) { kfree(_urb); }


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

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

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

LLVM IR (-O2):
%struct._urb = type { i32 }
define void @_urb_free(%struct._urb* %0) {
%2 = tail call i32 @kfree(%struct._urb* %0)
ret void
}
long e4c_library_version(void) {
  return ((long)(((long)0 * 10000000L) + ((long)3 * 1000000L) +
                 ((long)0 * 1000L) + ((long)5 * 1L)));
}


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

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

LLVM IR (-O0):
define i64 @e4c_library_version() {
ret i64 3000005
}

LLVM IR (-O2):
define i64 @e4c_library_version() {
ret i64 3000005
}
/* Variables and functions */
int /*<<< orphan*/ poll(int /*<<< orphan*/, int /*<<< orphan*/, int);
void sleep100ms(void) {
  do {
  } while (0);
  poll(0, 0, 100);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
jmp    1119 <sleep100ms+0x9>
jmp    111e <sleep100ms+0xe>
xor    %esi,%esi
mov    $0x64,%edx
mov    %esi,%edi
call   1030 <poll@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
xor    %edi,%edi
xor    %esi,%esi
mov    $0x64,%edx
jmp    1030 <poll@plt>

LLVM IR (-O0):
define void @sleep100ms() {
br label %1
1: ; preds = %0
br label %2
2: ; preds = %1
%3 = call i32 @poll(i32 0, i32 0, i32 100)
ret void
}

LLVM IR (-O2):
define void @sleep100ms() {
%1 = tail call i32 @poll(i32 0, i32 0, i32 100)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cgiURLAdd(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
void cgiURLAddInt(int param) {
  char s[21];
  sprintf(s, "%d", param);
  cgiURLAdd(s);
}


x86 assembly (clang, -O0):
<cgiURLAddInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xec7(%rip),%rsi
call   1030 <sprintf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <cgiURLAdd@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgiURLAddInt>:
push   %rbx
sub    $0x20,%rsp
mov    %edi,%edx
lea    0xed2(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <cgiURLAdd@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @cgiURLAddInt(i32 %0) {
%2 = alloca i32
%3 = alloca [21 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%8 = call i32 @cgiURLAdd(i8* %7)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @cgiURLAddInt(i32 %0) {
%2 = alloca [21 x i8]
%3 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = call i32 @cgiURLAdd(i8* %3)
ret void
}
/* Variables and functions */
int getmax(int, int);
int getmin(int a, int b) {
  int rest;
  rest = a * b / getmax(a, b);
  return rest;
}


x86 assembly (clang, -O0):
<getmin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <getmax@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getmin>:
push   %rbx
mov    %esi,%ebx
imul   %edi,%ebx
call   1030 <getmax@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
pop    %rbx
ret

LLVM IR (-O0):
define i32 @getmin(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 = load i32, i32* %4
%8 = mul nsw i32 %6, %7
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 @getmax(i32 %9, i32 %10)
%12 = sdiv i32 %8, %11
store i32 %12, i32* %5
%13 = load i32, i32* %5
ret i32 %13
}

LLVM IR (-O2):
define i32 @getmin(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = tail call i32 @getmax(i32 %0, i32 %1)
%5 = sdiv i32 %3, %4
ret i32 %5
}
int cyclist_is_empty(struct cyclist *head) { return !head; }


x86 assembly (clang, -O0):
<cyclist_is_empty>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cyclist_is_empty>:
xor    %eax,%eax
test   %rdi,%rdi
sete   %al
ret

LLVM IR (-O0):
%struct.cyclist = type opaque
define i32 @cyclist_is_empty(%struct.cyclist* %0) {
%2 = alloca %struct.cyclist*
store %struct.cyclist* %0, %struct.cyclist** %2
%3 = load %struct.cyclist*, %struct.cyclist** %2
%4 = icmp ne %struct.cyclist* %3, null
%5 = xor i1 %4, true
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
%struct.cyclist = type opaque
define i32 @cyclist_is_empty(%struct.cyclist* readnone %0) {
%2 = icmp eq %struct.cyclist* %0, null
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
size_t fwrite(void const *, size_t, size_t, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
void fwrite_or_die(void const *ptr, size_t size, size_t nmemb, FILE *stream) {
  if (fwrite(ptr, size, nmemb, stream) != nmemb) {
    perror("fwrite failed");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<fwrite_or_die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1050 <fwrite@plt>
cmp    -0x18(%rbp),%rax
je     117d <fwrite_or_die+0x4d>
lea    0xe92(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fwrite_or_die>:
push   %rbx
mov    %rdx,%rbx
call   1050 <fwrite@plt>
cmp    %rbx,%rax
jne    1140 <fwrite_or_die+0x10>
pop    %rbx
ret
lea    0xeb9(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"fwrite failed\00"
define void @fwrite_or_die(i8* %0, i64 %1, i64 %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i32* %3, i32** %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i64, i64* %7
%12 = load i32*, i32** %8
%13 = call i64 @fwrite(i8* %9, i64 %10, i64 %11, i32* %12)
%14 = load i64, i64* %7
%15 = icmp ne i64 %13, %14
br i1 %15, label %16, label %19
16: ; preds = %4
%17 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"fwrite failed\00"
define void @fwrite_or_die(i8* nocapture %0, i64 %1, i64 %2, i32* nocapture %3) {
%5 = tail call i64 @fwrite(i8* %0, i64 %1, i64 %2, i32* %3)
%6 = icmp eq i64 %5, %2
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %4
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
void uninitar_fprintf(void) {
  FILE *stream;
  char *format;
  int argument;
  (void)fprintf(stream, format, argument);
}


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

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

LLVM IR (-O0):
define void @uninitar_fprintf() {
%1 = alloca i32*
%2 = alloca i8*
%3 = alloca i32
%4 = load i32*, i32** %1
%5 = load i8*, i8** %2
%6 = load i32, i32* %3
%7 = call i32 @fprintf(i32* %4, i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @uninitar_fprintf() {
%1 = tail call i32 @fprintf(i32* undef, i8* undef, i32 undef)
ret void
}
/* Type definitions */
typedef int u_short;

/* Variables and functions */
int htons(int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  u_short ns_port;
  ns_port = htons(3000);
  printf("ns_port = %04x\n", ns_port);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [16 x i8] c"ns_port = %04x\0A\00"
define i32 @main() {
%1 = tail call i32 @htons(i32 3000)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int divide(int a, int b) {
  assert(b);
  return a / b;
}


x86 assembly (clang, -O0):
<divide>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<divide>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    %esi,%edi
call   1030 <assert@plt>
mov    %ebp,%eax
cltd
idiv   %ebx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @divide(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i32 @assert(i32 %5)
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = sdiv i32 %7, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @divide(i32 %0, i32 %1) {
%3 = tail call i32 @assert(i32 %1)
%4 = sdiv i32 %0, %1
ret i32 %4
}
int test_imm_5Auint16_mem(unsigned short *val) {
  return ((*val) & (0x5A << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_5Auint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 90
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int leftShiftIntMasked(int v) { return ((v & 0xff00U) << 3); }


x86 assembly (clang, -O0):
<leftShiftIntMasked>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff00,%eax
shl    $0x3,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<leftShiftIntMasked>:
lea    0x0(,%rdi,8),%eax
and    $0x7f800,%eax
ret

LLVM IR (-O0):
define i32 @leftShiftIntMasked(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 65280
%5 = shl i32 %4, 3
ret i32 %5
}

LLVM IR (-O2):
define i32 @leftShiftIntMasked(i32 %0) {
%2 = shl i32 %0, 3
%3 = and i32 %2, 522240
ret i32 %3
}
int test_imm_59int32_reg(int val) { return ((val) & (0x59 << 0)) ? -20 : -40; }


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

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

LLVM IR (-O0):
define i32 @test_imm_59int32_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 89
%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_59int32_reg(i32 %0) {
%2 = and i32 %0, 89
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}