xunge/DecIR huggingface dataset:
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int /*<<< orphan*/ *display;
};
struct TYPE_4__ {
  TYPE_1__ xerror;
};
typedef TYPE_2__ XEvent;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
void set_XEvent_xerror_display(void *_p, void *_v) {
  ((XEvent *)_p)->xerror.display = (Display *)_v;
}


x86 assembly (clang, -O0):
<set_XEvent_xerror_display>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XEvent_xerror_display>:
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32* }
define void @set_XEvent_xerror_display(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i32*
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to %struct.TYPE_4__*
%9 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %8, i32 0, i32 0
%10 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %9, i32 0, i32 0
store i32* %6, i32** %10
ret void
}

LLVM IR (-O2):
define void @set_XEvent_xerror_display(i8* nocapture writeonly %0, i8* %1) {
%3 = bitcast i8* %0 to i8**
store i8* %1, i8** %3
ret void
}
/* Variables and functions */
scalar_t__ is_alpha(char);
scalar_t__ is_numeric(char);
int is_alphanumeric(char c) { return is_alpha(c) || is_numeric(c); }


x86 assembly (clang, -O0):
<is_alphanumeric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <is_alpha@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    115c <is_alphanumeric+0x3c>
movsbl -0x1(%rbp),%edi
call   1030 <is_numeric@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_alphanumeric>:
push   %rbx
mov    %edi,%ebx
call   1040 <is_alpha@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1137 <is_alphanumeric+0x17>
pop    %rbx
ret
movsbl %bl,%edi
call   1030 <is_numeric@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_alphanumeric(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @is_alpha(i8 signext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = call i64 @is_numeric(i8 signext %7)
%9 = icmp ne i64 %8, 0
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @is_alphanumeric(i8 signext %0) {
%2 = tail call i64 @is_alpha(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @is_numeric(i8 signext %0)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
double pow(double, int);
double TriPyramid(double EdgeLength) {
  double SArea;
  SArea = pow(3, .5) * pow(EdgeLength, 2);
  return SArea;
}


x86 assembly (clang, -O0):
<TriPyramid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
xor    %edi,%edi
call   1030 <pow@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TriPyramid>:
sub    $0x18,%rsp
movsd  %xmm0,0x10(%rsp)
movsd  0xede(%rip),%xmm0
xor    %edi,%edi
call   1030 <pow@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @TriPyramid(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = call double @pow(double 3.000000e+00, i32 0)
%5 = load double, double* %2
%6 = call double @pow(double %5, i32 2)
%7 = fmul double %4, %6
store double %7, double* %3
%8 = load double, double* %3
ret double %8
}

LLVM IR (-O2):
define double @TriPyramid(double %0) {
%2 = tail call double @pow(double 3.000000e+00, i32 0)
%3 = tail call double @pow(double %0, i32 2)
%4 = fmul double %2, %3
ret double %4
}
/* Variables and functions */
int noOfWays(int);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int sum = 100;
  int n = noOfWays(sum);
  printf("Number of ways to reach %d is : %d\n", sum, n);
  return 1;
}


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

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

LLVM IR (-O0):
@.str = [36 x i8] c"Number of ways to reach %d is : %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 100, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @noOfWays(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
ret i32 1
}

LLVM IR (-O2):
@.str = [36 x i8] c"Number of ways to reach %d is : %d\0A\00"
define i32 @main() {
%1 = tail call i32 @noOfWays(i32 100)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 100, i32 %1)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void a(void) {
  int a = 1337;
  printf("a: %d", a);
}


x86 assembly (clang, -O0):
<a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x539,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a>:
lea    0xee9(%rip),%rdi
mov    $0x539,%esi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"a: %d\00"
define void @a() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 1337)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_did(uint8_t *d) {
  for (uint8_t i = 0; i < 5; i++)
    printf("%02x", d[i]);
}


x86 assembly (clang, -O0):
<print_did>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    1152 <print_did+0x42>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <print_did+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_did>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%esi
lea    0xee0(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x4(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x8(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0xc(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x10(%rbx),%esi
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%02x\00"
define void @print_did(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
br label %4
4: ; preds = %14, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 5
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = load i32*, i32** %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %7
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %4
17: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%02x\00"
define void @print_did(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds i32, i32* %0, i64 2
%8 = load i32, i32* %7
%9 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds i32, i32* %0, i64 3
%11 = load i32, i32* %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds i32, i32* %0, i64 4
%14 = load i32, i32* %13
%15 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %14)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ uartTx(char *, int);
void lcdScrollLeft() { uartTx("\xFE\x18", 2); }


x86 assembly (clang, -O0):
<lcdScrollLeft>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x2,%esi
call   1030 <uartTx@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcdScrollLeft>:
lea    0xee9(%rip),%rdi
mov    $0x2,%esi
jmp    1030 <uartTx@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"\FE\18\00"
define void @lcdScrollLeft() {
%1 = call i32 @uartTx(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"\FE\18\00"
define void @lcdScrollLeft() {
%1 = tail call i32 @uartTx(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
ret void
}
void NES_PRG_INSERT(char *PRG, int counter, int data) { PRG[counter] = data; }


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

x86 assembly (clang, -O2):
<NES_PRG_INSERT>:
movslq %esi,%rax
mov    %dl,(%rdi,%rax,1)
ret

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

LLVM IR (-O2):
define void @NES_PRG_INSERT(i8* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = trunc i32 %2 to i8
%5 = sext i32 %1 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 %4, i8* %6
ret void
}
float i1(float x) { return x * (x <= 0.f ? 1.f : -1.f); }


x86 assembly (clang, -O0):
<i1>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
movss  0xee5(%rip),%xmm4
movss  0xee1(%rip),%xmm3
xorps  %xmm2,%xmm2
cmpless %xmm2,%xmm1
movaps %xmm1,%xmm2
andps  %xmm4,%xmm2
andnps %xmm3,%xmm1
orps   %xmm2,%xmm1
mulss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<i1>:
movaps 0xef9(%rip),%xmm1
xorps  %xmm0,%xmm1
xorps  %xmm2,%xmm2
movaps %xmm0,%xmm3
cmpless %xmm2,%xmm3
andps  %xmm3,%xmm0
andnps %xmm1,%xmm3
orps   %xmm3,%xmm0
ret

LLVM IR (-O0):
define float @i1(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = load float, float* %2
%5 = fcmp ole float %4, 0.000000e+00
%6 = zext i1 %5 to i64
%7 = select i1 %5, float 1.000000e+00, float -1.000000e+00
%8 = fmul float %3, %7
ret float %8
}

LLVM IR (-O2):
define float @i1(float %0) {
%2 = fcmp ole float %0, 0.000000e+00
%3 = fneg float %0
%4 = select i1 %2, float %0, float %3
ret float %4
}
/* Variables and functions */
int IN(int);
volatile unsigned char spiEmptyOut(void) { return IN(0x01) & (1 << 2) ? 1 : 0; }


x86 assembly (clang, -O0):
<spiEmptyOut>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <IN@plt>
mov    %eax,%edx
and    $0x4,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<spiEmptyOut>:
push   %rax
mov    $0x1,%edi
call   1030 <IN@plt>
shr    $0x2,%al
and    $0x1,%al
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i8 @spiEmptyOut() {
%1 = call i32 @IN(i32 1)
%2 = and i32 %1, 4
%3 = icmp ne i32 %2, 0
%4 = zext i1 %3 to i64
%5 = select i1 %3, i32 1, i32 0
%6 = trunc i32 %5 to i8
ret i8 %6
}

LLVM IR (-O2):
define zeroext i8 @spiEmptyOut() {
%1 = tail call i32 @IN(i32 1)
%2 = trunc i32 %1 to i8
%3 = lshr i8 %2, 2
%4 = and i8 %3, 1
ret i8 %4
}
/* Variables and functions */
int kalle(int);
int anka(int i) {
  if (i <= 0)
    return 1;
  else
    return kalle(i - 1);
}


x86 assembly (clang, -O0):
<anka>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     1131 <anka+0x21>
movl   $0x1,-0x4(%rbp)
jmp    113f <anka+0x2f>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <kalle@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<anka>:
test   %edi,%edi
jle    111c <anka+0xc>
add    $0xffffffff,%edi
jmp    1030 <kalle@plt>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @anka(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = add nsw i32 %0, -1
%5 = tail call i32 @kalle(i32 %4)
br label %6
6: ; preds = %1, %3
%7 = phi i32 [ %5, %3 ], [ 1, %1 ]
ret i32 %7
}
unsigned int test_09(unsigned int a) { return (a >> 31) ^ 1; }


x86 assembly (clang, -O0):
<test_09>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1f,%eax
xor    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_09>:
mov    %edi,%eax
not    %eax
shr    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @test_09(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 31
%5 = xor i32 %4, 1
ret i32 %5
}

LLVM IR (-O2):
define i32 @test_09(i32 %0) {
%2 = xor i32 %0, -1
%3 = lshr i32 %2, 31
ret i32 %3
}
/* Variables and functions */
size_t make_size(int i) { return (1 << i) * 1024; }


x86 assembly (clang, -O0):
<make_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
shl    $0xa,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_size>:
mov    %edi,%ecx
mov    $0x400,%eax
shl    %cl,%eax
cltq
ret

LLVM IR (-O0):
define i64 @make_size(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 1, %3
%5 = mul nsw i32 %4, 1024
%6 = sext i32 %5 to i64
ret i64 %6
}

LLVM IR (-O2):
define i64 @make_size(i32 %0) {
%2 = shl i32 1024, %0
%3 = sext i32 %2 to i64
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
yyerror() {
  printf("Invalid Reqular Expression!! Exiting...\n");
  exit(1);
}


x86 assembly (clang, -O0):
<yyerror>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<yyerror>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"Invalid Reqular Expression!! Exiting...\0A\00"
define i32 @yyerror() {
%1 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [40 x i8] c"Invalid Reqular Expression!! Exiting...\00"
define i32 @yyerror() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
void test_forward(float a, float b, void (*f)(float, float)) { f(a, b); }


x86 assembly (clang, -O0):
<test_forward>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_forward>:
jmp    *%rdi

LLVM IR (-O0):
define void @test_forward(float %0, float %1, void (float, float)* %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca void (float, float)*
store float %0, float* %4
store float %1, float* %5
store void (float, float)* %2, void (float, float)** %6
%7 = load void (float, float)*, void (float, float)** %6
%8 = load float, float* %4
%9 = load float, float* %5
ret void
}

LLVM IR (-O2):
define void @test_forward(float %0, float %1, void (float, float)* nocapture %2) {
tail call void %2(float %0, float %1)
ret void
}
/* Variables and functions */
int chdir(char *);
cdd(char *p) { return (chdir(p)); }


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

x86 assembly (clang, -O2):
<cdd>:
jmp    1030 <chdir@plt>

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

LLVM IR (-O2):
define i32 @cdd(i8* %0) {
%2 = tail call i32 @chdir(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ dc_crypt_stream(int, int, int);
int /*<<< orphan*/ printf(char *);
void dc_crypt(int src_fd, int dest_fd, int decrypt) {
  if (decrypt)
    printf("\nBeginning decryption...\n");
  else
    printf("\nBeginning encryption...\n");
  dc_crypt_stream(src_fd, dest_fd, decrypt);
  printf("\n");
}


x86 assembly (clang, -O0):
<dc_crypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     114c <dc_crypt+0x2c>
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
jmp    1158 <dc_crypt+0x38>
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <dc_crypt_stream@plt>
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dc_crypt>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
mov    %edi,%ebp
test   %edx,%edx
lea    0xebc(%rip),%rax
lea    0xece(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
mov    %ebp,%edi
mov    %r14d,%esi
mov    %ebx,%edx
call   1050 <dc_crypt_stream@plt>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"\0ABeginning decryption...\0A\00"
@.str.1 = [26 x i8] c"\0ABeginning encryption...\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @dc_crypt(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 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %13
11: ; preds = %3
%12 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %9
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = call i32 @dc_crypt_stream(i32 %14, i32 %15, i32 %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [25 x i8] c"\0ABeginning encryption...\00"
@str.3 = [25 x i8] c"\0ABeginning decryption...\00"
define void @dc_crypt(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
%5 = select i1 %4, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @str.3, i64 0, i64 0)
%6 = tail call i32 @puts(i8* dereferenceable(1) %5)
%7 = tail call i32 @dc_crypt_stream(i32 %0, i32 %1, i32 %2)
%8 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int fact(int);
int /*<<< orphan*/ printf(char *, int, int);
int main(int argc, char *argv[]) {
  if (argc < 2)
    return 1;
  int num, f;
  num = (int)argv[1][0];
  f = fact(num);
  printf("\nFactorial of %d is: %d\n", num, f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    114c <main+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    117e <main+0x5e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <fact@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%eax
cmp    $0x2,%edi
jl     114c <main+0x2c>
push   %rbx
mov    0x8(%rsi),%rax
movsbl (%rax),%ebx
mov    %ebx,%edi
call   1040 <fact@plt>
lea    0xec0(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\0AFactorial of %d is: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 1, i32* %3
br label %23
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = call i32 @fact(i32 %18)
store i32 %19, i32* %7
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %21)
store i32 0, i32* %3
br label %23
23: ; preds = %11, %10
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@.str = [25 x i8] c"\0AFactorial of %d is: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = tail call i32 @fact(i32 %8)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
br label %11
11: ; preds = %2, %4
%12 = phi i32 [ 0, %4 ], [ 1, %2 ]
ret i32 %12
}
unsigned int cpu_model(unsigned int eax) {
  unsigned model = (eax & 0xf0) >> 4;
  unsigned ext_model = (eax & 0xf0000) >> 12;
  return ext_model + model;
}


x86 assembly (clang, -O0):
<cpu_model>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf0,%eax
shr    $0x4,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf0000,%eax
shr    $0xc,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_model>:
mov    %edi,%eax
shr    $0x4,%eax
and    $0xf,%eax
shr    $0xc,%edi
and    $0xf0,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @cpu_model(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = and i32 %5, 240
%7 = lshr i32 %6, 4
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = and i32 %8, 983040
%10 = lshr i32 %9, 12
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = add i32 %11, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @cpu_model(i32 %0) {
%2 = lshr i32 %0, 4
%3 = and i32 %2, 15
%4 = lshr i32 %0, 12
%5 = and i32 %4, 240
%6 = or i32 %5, %3
ret i32 %6
}
/* Type definitions */
typedef scalar_t__ int8_t;

/* Variables and functions */
int strcmp(void const *, void const *);
int8_t strcomparer(const void *s1, const void *s2) {
  int comp = strcmp(s1, s2);
  return (int8_t)(comp > 0) - (comp < 0);
}


x86 assembly (clang, -O0):
<strcomparer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%eax
cltq
cmpl   $0x0,-0x14(%rbp)
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
movslq %ecx,%rcx
sub    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcomparer>:
push   %rax
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
setg   %cl
shr    $0x1f,%eax
sub    %rax,%rcx
mov    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @strcomparer(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32 @strcmp(i8* %6, i8* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp sgt i32 %9, 0
%11 = zext i1 %10 to i32
%12 = sext i32 %11 to i64
%13 = load i32, i32* %5
%14 = icmp slt i32 %13, 0
%15 = zext i1 %14 to i32
%16 = sext i32 %15 to i64
%17 = sub nsw i64 %12, %16
ret i64 %17
}

LLVM IR (-O2):
define i64 @strcomparer(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = icmp sgt i32 %3, 0
%5 = zext i1 %4 to i64
%6 = lshr i32 %3, 31
%7 = zext i32 %6 to i64
%8 = sub nsw i64 %5, %7
ret i64 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int el_hdlcEncode(uint8_t *in, size_t inLength, uint8_t *out,
                  size_t outLength) {
  size_t i;
  if (in == NULL || out == NULL)
    return -1;
  for (i = 0; i < inLength; i++) {
  }
}


x86 assembly (clang, -O0):
<el_hdlcEncode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     112a <el_hdlcEncode+0x2a>
cmpq   $0x0,-0x20(%rbp)
jne    1136 <el_hdlcEncode+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    1162 <el_hdlcEncode+0x62>
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1162 <el_hdlcEncode+0x62>
jmp    1151 <el_hdlcEncode+0x51>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    113e <el_hdlcEncode+0x3e>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @el_hdlcEncode(i32* readnone %0, i64 %1, i32* readnone %2, i64 %3) {
ret i32 -1
}
/* Type definitions */
struct timespec {
  unsigned long tv_sec;
  unsigned long tv_nsec;
};

/* Variables and functions */
int nanosleep(struct timespec *, struct timespec *);
void msleep(unsigned long milisec) {
  struct timespec ts;
  ts.tv_sec = milisec / 1000ULL;
  ts.tv_nsec = (milisec % 1000ULL) * 1000000ULL;
  while (nanosleep(&ts, &ts) == -1)
    ;
}


x86 assembly (clang, -O0):
<msleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
imul   $0xf4240,%rdx,%rax
mov    %rax,-0x10(%rbp)
lea    -0x18(%rbp),%rsi
mov    %rsi,%rdi
call   1030 <nanosleep@plt>
cmp    $0xffffffff,%eax
jne    1161 <msleep+0x51>
jmp    1147 <msleep+0x37>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msleep>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rax
shr    $0x3,%rax
movabs $0x20c49ba5e353f7cf,%rcx
9b c4 20
mul    %rcx
shr    $0x4,%rdx
mov    %rdx,(%rsp)
imul   $0x3e8,%rdx,%rax
sub    %rax,%rdi
imul   $0xf4240,%rdi,%rax
mov    %rax,0x8(%rsp)
mov    %rsp,%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rbx,%rsi
call   1030 <nanosleep@plt>
cmp    $0xffffffff,%eax
je     1150 <msleep+0x40>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define void @msleep(i64 %0) {
%2 = alloca i64
%3 = alloca %struct.timespec
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = udiv 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 = urem i64 %7, 1000
%9 = mul i64 %8, 1000000
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
store i64 %9, i64* %10
br label %11
11: ; preds = %14, %1
%12 = call i32 @nanosleep(%struct.timespec* %3, %struct.timespec* %3)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %15
14: ; preds = %11
br label %11
15: ; preds = %11
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
define void @msleep(i64 %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
%4 = udiv i64 %0, 1000
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
store i64 %4, i64* %5
%6 = urem i64 %0, 1000
%7 = mul nuw nsw i64 %6, 1000000
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
store i64 %7, i64* %8
br label %9
9: ; preds = %9, %1
%10 = call i32 @nanosleep(%struct.timespec* %2, %struct.timespec* %2)
%11 = icmp eq i32 %10, -1
br i1 %11, label %9, label %12
12: ; preds = %9
ret void
}
/* Variables and functions */
int errno;
int fprintf(int /*<<< orphan*/, char *, char const *, char const *, int, int,
            char *);
int /*<<< orphan*/ stderr;
char *strerror(int);
int print_err_prefix(const char *prefix, const char *fname, int ret) {
  return fprintf(stderr, "%s %s() returned %d, errno = %d (%s).\n", prefix,
                 fname, ret, errno, strerror(errno));
}


x86 assembly (clang, -O0):
<print_err_prefix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2e7c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
mov    -0x18(%rbp),%r9d
lea    0xe77(%rip),%rsi
mov    %rax,(%rsp)
call   1030 <fprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_err_prefix>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%r12
mov    0x2ea4(%rip),%rax
mov    (%rax),%ebx
mov    0x2e93(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1040 <strerror@plt>
mov    %rax,(%rsp)
lea    0xea7(%rip),%rsi
mov    %ebx,%edi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14d,%r8d
mov    %ebp,%r9d
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [39 x i8] c"%s %s() returned %d, errno = %d (%s).\0A\00"
@errno = global i32 0
define i32 @print_err_prefix(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = load i32, i32* @errno
%12 = load i32, i32* @errno
%13 = call i8* @strerror(i32 %12)
%14 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9, i32 %10, i32 %11, i8* %13)
ret i32 %14
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [39 x i8] c"%s %s() returned %d, errno = %d (%s).\0A\00"
@errno = global i32 0
define i32 @print_err_prefix(i8* %0, i8* %1, i32 %2) {
%4 = load i32, i32* @stderr
%5 = load i32, i32* @errno
%6 = tail call i8* @strerror(i32 %5)
%7 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i32 %2, i32 %5, i8* %6)
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
void close_thread_log(void *thread_log) { fclose((FILE *)thread_log); }


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

x86 assembly (clang, -O2):
<close_thread_log>:
jmp    1030 <fclose@plt>

LLVM IR (-O0):
define void @close_thread_log(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = call i32 @fclose(i32* %4)
ret void
}

LLVM IR (-O2):
define void @close_thread_log(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i32 @fclose(i32* %2)
ret void
}
long long _llmax(long long a, long long b) {
  long long max_val;
  max_val = b;
  if (a > b) {
    max_val = a;
  }
  return max_val;
}


x86 assembly (clang, -O0):
<_llmax>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    112a <_llmax+0x2a>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_llmax>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovg  %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @_llmax(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ fnasso_printf(int /*<<< orphan*/, char const *, char *);
void fnasso_func_start(const char *fooname) { fnasso_printf(0, fooname, ""); }


x86 assembly (clang, -O0):
<fnasso_func_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
xor    %edi,%edi
lea    0xed7(%rip),%rdx
call   1030 <fnasso_printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnasso_func_start>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdx
xor    %edi,%edi
jmp    1030 <fnasso_printf@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define void @fnasso_func_start(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @fnasso_printf(i32 0, i8* %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define void @fnasso_func_start(i8* %0) {
%2 = tail call i32 @fnasso_printf(i32 0, i8* %0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t psector_Read_MinVersion(void) {
  uint32_t (*p_psector_Read_MinVersion)(void);
  p_psector_Read_MinVersion = (uint32_t(*)(void))0x03005439U;
  return p_psector_Read_MinVersion();
}


x86 assembly (clang, -O0):
<psector_Read_MinVersion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x3005439,%eax
mov    %rax,-0x8(%rbp)
call   *-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psector_Read_MinVersion>:
mov    $0x3005439,%eax
jmp    *%rax

LLVM IR (-O0):
define i32 @psector_Read_MinVersion() {
%1 = alloca i32 ()*
store i32 ()* inttoptr (i64 50353209 to i32 ()*), i32 ()** %1
%2 = load i32 ()*, i32 ()** %1
%3 = call i32 %2()
ret i32 %3
}

LLVM IR (-O2):
define i32 @psector_Read_MinVersion() {
%1 = tail call i32 inttoptr (i64 50353209 to i32 ()*)()
ret i32 %1
}
IntToPpch(n, ppch) register int n;
char **ppch;
{
  if (n >= 10) {
    IntToPpch(n / 10, ppch);
    n %= 10;
  }
  *(*ppch)++ = '0' + n;
}


x86 assembly (clang, -O0):
<IntToPpch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0xa,-0x8(%rbp)
jl     114d <IntToPpch+0x3d>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
call   1030 <IntToPpch@plt>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x30,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rdx
mov    (%rdx),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IntToPpch>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
cmp    $0xa,%edi
jl     113e <IntToPpch+0x2e>
mov    %ebp,%eax
mov    $0xcccccccd,%ebx
imul   %rax,%rbx
shr    $0x23,%rbx
mov    %ebx,%edi
mov    %r14,%rsi
call   1030 <IntToPpch@plt>
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%eax
sub    %eax,%ebp
add    $0x30,%bpl
mov    (%r14),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%r14)
mov    %bpl,(%rax)
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @IntToPpch(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 9
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = udiv i32 %0, 10
%6 = tail call i32 @IntToPpch(i32 %5, i8** %1)
%7 = urem i32 %0, 10
br label %8
8: ; preds = %4, %2
%9 = phi i32 [ %7, %4 ], [ %0, %2 ]
%10 = trunc i32 %9 to i8
%11 = add i8 %10, 48
%12 = load i8*, i8** %1
%13 = getelementptr inbounds i8, i8* %12, i64 1
store i8* %13, i8** %1
store i8 %11, i8* %12
ret i32 undef
}
/* Type definitions */
struct pci_dev {
  int dummy;
};

/* Variables and functions */
struct pci_dev *probe_for_realtek8169();
int init_module(void) {
  struct pci_dev *pdev;
  pdev = probe_for_realtek8169();
  if (!pdev)
    return 0;
  return 0;
}


x86 assembly (clang, -O0):
<init_module>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <probe_for_realtek8169@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    113a <init_module+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    1141 <init_module+0x31>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.pci_dev = type { i32 }
define i32 @init_module() {
%1 = alloca i32
%2 = alloca %struct.pci_dev*
%3 = call %struct.pci_dev* (...) @probe_for_realtek8169()
store %struct.pci_dev* %3, %struct.pci_dev** %2
%4 = load %struct.pci_dev*, %struct.pci_dev** %2
%5 = icmp ne %struct.pci_dev* %4, null
br i1 %5, label %7, label %6
6: ; preds = %0
store i32 0, i32* %1
br label %8
7: ; preds = %0
store i32 0, i32* %1
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
%struct.pci_dev = type { i32 }
define i32 @init_module() {
%1 = tail call %struct.pci_dev* (...) @probe_for_realtek8169()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ panic_blink(int);
int /*<<< orphan*/ uart0_write(char *);
int /*<<< orphan*/ uart0_write_hex(long);
void data_abort(void) {
  register volatile char *r_14 asm("r14");
  long prev_pc = (long)r_14 - 8;
  uart0_write("data abort!\r\n");
  uart0_write_hex(prev_pc);
  panic_blink(3);
}


x86 assembly (clang, -O0):
<data_abort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x8(%rbp),%rax
sub    $0x8,%rax
mov    %rax,-0x10(%rbp)
lea    0xeb5(%rip),%rdi
call   1040 <uart0_write@plt>
mov    -0x10(%rbp),%rdi
call   1050 <uart0_write_hex@plt>
mov    $0x3,%edi
call   1030 <panic_blink@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<data_abort>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <uart0_write@plt>
call   1050 <uart0_write_hex@plt>
mov    $0x3,%edi
pop    %rax
jmp    1030 <panic_blink@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"data abort!\0D\0A\00"
define void @data_abort() {
%1 = alloca i8*
%2 = alloca i64
%3 = load i8*, i8** %1
%4 = ptrtoint i8* %3 to i64
%5 = sub nsw i64 %4, 8
store i64 %5, i64* %2
%6 = call i32 @uart0_write(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = load i64, i64* %2
%8 = call i32 @uart0_write_hex(i64 %7)
%9 = call i32 @panic_blink(i32 3)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"data abort!\0D\0A\00"
define void @data_abort() {
%1 = tail call i32 @uart0_write(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @uart0_write_hex(i64 undef)
%3 = tail call i32 @panic_blink(i32 3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void SleepMs(int ms) {
  usleep(ms * 1000);
  return;
}


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

x86 assembly (clang, -O2):
<SleepMs>:
imul   $0x3e8,%edi,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @SleepMs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 1000
%5 = call i32 @usleep(i32 %4)
ret void
}

LLVM IR (-O2):
define void @SleepMs(i32 %0) {
%2 = mul nsw i32 %0, 1000
%3 = tail call i32 @usleep(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
int main(void) {
  printf("sizeof(\"0123456789\") = [%u]\n", (unsigned)sizeof("0123456789"));
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [29 x i8] c"sizeof(\220123456789\22) = [%u]\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 11)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"sizeof(\220123456789\22) = [%u]\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 11)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int *pidof(char *);
char process_is_running(const char *procname) {
  char resx = 0;
  int *listx = pidof((char *)procname);
  if (listx) {
    resx = listx[0] != -1;
    free(listx);
  }
  return resx;
}


x86 assembly (clang, -O0):
<process_is_running>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <pidof@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1163 <process_is_running+0x43>
mov    -0x18(%rbp),%rax
cmpl   $0xffffffff,(%rax)
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %al,-0x9(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movsbl -0x9(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_is_running>:
push   %rbx
call   1040 <pidof@plt>
test   %rax,%rax
je     113b <process_is_running+0x1b>
cmpl   $0xffffffff,(%rax)
setne  %bl
mov    %rax,%rdi
call   1030 <free@plt>
jmp    113d <process_is_running+0x1d>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define signext i8 @process_is_running(i8* %0) {
%2 = tail call i32* @pidof(i8* %0)
%3 = icmp eq i32* %2, null
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, -1
%7 = zext i1 %6 to i8
%8 = tail call i32 @free(i32* %2)
br label %9
9: ; preds = %4, %1
%10 = phi i8 [ %7, %4 ], [ 0, %1 ]
ret i8 %10
}
/* Variables and functions */
int strlen(char const *);
int passwd_known_p(const char *pw) {
  return (pw && pw[0] != '*' && strlen(pw) > 4);
}


x86 assembly (clang, -O0):
<passwd_known_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     1153 <passwd_known_p+0x43>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x2a,%ecx
mov    %al,-0x9(%rbp)
je     1153 <passwd_known_p+0x43>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x4,%eax
setg   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<passwd_known_p>:
push   %rax
xor    %eax,%eax
test   %rdi,%rdi
je     112c <passwd_known_p+0x1c>
cmpb   $0x2a,(%rdi)
je     112c <passwd_known_p+0x1c>
call   1030 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x5,%ecx
setge  %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @passwd_known_p(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %15
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 42
br i1 %10, label %11, label %15
11: ; preds = %5
%12 = load i8*, i8** %2
%13 = call i32 @strlen(i8* %12)
%14 = icmp sgt i32 %13, 4
br label %15
15: ; preds = %11, %5, %1
%16 = phi i1 [ false, %5 ], [ false, %1 ], [ %14, %11 ]
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @passwd_known_p(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 42
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = tail call i32 @strlen(i8* %0)
%8 = icmp sgt i32 %7, 4
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %3, %1
%11 = phi i32 [ 0, %3 ], [ 0, %1 ], [ %9, %6 ]
ret i32 %11
}