xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ is_txt(char);
int txt_len(char *s) {
  int i;
  for (i = 0; i < 0x100; i++) {
    if (!is_txt(s[i]))
      break;
  }
  return i;
}


x86 assembly (clang, -O0):
<txt_len>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x100,-0xc(%rbp)
jge    1162 <txt_len+0x52>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <is_txt@plt>
cmp    $0x0,%eax
jne    114f <txt_len+0x3f>
jmp    1162 <txt_len+0x52>
jmp    1154 <txt_len+0x44>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <txt_len+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<txt_len>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
movsbl (%r14,%rbx,1),%edi
call   1030 <is_txt@plt>
test   %eax,%eax
je     1140 <txt_len+0x30>
add    $0x1,%rbx
cmp    $0x100,%rbx
jne    1120 <txt_len+0x10>
mov    $0x100,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @txt_len(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %17, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 256
br i1 %6, label %7, label %20
7: ; preds = %4
%8 = load i8*, i8** %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
%13 = call i32 @is_txt(i8 signext %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %7
br label %20
16: ; preds = %7
br label %17
17: ; preds = %16
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %4
20: ; preds = %15, %4
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @txt_len(i8* nocapture %0) {
br label %2
2: ; preds = %1, %8
%3 = phi i64 [ 0, %1 ], [ %9, %8 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = tail call i32 @is_txt(i8 signext %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = add nuw nsw i64 %3, 1
%10 = icmp eq i64 %9, 256
br i1 %10, label %13, label %2
11: ; preds = %2
%12 = trunc i64 %3 to i32
br label %13
13: ; preds = %8, %11
%14 = phi i32 [ %12, %11 ], [ 256, %8 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ echo(char *);
main() { echo("Sup"); }


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"Sup\00"
define i32 @main() {
%1 = call i32 @echo(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"Sup\00"
define i32 @main() {
%1 = tail call i32 @echo(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void foo_2_2_2_2_1_2_1_2_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_2_2_2_2_1_2_1_2_2() {
ret void
}
int test_imm_F1uint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0xF1 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_F1uint64_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, 241
%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_F1uint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 241
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
scalar_t__ RAND_MAX;
scalar_t__ rand();
double frand() { return (double)rand() / (double)RAND_MAX; }


x86 assembly (clang, -O0):
<frand>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec1(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<frand>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec4(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define double @frand() {
%1 = call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fdiv double %2, %4
ret double %5
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define double @frand() {
%1 = tail call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fdiv double %2, %4
ret double %5
}
/* Variables and functions */
char *strdup(char const *);
char *String_copy(const char *orig) { return strdup(orig); }


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

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

LLVM IR (-O0):
define i8* @String_copy(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @strdup(i8* %3)
ret i8* %4
}

LLVM IR (-O2):
define noalias i8* @String_copy(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
ret i8* %2
}
long double dist3s(double x1, double y1, double z1, double x2, double y2,
                   double z2) {
  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2);
}


x86 assembly (clang, -O0):
<dist3s>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
subsd  %xmm2,%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
subsd  %xmm2,%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
fldl   -0x38(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<dist3s>:
subsd  %xmm3,%xmm0
subsd  %xmm4,%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
subsd  %xmm5,%xmm2
mulsd  %xmm2,%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,-0x8(%rsp)
fldl   -0x8(%rsp)
ret

LLVM IR (-O0):
define x86_fp80 @dist3s(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store double %5, double* %12
%13 = load double, double* %7
%14 = load double, double* %10
%15 = fsub double %13, %14
%16 = load double, double* %7
%17 = load double, double* %10
%18 = fsub double %16, %17
%19 = load double, double* %8
%20 = load double, double* %11
%21 = fsub double %19, %20
%22 = load double, double* %8
%23 = load double, double* %11
%24 = fsub double %22, %23
%25 = fmul double %21, %24
%26 = call double @llvm.fmuladd.f64(double %15, double %18, double %25)
%27 = load double, double* %9
%28 = load double, double* %12
%29 = fsub double %27, %28
%30 = load double, double* %9
%31 = load double, double* %12
%32 = fsub double %30, %31
%33 = call double @llvm.fmuladd.f64(double %29, double %32, double %26)
%34 = fpext double %33 to x86_fp80
ret x86_fp80 %34
}

LLVM IR (-O2):
define x86_fp80 @dist3s(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = fsub double %0, %3
%8 = fsub double %1, %4
%9 = fmul double %8, %8
%10 = tail call double @llvm.fmuladd.f64(double %7, double %7, double %9)
%11 = fsub double %2, %5
%12 = tail call double @llvm.fmuladd.f64(double %11, double %11, double %10)
%13 = fpext double %12 to x86_fp80
ret x86_fp80 %13
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void delete_mock_declaration_name(char *name) { free(name); }


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

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

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

LLVM IR (-O2):
define void @delete_mock_declaration_name(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Type definitions */
struct timespec {
  long tv_sec;
  long tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ nanosleep(struct timespec *, int /*<<< orphan*/ *);
void sleepms(long milliseconds) {
  struct timespec ts;
  ts.tv_sec = milliseconds / 1000;
  ts.tv_nsec = (milliseconds - (ts.tv_sec * 1000)) * 1000000L;
  nanosleep(&ts, NULL);
}


x86 assembly (clang, -O0):
<sleepms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x3e8,%ecx
cqto
idiv   %rcx
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3e8,-0x18(%rbp),%rcx
sub    %rcx,%rax
imul   $0xf4240,%rax,%rax
mov    %rax,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <nanosleep@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sleepms>:
sub    $0x18,%rsp
movabs $0x20c49ba5e353f7cf,%rcx
9b c4 20
mov    %rdi,%rax
imul   %rcx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x7,%rdx
add    %rax,%rdx
mov    %rdx,0x8(%rsp)
imul   $0xfffffffffffffc18,%rdx,%rax
add    %rdi,%rax
imul   $0xf4240,%rax,%rax
mov    %rax,0x10(%rsp)
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <nanosleep@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define void @sleepms(i64 %0) {
%2 = alloca i64
%3 = alloca %struct.timespec
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = sdiv i64 %4, 1000
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
store i64 %5, i64* %6
%7 = load i64, i64* %2
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
%9 = load i64, i64* %8
%10 = mul nsw i64 %9, 1000
%11 = sub nsw i64 %7, %10
%12 = mul nsw i64 %11, 1000000
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
store i64 %12, i64* %13
%14 = call i32 @nanosleep(%struct.timespec* %3, i32* null)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
define void @sleepms(i64 %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
%4 = sdiv i64 %0, 1000
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
store i64 %4, i64* %5
%6 = mul nsw i64 %4, -1000
%7 = add i64 %6, %0
%8 = mul nsw i64 %7, 1000000
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
store i64 %8, i64* %9
%10 = call i32 @nanosleep(%struct.timespec* %2, i32* null)
ret void
}
int expression(int level) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @expression(i32 %0) {
ret i32 0
}
/* Variables and functions */
int count_in_array(int *array, size_t length) { return 0; }


x86 assembly (clang, -O0):
<count_in_array>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @count_in_array(i32* nocapture readnone %0, i64 %1) {
ret i32 0
}
/* Variables and functions */
size_t PartitionErAlgorithmIR(int /*<<< orphan*/, int *, int *, size_t,
                              int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(size_t);
size_t PartitionErAlgorithmI(int *val, size_t n) {
  size_t count;
  int *sol = (int *)malloc(n * sizeof(int));
  count = PartitionErAlgorithmIR(0, val, sol, n, 0, 0);
  free(sol);
  return (count);
}


x86 assembly (clang, -O0):
<PartitionErAlgorithmI>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
shl    $0x2,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rcx
xor    %r9d,%r9d
mov    %r9d,%edi
mov    %r9d,%r8d
call   1050 <PartitionErAlgorithmIR@plt>
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PartitionErAlgorithmI>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0x0(,%rsi,4),%rdi
call   1040 <malloc@plt>
mov    %rax,%r15
xor    %edi,%edi
mov    %r14,%rsi
mov    %rax,%rdx
mov    %rbx,%rcx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1050 <PartitionErAlgorithmIR@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @PartitionErAlgorithmI(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32*
store i32* %0, i32** %3
store i64 %1, i64* %4
%7 = load i64, i64* %4
%8 = mul i64 %7, 4
%9 = call i64 @malloc(i64 %8)
%10 = inttoptr i64 %9 to i32*
store i32* %10, i32** %6
%11 = load i32*, i32** %3
%12 = load i32*, i32** %6
%13 = load i64, i64* %4
%14 = call i64 @PartitionErAlgorithmIR(i32 0, i32* %11, i32* %12, i64 %13, i32 0, i32 0)
store i64 %14, i64* %5
%15 = load i32*, i32** %6
%16 = call i32 @free(i32* %15)
%17 = load i64, i64* %5
ret i64 %17
}

LLVM IR (-O2):
define i64 @PartitionErAlgorithmI(i32* %0, i64 %1) {
%3 = shl i64 %1, 2
%4 = tail call i64 @malloc(i64 %3)
%5 = inttoptr i64 %4 to i32*
%6 = tail call i64 @PartitionErAlgorithmIR(i32 0, i32* %0, i32* %5, i64 %1, i32 0, i32 0)
%7 = tail call i32 @free(i32* %5)
ret i64 %6
}
int test_imm_3Fuint16_mem(unsigned short *val) {
  return ((*val) & (0x3F << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_3Fuint16_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, 63
%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_3Fuint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 63
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int test_imm_49uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x49 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_49uint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 16
%6 = and i64 %5, 73
%7 = icmp ne i64 %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_49uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 4784128
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void swap_chars(char *s1, int x, int y) {
  char tmp = s1[x];
  s1[x] = s1[y];
  s1[y] = tmp;
}


x86 assembly (clang, -O0):
<swap_chars>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x11(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_chars>:
movslq %esi,%rax
mov    (%rdi,%rax,1),%sil
movslq %edx,%rdx
mov    (%rdi,%rdx,1),%cl
mov    %cl,(%rdi,%rax,1)
mov    %sil,(%rdi,%rdx,1)
ret

LLVM IR (-O0):
define void @swap_chars(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
store i8 %12, i8* %7
%13 = load i8*, i8** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = load i8*, i8** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 %17, i8* %21
%22 = load i8, i8* %7
%23 = load i8*, i8** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
store i8 %22, i8* %26
ret void
}

LLVM IR (-O2):
define void @swap_chars(i8* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
store i8 %9, i8* %5
store i8 %6, i8* %8
ret void
}
/* Type definitions */
struct aFILE {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _get_actual_fp(struct aFILE *);
int putw(int, int /*<<< orphan*/);
int my_putw(int w, struct aFILE *fp) { return putw(w, _get_actual_fp(fp)); }


x86 assembly (clang, -O0):
<my_putw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <_get_actual_fp@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
call   1030 <putw@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_putw>:
push   %rbx
mov    %edi,%ebx
mov    %rsi,%rdi
call   1040 <_get_actual_fp@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1030 <putw@plt>

LLVM IR (-O0):
%struct.aFILE = type { i32 }
define i32 @my_putw(i32 %0, %struct.aFILE* %1) {
%3 = alloca i32
%4 = alloca %struct.aFILE*
store i32 %0, i32* %3
store %struct.aFILE* %1, %struct.aFILE** %4
%5 = load i32, i32* %3
%6 = load %struct.aFILE*, %struct.aFILE** %4
%7 = call i32 @_get_actual_fp(%struct.aFILE* %6)
%8 = call i32 @putw(i32 %5, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
%struct.aFILE = type { i32 }
define i32 @my_putw(i32 %0, %struct.aFILE* %1) {
%3 = tail call i32 @_get_actual_fp(%struct.aFILE* %1)
%4 = tail call i32 @putw(i32 %0, i32 %3)
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ ptr;

/* Variables and functions */
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ read(int /*<<< orphan*/, char **, int);
char *read_ptr() {
  char *ptr = 0;
  read(STDIN_FILENO, &ptr, sizeof(ptr));
  return ptr;
}


x86 assembly (clang, -O0):
<read_ptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
mov    $0x8,%edx
call   1030 <read@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_ptr>:
push   %rax
movq   $0x0,(%rsp)
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
mov    $0x8,%edx
call   1030 <read@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
@STDIN_FILENO = global i32 0
define i8* @read_ptr() {
%1 = alloca i8*
store i8* null, i8** %1
%2 = load i32, i32* @STDIN_FILENO
%3 = call i32 @read(i32 %2, i8** %1, i32 8)
%4 = load i8*, i8** %1
ret i8* %4
}

LLVM IR (-O2):
@STDIN_FILENO = global i32 0
define i8* @read_ptr() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
store i8* null, i8** %1
%3 = load i32, i32* @STDIN_FILENO
%4 = call i32 @read(i32 %3, i8** %1, i32 8)
%5 = load i8*, i8** %1
ret i8* %5
}
unsigned long int net2long(unsigned char **bufp) {
  long int l;
  l = **bufp;
  l <<= 8;
  l |= *(*bufp + 1);
  l <<= 8;
  l |= *(*bufp + 2);
  l <<= 8;
  l |= *(*bufp + 3);
  *bufp += 4;
  return l;
}


x86 assembly (clang, -O0):
<net2long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movzbl (%rax),%eax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movzbl 0x1(%rax),%eax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movzbl 0x2(%rax),%eax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movzbl 0x3(%rax),%eax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x4,%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<net2long>:
mov    (%rdi),%rcx
mov    (%rcx),%eax
shl    $0x20,%rax
bswap  %rax
add    $0x4,%rcx
mov    %rcx,(%rdi)
ret

LLVM IR (-O0):
define i64 @net2long(i8** %0) {
%2 = alloca i8**
%3 = alloca i64
store i8** %0, i8*** %2
%4 = load i8**, i8*** %2
%5 = load i8*, i8** %4
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
store i64 %7, i64* %3
%8 = load i64, i64* %3
%9 = shl i64 %8, 8
store i64 %9, i64* %3
%10 = load i8**, i8*** %2
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
%14 = zext i8 %13 to i64
%15 = load i64, i64* %3
%16 = or i64 %15, %14
store i64 %16, i64* %3
%17 = load i64, i64* %3
%18 = shl i64 %17, 8
store i64 %18, i64* %3
%19 = load i8**, i8*** %2
%20 = load i8*, i8** %19
%21 = getelementptr inbounds i8, i8* %20, i64 2
%22 = load i8, i8* %21
%23 = zext i8 %22 to i64
%24 = load i64, i64* %3
%25 = or i64 %24, %23
store i64 %25, i64* %3
%26 = load i64, i64* %3
%27 = shl i64 %26, 8
store i64 %27, i64* %3
%28 = load i8**, i8*** %2
%29 = load i8*, i8** %28
%30 = getelementptr inbounds i8, i8* %29, i64 3
%31 = load i8, i8* %30
%32 = zext i8 %31 to i64
%33 = load i64, i64* %3
%34 = or i64 %33, %32
store i64 %34, i64* %3
%35 = load i8**, i8*** %2
%36 = load i8*, i8** %35
%37 = getelementptr inbounds i8, i8* %36, i64 4
store i8* %37, i8** %35
%38 = load i64, i64* %3
ret i64 %38
}

LLVM IR (-O2):
define i64 @net2long(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = zext i8 %3 to i64
%5 = getelementptr inbounds i8, i8* %2, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
%8 = shl nuw nsw i64 %4, 16
%9 = shl nuw nsw i64 %7, 8
%10 = or i64 %9, %8
%11 = getelementptr inbounds i8, i8* %2, i64 2
%12 = load i8, i8* %11
%13 = zext i8 %12 to i64
%14 = or i64 %10, %13
%15 = shl nuw nsw i64 %14, 8
%16 = getelementptr inbounds i8, i8* %2, i64 3
%17 = load i8, i8* %16
%18 = zext i8 %17 to i64
%19 = or i64 %15, %18
%20 = getelementptr inbounds i8, i8* %2, i64 4
store i8* %20, i8** %0
ret i64 %19
}
void test() {
#pragma omp master
  ;
}


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

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

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

LLVM IR (-O2):
define void @test() {
ret void
}
/* Variables and functions */
int errno;
long long strtoll(char const *, char **, int /*<<< orphan*/);
int conf_parse_int_internal(const char *lvalue, const char *rvalue,
                            long long int *result) {
  int err = 0, save_errno;
  char *endptr;
  (void)lvalue;
  save_errno = errno;
  errno = 0;
  *result = strtoll(rvalue, &endptr, 0);
  if (errno != 0) {
    err = -errno;
  }
  errno = save_errno;
  return err;
}


x86 assembly (clang, -O0):
<conf_parse_int_internal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2ea2(%rip),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
xor    %edx,%edx
call   1030 <strtoll@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    0x2e7c(%rip),%rax
cmpl   $0x0,(%rax)
je     117b <conf_parse_int_internal+0x6b>
xor    %eax,%eax
mov    0x2e6a(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%ecx
mov    0x2e5b(%rip),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<conf_parse_int_internal>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rdi
mov    0x2ebc(%rip),%rbx
mov    (%rbx),%r15d
movl   $0x0,(%rbx)
mov    %rsp,%rsi
xor    %ebp,%ebp
xor    %edx,%edx
call   1030 <strtoll@plt>
mov    %rax,(%r14)
sub    (%rbx),%ebp
mov    %r15d,(%rbx)
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @conf_parse_int_internal(i8* %0, i8* %1, i64* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64* %2, i64** %6
store i32 0, i32* %7
%10 = load i8*, i8** %4
%11 = load i32, i32* @errno
store i32 %11, i32* %8
store i32 0, i32* @errno
%12 = load i8*, i8** %5
%13 = call i64 @strtoll(i8* %12, i8** %9, i32 0)
%14 = load i64*, i64** %6
store i64 %13, i64* %14
%15 = load i32, i32* @errno
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %3
%18 = load i32, i32* @errno
%19 = sub nsw i32 0, %18
store i32 %19, i32* %7
br label %20
20: ; preds = %17, %3
%21 = load i32, i32* %8
store i32 %21, i32* @errno
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @conf_parse_int_internal(i8* nocapture readnone %0, i8* %1, i64* nocapture writeonly %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = load i32, i32* @errno
store i32 0, i32* @errno
%7 = call i64 @strtoll(i8* %1, i8** %4, i32 0)
store i64 %7, i64* %2
%8 = load i32, i32* @errno
%9 = sub nsw i32 0, %8
store i32 %6, i32* @errno
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
int main() {
  int a = 9;
  int b = 3;
  printf("hello. %d + %d = %d\n", a, b, a + b);
  char msg[17];
  sprintf(msg, "hellooo %d", a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x9,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x4(%rbp),%ecx
add    -0x8(%rbp),%ecx
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xeb9(%rip),%rsi
call   1040 <sprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
mov    $0x9,%esi
mov    $0x3,%edx
mov    $0xc,%ecx
call   1030 <printf@plt>
lea    0xecf(%rip),%rsi
mov    %rsp,%rdi
mov    $0x9,%edx
call   1040 <sprintf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"hello. %d + %d = %d\0A\00"
@.str.1 = [11 x i8] c"hellooo %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [17 x i8]
store i32 9, i32* %1
store i32 3, i32* %2
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = add nsw i32 %6, %7
%9 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5, i32 %8)
%10 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%11 = load i32, i32* %1
%12 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"hello. %d + %d = %d\0A\00"
@.str.1 = [11 x i8] c"hellooo %d\00"
define i32 @main() {
%1 = alloca [17 x i8]
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 9, i32 3, i32 12)
%3 = getelementptr inbounds [17 x i8], [17 x i8]* %1, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 9)
ret i32 0
}
/* Variables and functions */
void *memset(void *p, int c, size_t n) {
  unsigned char *x = p;
  int i;
  for (i = 0; i < n; i++)
    x[n] = c;
  return p;
}


x86 assembly (clang, -O0):
<memset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    114a <memset+0x4a>
mov    -0xc(%rbp),%eax
mov    %al,%dl
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    111e <memset+0x1e>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memset>:
mov    %rdi,%rax
test   %rdx,%rdx
je     110c <memset+0xc>
mov    %sil,(%rax,%rdx,1)
ret

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

LLVM IR (-O2):
define i8* @memset(i8* returned writeonly %0, i32 %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = trunc i32 %1 to i8
%7 = getelementptr inbounds i8, i8* %0, i64 %2
store i8 %6, i8* %7
br label %8
8: ; preds = %5, %3
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int help() {
  puts("\nhttps-proxy [options]\n\n"
       "\t-c config  Configuration file to use\n"
       "\t-h         Print this help\n"
       "\t-s3        Allow SSLv3 (otherwise only TLSv1)\n"
       "\t-l         List allowed hosts");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [168 x i8] c"\0Ahttps-proxy [options]\0A\0A\09-c config Configuration file to use\0A\09-h Print this help\0A\09-s3 Allow SSLv3 (otherwise only TLSv1)\0A\09-l List allowed hosts\00"
define i32 @help() {
%1 = call i32 @puts(i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [168 x i8] c"\0Ahttps-proxy [options]\0A\0A\09-c config Configuration file to use\0A\09-h Print this help\0A\09-s3 Allow SSLv3 (otherwise only TLSv1)\0A\09-l List allowed hosts\00"
define i32 @help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void xdebug_close_socket(int socket) { close(socket); }


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

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

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

LLVM IR (-O2):
define void @xdebug_close_socket(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
int CaptureWatchPrints(void *theEnv, const char *logName, const char *str) {
  return (1);
}


x86 assembly (clang, -O0):
<CaptureWatchPrints>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @CaptureWatchPrints(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
ret i32 1
}

LLVM IR (-O2):
define i32 @CaptureWatchPrints(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int, unsigned int, unsigned int);
unsigned int sleep(unsigned int);
unsigned int snooze(unsigned int secs) {
  unsigned sleep_secs, reserve_secs;
  reserve_secs = sleep(secs);
  sleep_secs = secs - reserve_secs;
  printf("Slept for %u of %u secs\t\t"
         "User hits ctrl-c after %u seconds\n",
         sleep_secs, secs, sleep_secs);
  return reserve_secs;
}


x86 assembly (clang, -O0):
<snooze>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <sleep@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<snooze>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1040 <sleep@plt>
mov    %eax,%ebp
mov    %ebx,%ecx
sub    %eax,%ecx
lea    0xec9(%rip),%rdi
mov    %ecx,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [60 x i8] c"Slept for %u of %u secs\09\09User hits ctrl-c after %u seconds\0A\00"
define i32 @snooze(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @sleep(i32 %5)
store i32 %6, i32* %4
%7 = load i32, i32* %2
%8 = load i32, i32* %4
%9 = sub i32 %7, %8
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11, i32 %12)
%14 = load i32, i32* %4
ret i32 %14
}

LLVM IR (-O2):
@.str = [60 x i8] c"Slept for %u of %u secs\09\09User hits ctrl-c after %u seconds\0A\00"
define i32 @snooze(i32 %0) {
%2 = tail call i32 @sleep(i32 %0)
%3 = sub i32 %0, %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %0, i32 %3)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ flusho();
int /*<<< orphan*/ read(int, char *, int);
void n_ptpause(void) {
  char junk;
  flusho();
  read(2, &junk, 1);
}


x86 assembly (clang, -O0):
<n_ptpause>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <flusho@plt>
mov    $0x2,%edi
lea    -0x1(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<n_ptpause>:
push   %rax
xor    %eax,%eax
call   1040 <flusho@plt>
lea    0x7(%rsp),%rsi
mov    $0x2,%edi
mov    $0x1,%edx
call   1030 <read@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @n_ptpause() {
%1 = alloca i8
%2 = call i32 (...) @flusho()
%3 = call i32 @read(i32 2, i8* %1, i32 1)
ret void
}

LLVM IR (-O2):
define void @n_ptpause() {
%1 = alloca i8
%2 = tail call i32 (...) @flusho()
%3 = call i32 @read(i32 2, i8* %1, i32 1)
ret void
}
/* Variables and functions */
int nrf_read_register(int, char *, char *);
int nrf_write_register(int, char, char *);
int nrf_clear_max_rt(char *retstatus) {
  int ret;
  char statusreg;
  ret = nrf_read_register(0x07, &statusreg, retstatus);
  if (ret < 0)
    return ret;
  statusreg |= 0x10;
  ret = nrf_write_register(0x07, statusreg, retstatus);
  return ret;
}


x86 assembly (clang, -O0):
<nrf_clear_max_rt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
mov    $0x7,%edi
lea    -0x15(%rbp),%rsi
call   1040 <nrf_read_register@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1156 <nrf_clear_max_rt+0x36>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117d <nrf_clear_max_rt+0x5d>
movsbl -0x15(%rbp),%eax
or     $0x10,%eax
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
mov    -0x10(%rbp),%rdx
mov    $0x7,%edi
movsbl %al,%esi
call   1030 <nrf_write_register@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nrf_clear_max_rt>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xf(%rsp),%rsi
mov    $0x7,%edi
mov    %rbx,%rdx
call   1040 <nrf_read_register@plt>
test   %eax,%eax
js     1158 <nrf_clear_max_rt+0x38>
movsbl 0xf(%rsp),%esi
or     $0x10,%esi
mov    %sil,0xf(%rsp)
mov    $0x7,%edi
mov    %rbx,%rdx
call   1030 <nrf_write_register@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @nrf_clear_max_rt(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @nrf_read_register(i32 7, i8* %5, i8* %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load i32, i32* %4
store i32 %11, i32* %2
br label %21
12: ; preds = %1
%13 = load i8, i8* %5
%14 = sext i8 %13 to i32
%15 = or i32 %14, 16
%16 = trunc i32 %15 to i8
store i8 %16, i8* %5
%17 = load i8, i8* %5
%18 = load i8*, i8** %3
%19 = call i32 @nrf_write_register(i32 7, i8 signext %17, i8* %18)
store i32 %19, i32* %4
%20 = load i32, i32* %4
store i32 %20, i32* %2
br label %21
21: ; preds = %12, %10
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @nrf_clear_max_rt(i8* %0) {
%2 = alloca i8
%3 = call i32 @nrf_read_register(i32 7, i8* %2, i8* %0)
%4 = icmp slt i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = load i8, i8* %2
%7 = or i8 %6, 16
store i8 %7, i8* %2
%8 = call i32 @nrf_write_register(i32 7, i8 signext %7, i8* %0)
br label %9
9: ; preds = %1, %5
%10 = phi i32 [ %8, %5 ], [ %3, %1 ]
ret i32 %10
}
void grx(char *n, char l, void (*fn)(char *, char)) {
  if (l >= 8 * 8) {
    return;
  }
  (*fn)(n, l);
  grx(n, l << 1, fn);
}


x86 assembly (clang, -O0):
<grx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %rdx,-0x18(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x40,%eax
jl     1138 <grx+0x28>
jmp    115d <grx+0x4d>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   *%rax
mov    -0x8(%rbp),%rdi
movsbl -0x9(%rbp),%eax
shl    $0x1,%eax
mov    -0x18(%rbp),%rdx
movsbl %al,%esi
call   1030 <grx@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<grx>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
cmp    $0x3f,%bpl
jg     1135 <grx+0x35>
mov    %rdx,%r14
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %bpl,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
call   *%r14
add    %bpl,%bpl
cmp    $0x40,%bpl
jl     1120 <grx+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @grx(i8* %0, i8 signext %1, void (i8*, i8)* %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca void (i8*, i8)*
store i8* %0, i8** %4
store i8 %1, i8* %5
store void (i8*, i8)* %2, void (i8*, i8)** %6
%7 = load i8, i8* %5
%8 = sext i8 %7 to i32
%9 = icmp sge i32 %8, 64
br i1 %9, label %10, label %11
10: ; preds = %3
br label %21
11: ; preds = %3
%12 = load void (i8*, i8)*, void (i8*, i8)** %6
%13 = load i8*, i8** %4
%14 = load i8, i8* %5
%15 = load i8*, i8** %4
%16 = load i8, i8* %5
%17 = sext i8 %16 to i32
%18 = shl i32 %17, 1
%19 = trunc i32 %18 to i8
%20 = load void (i8*, i8)*, void (i8*, i8)** %6
br label %21
21: ; preds = %11, %10
ret void
}

LLVM IR (-O2):
define void @grx(i8* %0, i8 signext %1, void (i8*, i8)* nocapture %2) {
%4 = icmp sgt i8 %1, 63
br i1 %4, label %9, label %5
5: ; preds = %3, %5
%6 = phi i8 [ %7, %5 ], [ %1, %3 ]
tail call void %2(i8* %0, i8 signext %6)
%7 = shl i8 %6, 1
%8 = icmp sgt i8 %7, 63
br i1 %8, label %9, label %5
9: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  printf("%lld\n", (argc - 100LL) >> 38);
  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)
movslq -0x8(%rbp),%rax
sub    $0x64,%rax
sar    $0x26,%rax
mov    %eax,%esi
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movslq %edi,%rsi
add    $0xffffffffffffff9c,%rsi
sar    $0x26,%rsi
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%lld\0A\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 = sext i32 %6 to i64
%8 = sub nsw i64 %7, 100
%9 = ashr i64 %8, 38
%10 = trunc i64 %9 to i32
%11 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%lld\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = sext i32 %0 to i64
%4 = add nsw i64 %3, -100
%5 = ashr i64 %4, 38
%6 = trunc i64 %5 to i32
%7 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}
int do_529() { return 529; }


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

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

LLVM IR (-O0):
define i32 @do_529() {
ret i32 529
}

LLVM IR (-O2):
define i32 @do_529() {
ret i32 529
}
int cvmx_pko_get_num_queues(int port) { return port; }


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

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

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

LLVM IR (-O2):
define i32 @cvmx_pko_get_num_queues(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
void nogr_put(int x, int y, int tile) {
  printf("Put %d at (%d, %d).\n", tile, x, y);
}


x86 assembly (clang, -O0):
<nogr_put>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nogr_put>:
mov    %esi,%ecx
mov    %edi,%eax
lea    0xee5(%rip),%rdi
mov    %edx,%esi
mov    %eax,%edx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Put %d at (%d, %d).\0A\00"
define void @nogr_put(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Put %d at (%d, %d).\0A\00"
define void @nogr_put(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %0, i32 %1)
ret void
}
int pthread_atfork(void (*prepare)(void), void (*parent)(void),
                   void (*child)(void)) {
  return 0;
}


x86 assembly (clang, -O0):
<pthread_atfork>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @pthread_atfork(void ()* %0, void ()* %1, void ()* %2) {
%4 = alloca void ()*
%5 = alloca void ()*
%6 = alloca void ()*
store void ()* %0, void ()** %4
store void ()* %1, void ()** %5
store void ()* %2, void ()** %6
ret i32 0
}

LLVM IR (-O2):
define i32 @pthread_atfork(void ()* nocapture readnone %0, void ()* nocapture readnone %1, void ()* nocapture readnone %2) {
ret i32 0
}
void posix_class2P_CNTRL() {}


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

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

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

LLVM IR (-O2):
define void @posix_class2P_CNTRL() {
ret void
}
/* Variables and functions */
long read_int_from_file(char *);
int battery_percent() {
  long int full_bat;
  long int now_bat;
  full_bat = read_int_from_file("/sys/class/power_supply/BAT1/charge_full");
  now_bat = read_int_from_file("/sys/class/power_supply/BAT1/charge_now");
  return now_bat * 100 / full_bat;
}


x86 assembly (clang, -O0):
<battery_percent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <read_int_from_file@plt>
mov    %rax,-0x8(%rbp)
lea    0xefa(%rip),%rdi
call   1030 <read_int_from_file@plt>
mov    %rax,-0x10(%rbp)
imul   $0x64,-0x10(%rbp),%rax
cqto
idivq  -0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<battery_percent>:
push   %rbx
lea    0xee8(%rip),%rdi
call   1030 <read_int_from_file@plt>
mov    %rax,%rbx
lea    0xf02(%rip),%rdi
call   1030 <read_int_from_file@plt>
imul   $0x64,%rax,%rax
mov    %rbx,%rcx
or     %rax,%rcx
shr    $0x20,%rcx
je     1143 <battery_percent+0x33>
cqto
idiv   %rbx
pop    %rbx
ret
xor    %edx,%edx
div    %ebx
pop    %rbx
ret

LLVM IR (-O0):
@.str = [41 x i8] c"/sys/class/power_supply/BAT1/charge_full\00"
@.str.1 = [40 x i8] c"/sys/class/power_supply/BAT1/charge_now\00"
define i32 @battery_percent() {
%1 = alloca i64
%2 = alloca i64
%3 = call i64 @read_int_from_file(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
store i64 %3, i64* %1
%4 = call i64 @read_int_from_file(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
store i64 %4, i64* %2
%5 = load i64, i64* %2
%6 = mul nsw i64 %5, 100
%7 = load i64, i64* %1
%8 = sdiv i64 %6, %7
%9 = trunc i64 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
@.str = [41 x i8] c"/sys/class/power_supply/BAT1/charge_full\00"
@.str.1 = [40 x i8] c"/sys/class/power_supply/BAT1/charge_now\00"
define i32 @battery_percent() {
%1 = tail call i64 @read_int_from_file(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%2 = tail call i64 @read_int_from_file(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%3 = mul nsw i64 %2, 100
%4 = sdiv i64 %3, %1
%5 = trunc i64 %4 to i32
ret i32 %5
}