xunge/DecIR huggingface dataset:
/* Variables and functions */
int str_to_int(char *);
int atoi(char *str) {
  int ret = str_to_int(str);
  return ret;
}


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

x86 assembly (clang, -O2):
<atoi>:
jmp    1030 <str_to_int@plt>

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

LLVM IR (-O2):
define i32 @atoi(i8* %0) {
%2 = tail call i32 @str_to_int(i8* %0)
ret i32 %2
}
int int_ops_or(int l, int r) { return l | r; }


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

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

LLVM IR (-O0):
define i32 @int_ops_or(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = or i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @int_ops_or(i32 %0, i32 %1) {
%3 = or i32 %1, %0
ret i32 %3
}
float catrom(float x) {
  if (x < 1) {
    return (1.5f * x - 2.5f) * x * x + 1;
  }
  return (((5 - x) * x - 8) * x + 4) / 2;
}


x86 assembly (clang, -O0):
<catrom>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  0xeef(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    115c <catrom+0x5c>
movss  -0x8(%rbp),%xmm0
movss  0xeec(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xee4(%rip),%xmm1
addss  %xmm1,%xmm0
mulss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xeb2(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11a4 <catrom+0xa4>
movss  0xeac(%rip),%xmm0
subss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xe92(%rip),%xmm1
addss  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xe79(%rip),%xmm1
addss  %xmm1,%xmm0
movss  0xe69(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<catrom>:
movss  0xef8(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1135 <catrom+0x35>
movss  0xeff(%rip),%xmm1
mulss  %xmm0,%xmm1
addss  0xef7(%rip),%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
addss  0xecf(%rip),%xmm1
movaps %xmm1,%xmm0
ret
movss  0xec7(%rip),%xmm1
subss  %xmm0,%xmm1
mulss  %xmm0,%xmm1
addss  0xebb(%rip),%xmm1
mulss  %xmm0,%xmm1
addss  0xeb3(%rip),%xmm1
mulss  0xeaf(%rip),%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @catrom(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fcmp olt float %4, 1.000000e+00
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = load float, float* %3
%8 = call float @llvm.fmuladd.f32(float 1.500000e+00, float %7, float -2.500000e+00)
%9 = load float, float* %3
%10 = fmul float %8, %9
%11 = load float, float* %3
%12 = call float @llvm.fmuladd.f32(float %10, float %11, float 1.000000e+00)
store float %12, float* %2
br label %21
13: ; preds = %1
%14 = load float, float* %3
%15 = fsub float 5.000000e+00, %14
%16 = load float, float* %3
%17 = call float @llvm.fmuladd.f32(float %15, float %16, float -8.000000e+00)
%18 = load float, float* %3
%19 = call float @llvm.fmuladd.f32(float %17, float %18, float 4.000000e+00)
%20 = fdiv float %19, 2.000000e+00
store float %20, float* %2
br label %21
21: ; preds = %13, %6
%22 = load float, float* %2
ret float %22
}

LLVM IR (-O2):
define float @catrom(float %0) {
%2 = fcmp olt float %0, 1.000000e+00
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = tail call float @llvm.fmuladd.f32(float %0, float 1.500000e+00, float -2.500000e+00)
%5 = fmul float %4, %0
%6 = tail call float @llvm.fmuladd.f32(float %5, float %0, float 1.000000e+00)
br label %12
7: ; preds = %1
%8 = fsub float 5.000000e+00, %0
%9 = tail call float @llvm.fmuladd.f32(float %8, float %0, float -8.000000e+00)
%10 = tail call float @llvm.fmuladd.f32(float %9, float %0, float 4.000000e+00)
%11 = fmul float %10, 5.000000e-01
br label %12
12: ; preds = %7, %3
%13 = phi float [ %6, %3 ], [ %11, %7 ]
ret float %13
}
/* Variables and functions */
__attribute__((weak)) size_t __write(int file, const char *buf, size_t size) {
  if (file == -1)
    return -1U;
  (void)buf;
  return size;
}


x86 assembly (clang, -O0):
<__write>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1127 <__write+0x27>
mov    $0xffffffff,%eax
mov    %rax,-0x8(%rbp)
jmp    112f <__write+0x2f>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__write>:
cmp    $0xffffffff,%edi
mov    $0xffffffff,%eax
cmovne %rdx,%rax
ret

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

LLVM IR (-O2):
define weak i64 @__write(i32 %0, i8* %1, i64 %2) {
%4 = icmp eq i32 %0, -1
%5 = select i1 %4, i64 4294967295, i64 %2
ret i64 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int sigpending(int /*<<< orphan*/ *);
int test(void) {
  sigset_t set;
  int result;
  (void)sigemptyset(&set);
  result = sigpending(&set);
  return result;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1030 <sigemptyset@plt>
lea    -0x4(%rbp),%rdi
call   1040 <sigpending@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <sigemptyset@plt>
mov    %rbx,%rdi
call   1040 <sigpending@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @test() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @sigemptyset(i32* %1)
%4 = call i32 @sigpending(i32* %1)
store i32 %4, i32* %2
%5 = load i32, i32* %2
ret i32 %5
}

LLVM IR (-O2):
define i32 @test() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @sigemptyset(i32* %1)
%4 = call i32 @sigpending(i32* %1)
ret i32 %4
}
int suzerain_inorder_wavenumber_nyquist(const int N, const int w) {
  return (w == N / 2) * (1 - (N % 2));
}


x86 assembly (clang, -O0):
<suzerain_inorder_wavenumber_nyquist>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%eax
mov    $0x1,%ecx
sub    %edx,%ecx
imul   %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<suzerain_inorder_wavenumber_nyquist>:
mov    %edi,%ecx
shr    $0x1f,%ecx
add    %edi,%ecx
mov    %ecx,%edx
sar    %edx
and    $0xfffffffe,%ecx
sub    %edi,%ecx
add    $0x1,%ecx
xor    %eax,%eax
cmp    %esi,%edx
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @suzerain_inorder_wavenumber_nyquist(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = sdiv i32 %6, 2
%8 = icmp eq i32 %5, %7
%9 = zext i1 %8 to i32
%10 = load i32, i32* %3
%11 = srem i32 %10, 2
%12 = sub nsw i32 1, %11
%13 = mul nsw i32 %9, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @suzerain_inorder_wavenumber_nyquist(i32 %0, i32 %1) {
%3 = sdiv i32 %0, 2
%4 = icmp eq i32 %3, %1
%5 = srem i32 %0, 2
%6 = sub nsw i32 1, %5
%7 = select i1 %4, i32 %6, i32 0
ret i32 %7
}
/* Type definitions */
struct block_device {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct block_device *);
void blk_close(struct block_device *bdev) { free(bdev); }


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

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

LLVM IR (-O2):
%struct.block_device = type { i32 }
define void @blk_close(%struct.block_device* nocapture %0) {
%2 = tail call i32 @free(%struct.block_device* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ glmMin3fv(float *, float *, float const *);
void glmMin3fv_(float x[3], const float y[3]) { glmMin3fv(x, x, y); }


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

x86 assembly (clang, -O2):
<glmMin3fv_>:
mov    %rsi,%rdx
mov    %rdi,%rsi
jmp    1030 <glmMin3fv@plt>

LLVM IR (-O0):
define void @glmMin3fv_(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %3
%6 = load float*, float** %3
%7 = load float*, float** %4
%8 = call i32 @glmMin3fv(float* %5, float* %6, float* %7)
ret void
}

LLVM IR (-O2):
define void @glmMin3fv_(float* %0, float* %1) {
%3 = tail call i32 @glmMin3fv(float* %0, float* %0, float* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SetByte(unsigned int, unsigned char);
void SetStackByte(unsigned int addr, unsigned char byte) {
  SetByte(addr & 0xFFFF, byte);
}


x86 assembly (clang, -O0):
<SetStackByte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%edi
and    $0xffff,%edi
movzbl -0x5(%rbp),%esi
call   1030 <SetByte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetStackByte>:
movzwl %di,%edi
jmp    1030 <SetByte@plt>

LLVM IR (-O0):
define void @SetStackByte(i32 %0, i8 zeroext %1) {
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
store i8 %1, i8* %4
%5 = load i32, i32* %3
%6 = and i32 %5, 65535
%7 = load i8, i8* %4
%8 = call i32 @SetByte(i32 %6, i8 zeroext %7)
ret void
}

LLVM IR (-O2):
define void @SetStackByte(i32 %0, i8 zeroext %1) {
%3 = and i32 %0, 65535
%4 = tail call i32 @SetByte(i32 %3, i8 zeroext %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ol(char *);
swapstk() { ol("XTHL"); }


x86 assembly (clang, -O0):
<swapstk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <ol@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [5 x i8] c"XTHL\00"
define i32 @swapstk() {
%1 = alloca i32
%2 = call i32 @ol(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [5 x i8] c"XTHL\00"
define i32 @swapstk() {
%1 = tail call i32 @ol(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
void sti() { __asm__ __volatile__("sti"); }


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

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

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

LLVM IR (-O2):
define void @sti() {
tail call void asm sideeffect "sti", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
double fixup(double x) {
  const double i2_32m1 = 2.328306437080797e-10;
  if (x <= 0.0)
    return 0.5 * i2_32m1;
  if ((1.0 - x) <= 0.0)
    return 1.0 - 0.5 * i2_32m1;
  return x;
}


x86 assembly (clang, -O0):
<fixup>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  0xeef(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1136 <fixup+0x36>
movsd  0xeec(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    116c <fixup+0x6c>
movsd  0xeca(%rip),%xmm1
subsd  -0x10(%rbp),%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jb     1162 <fixup+0x62>
movsd  0xeb8(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    116c <fixup+0x6c>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fixup>:
movsd  0xef8(%rip),%xmm1
subsd  %xmm0,%xmm1
xorpd  %xmm2,%xmm2
cmpnlesd %xmm2,%xmm1
movapd %xmm1,%xmm3
andpd  %xmm0,%xmm3
movsd  0xee3(%rip),%xmm4
andnpd %xmm4,%xmm1
orpd   %xmm3,%xmm1
cmpnlesd %xmm2,%xmm0
andpd  %xmm0,%xmm1
movsd  0xed2(%rip),%xmm2
andnpd %xmm2,%xmm0
orpd   %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @fixup(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double 0x3DF00000000FFFFF, double* %4
%5 = load double, double* %3
%6 = fcmp ole double %5, 0.000000e+00
br i1 %6, label %7, label %8
7: ; preds = %1
store double 0x3DE00000000FFFFF, double* %2
br label %15
8: ; preds = %1
%9 = load double, double* %3
%10 = fsub double 1.000000e+00, %9
%11 = fcmp ole double %10, 0.000000e+00
br i1 %11, label %12, label %13
12: ; preds = %8
store double 0x3FEFFFFFFFF00000, double* %2
br label %15
13: ; preds = %8
%14 = load double, double* %3
store double %14, double* %2
br label %15
15: ; preds = %13, %12, %7
%16 = load double, double* %2
ret double %16
}

LLVM IR (-O2):
define double @fixup(double %0) {
%2 = fcmp ugt double %0, 0.000000e+00
%3 = fsub double 1.000000e+00, %0
%4 = fcmp ugt double %3, 0.000000e+00
%5 = select i1 %4, double %0, double 0x3FEFFFFFFFF00000
%6 = select i1 %2, double %5, double 0x3DE00000000FFFFF
ret double %6
}
/* Type definitions */
struct timespec {
  scalar_t__ tv_sec;
  scalar_t__ tv_nsec;
};

/* Variables and functions */
int timeafter(struct timespec t1, struct timespec t2) {
  if (t1.tv_sec == t2.tv_sec)
    return t1.tv_nsec < t2.tv_nsec;
  return t1.tv_sec < t2.tv_sec;
}


x86 assembly (clang, -O0):
<timeafter>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
jne    113a <timeafter+0x3a>
mov    -0x10(%rbp),%rax
cmp    -0x20(%rbp),%rax
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    114d <timeafter+0x4d>
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeafter>:
xor    %eax,%eax
cmp    %rcx,%rsi
setl   %al
xor    %ecx,%ecx
cmp    %rdx,%rdi
setl   %cl
cmove  %eax,%ecx
movzbl %cl,%eax
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define i32 @timeafter(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i32
%6 = alloca %struct.timespec
%7 = alloca %struct.timespec
%8 = bitcast %struct.timespec* %6 to { i64, i64 }*
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 0
store i64 %0, i64* %9
%10 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %8, i32 0, i32 1
store i64 %1, i64* %10
%11 = bitcast %struct.timespec* %7 to { i64, i64 }*
%12 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %11, i32 0, i32 0
store i64 %2, i64* %12
%13 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %11, i32 0, i32 1
store i64 %3, i64* %13
%14 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i32 0, i32 0
%15 = load i64, i64* %14
%16 = getelementptr inbounds %struct.timespec, %struct.timespec* %7, i32 0, i32 0
%17 = load i64, i64* %16
%18 = icmp eq i64 %15, %17
br i1 %18, label %19, label %26
19: ; preds = %4
%20 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i32 0, i32 1
%21 = load i64, i64* %20
%22 = getelementptr inbounds %struct.timespec, %struct.timespec* %7, i32 0, i32 1
%23 = load i64, i64* %22
%24 = icmp slt i64 %21, %23
%25 = zext i1 %24 to i32
store i32 %25, i32* %5
br label %33
26: ; preds = %4
%27 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i32 0, i32 0
%28 = load i64, i64* %27
%29 = getelementptr inbounds %struct.timespec, %struct.timespec* %7, i32 0, i32 0
%30 = load i64, i64* %29
%31 = icmp slt i64 %28, %30
%32 = zext i1 %31 to i32
store i32 %32, i32* %5
br label %33
33: ; preds = %26, %19
%34 = load i32, i32* %5
ret i32 %34
}

LLVM IR (-O2):
define i32 @timeafter(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = icmp eq i64 %0, %2
%6 = icmp slt i64 %1, %3
%7 = icmp slt i64 %0, %2
%8 = select i1 %5, i1 %6, i1 %7
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void error(char *s1) {
  perror(s1);
  exit(1);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @error(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ fig08_35();
int main(void) {
  fig08_35();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <fig08_35@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @fig08_35()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @fig08_35()
ret i32 0
}
/* Type definitions */
struct cpu {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ cpu_set_r8(struct cpu *, int, unsigned char);
void cpu_set_l(struct cpu *cpu, unsigned char l) { cpu_set_r8(cpu, (6), l); }


x86 assembly (clang, -O0):
<cpu_set_l>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x6,%esi
movzbl -0x9(%rbp),%edx
call   1030 <cpu_set_r8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_set_l>:
mov    %esi,%edx
mov    $0x6,%esi
jmp    1030 <cpu_set_r8@plt>

LLVM IR (-O0):
%struct.cpu = type { i32 }
define void @cpu_set_l(%struct.cpu* %0, i8 zeroext %1) {
%3 = alloca %struct.cpu*
%4 = alloca i8
store %struct.cpu* %0, %struct.cpu** %3
store i8 %1, i8* %4
%5 = load %struct.cpu*, %struct.cpu** %3
%6 = load i8, i8* %4
%7 = call i32 @cpu_set_r8(%struct.cpu* %5, i32 6, i8 zeroext %6)
ret void
}

LLVM IR (-O2):
%struct.cpu = type { i32 }
define void @cpu_set_l(%struct.cpu* %0, i8 zeroext %1) {
%3 = tail call i32 @cpu_set_r8(%struct.cpu* %0, i32 6, i8 zeroext %1)
ret void
}
int f() { return 4; }


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

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

LLVM IR (-O0):
define i32 @f() {
ret i32 4
}

LLVM IR (-O2):
define i32 @f() {
ret i32 4
}
/* Variables and functions */
scalar_t__ isdigit(char);
void check_number(char *character) {
  if (isdigit(*character)) {
    *character = (char)904;
  }
}


x86 assembly (clang, -O0):
<check_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1139 <check_number+0x29>
mov    -0x8(%rbp),%rax
movb   $0x88,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_number>:
push   %rbx
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     1124 <check_number+0x14>
movb   $0x88,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @check_number(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = call i64 @isdigit(i8 signext %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load i8*, i8** %2
store i8 -120, i8* %8
br label %9
9: ; preds = %7, %1
ret void
}

LLVM IR (-O2):
define void @check_number(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i64 @isdigit(i8 signext %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %6, label %5
5: ; preds = %1
store i8 -120, i8* %0
br label %6
6: ; preds = %5, %1
ret void
}
/* Type definitions */
struct dirent {
  char *d_name;
};

/* Variables and functions */
int no_dot_filter(const struct dirent *de) { return (de->d_name[0] != '.'); }


x86 assembly (clang, -O0):
<no_dot_filter>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<no_dot_filter>:
mov    (%rdi),%rcx
xor    %eax,%eax
cmpb   $0x2e,(%rcx)
setne  %al
ret

LLVM IR (-O0):
%struct.dirent = type { i8* }
define i32 @no_dot_filter(%struct.dirent* %0) {
%2 = alloca %struct.dirent*
store %struct.dirent* %0, %struct.dirent** %2
%3 = load %struct.dirent*, %struct.dirent** %2
%4 = getelementptr inbounds %struct.dirent, %struct.dirent* %3, i32 0, i32 0
%5 = load i8*, i8** %4
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 46
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
%struct.dirent = type { i8* }
define i32 @no_dot_filter(%struct.dirent* nocapture %0) {
%2 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 0
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = icmp ne i8 %4, 46
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
char *easy_printf_unknown_helper(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ write_message(char *, char *);
void write_log_var_unknown_helper(const char *message, va_list va) {
  char *msg = easy_printf_unknown_helper(message, va);
  write_message(msg, "[LOG]");
  free(msg);
}


x86 assembly (clang, -O0):
<write_log_var_unknown_helper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <easy_printf_unknown_helper@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1050 <write_message@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_log_var_unknown_helper>:
push   %rbx
call   1040 <easy_printf_unknown_helper@plt>
mov    %rax,%rbx
lea    0xec0(%rip),%rsi
mov    %rax,%rdi
call   1050 <write_message@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"[LOG]\00"
define void @write_log_var_unknown_helper(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i8* @easy_printf_unknown_helper(i8* %6, i32 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = call i32 @write_message(i8* %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = load i8*, i8** %5
%12 = call i32 @free(i8* %11)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"[LOG]\00"
define void @write_log_var_unknown_helper(i8* %0, i32 %1) {
%3 = tail call i8* @easy_printf_unknown_helper(i8* %0, i32 %1)
%4 = tail call i32 @write_message(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @free(i8* %3)
ret void
}
int pinconf_validate_map(struct pinctrl_map const *map, int i) { return 0; }


x86 assembly (clang, -O0):
<pinconf_validate_map>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.pinctrl_map = type opaque
define i32 @pinconf_validate_map(%struct.pinctrl_map* %0, i32 %1) {
%3 = alloca %struct.pinctrl_map*
%4 = alloca i32
store %struct.pinctrl_map* %0, %struct.pinctrl_map** %3
store i32 %1, i32* %4
ret i32 0
}

LLVM IR (-O2):
%struct.pinctrl_map = type opaque
define i32 @pinconf_validate_map(%struct.pinctrl_map* nocapture readnone %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  printf("sizeof(int)	=%ld\n", sizeof(int));
  printf("sizeof(char *)	=%ld\n", sizeof(char *));
  printf("sizeof(char **)	=%ld\n", sizeof(char **));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
mov    $0x8,%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    $0x4,%esi
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"sizeof(int)\09=%ld\0A\00"
@.str.1 = [21 x i8] c"sizeof(char *)\09=%ld\0A\00"
@.str.2 = [22 x i8] c"sizeof(char **)\09=%ld\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 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 4)
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 8)
%8 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 8)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"sizeof(int)\09=%ld\0A\00"
@.str.1 = [21 x i8] c"sizeof(char *)\09=%ld\0A\00"
@.str.2 = [22 x i8] c"sizeof(char **)\09=%ld\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 4)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 8)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 8)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;

/* Variables and functions */
int /*<<< orphan*/ guitp(char *, int);
void g_uid_t() { guitp("uid_t", sizeof(uid_t)); }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"uid_t\00"
define void @g_uid_t() {
%1 = tail call i32 @guitp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ vecNd_add_new(double *, double *, double const *, int);
void vec4d_add(double a[4], const double b[4]) { vecNd_add_new(a, a, b, 4); }


x86 assembly (clang, -O0):
<vec4d_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x4,%ecx
call   1030 <vecNd_add_new@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec4d_add>:
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x4,%ecx
jmp    1030 <vecNd_add_new@plt>

LLVM IR (-O0):
define void @vec4d_add(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %3
%6 = load double*, double** %3
%7 = load double*, double** %4
%8 = call i32 @vecNd_add_new(double* %5, double* %6, double* %7, i32 4)
ret void
}

LLVM IR (-O2):
define void @vec4d_add(double* %0, double* %1) {
%3 = tail call i32 @vecNd_add_new(double* %0, double* %0, double* %1, i32 4)
ret void
}
/* Variables and functions */
scalar_t__ pow(int, int);
float sqrt(scalar_t__);
float vektor(int y, int x, int z) {
  return sqrt((float)pow(y, 2) + pow(x, 2) + pow(z, 2));
}


x86 assembly (clang, -O0):
<vektor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
call   1030 <pow@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x2,%esi
call   1030 <pow@plt>
movss  -0x14(%rbp),%xmm0
cvtsi2ss %rax,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x2,%esi
call   1030 <pow@plt>
movss  -0x10(%rbp),%xmm0
cvtsi2ss %rax,%xmm1
addss  %xmm1,%xmm0
cvttss2si %xmm0,%rdi
call   1040 <sqrt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vektor>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%ebp
mov    $0x2,%esi
call   1030 <pow@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,0x4(%rsp)
mov    %ebp,%edi
mov    $0x2,%esi
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,0x4(%rsp)
mov    %ebx,%edi
mov    $0x2,%esi
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
addss  0x4(%rsp),%xmm0
cvttss2si %xmm0,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <sqrt@plt>

LLVM IR (-O0):
define float @vektor(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = call i64 @pow(i32 %7, i32 2)
%9 = sitofp i64 %8 to float
%10 = load i32, i32* %5
%11 = call i64 @pow(i32 %10, i32 2)
%12 = sitofp i64 %11 to float
%13 = fadd float %9, %12
%14 = load i32, i32* %6
%15 = call i64 @pow(i32 %14, i32 2)
%16 = sitofp i64 %15 to float
%17 = fadd float %13, %16
%18 = fptosi float %17 to i64
%19 = call float @sqrt(i64 %18)
ret float %19
}

LLVM IR (-O2):
define float @vektor(i32 %0, i32 %1, i32 %2) {
%4 = tail call i64 @pow(i32 %0, i32 2)
%5 = sitofp i64 %4 to float
%6 = tail call i64 @pow(i32 %1, i32 2)
%7 = sitofp i64 %6 to float
%8 = fadd float %5, %7
%9 = tail call i64 @pow(i32 %2, i32 2)
%10 = sitofp i64 %9 to float
%11 = fadd float %8, %10
%12 = fptosi float %11 to i64
%13 = tail call float @sqrt(i64 %12)
ret float %13
}
int upcase(int chr) {
  if ((chr >= 'a') && (chr <= 'z')) {
    chr = chr - 'a' + 'A';
  }
  return chr;
}


x86 assembly (clang, -O0):
<upcase>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x61,-0x4(%rbp)
jl     1127 <upcase+0x27>
cmpl   $0x7a,-0x4(%rbp)
jg     1127 <upcase+0x27>
mov    -0x4(%rbp),%eax
sub    $0x61,%eax
add    $0x41,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<upcase>:
lea    -0x61(%rdi),%ecx
lea    -0x20(%rdi),%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @upcase(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, -32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void print_usage(int code) {
  printf("usage: putscom [-c|--chip chip-id] [-b|--list-bits] addr value\n");
  printf("       putscom -v|--version\n");
  printf("\n");
  printf("       NB: --list-bits shows which PPC bits are set\n");
  exit(code);
  exit(code);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
lea    0xf02(%rip),%rdi
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
call   1030 <printf@plt>
lea    0xf07(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<print_usage>:
push   %rbx
mov    %edi,%ebx
lea    0xec6(%rip),%rdi
call   1040 <puts@plt>
lea    0xef9(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xeff(%rip),%rdi
call   1040 <puts@plt>
mov    %ebx,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [64 x i8] c"usage: putscom [-c|--chip chip-id] [-b|--list-bits] addr value\0A\00"
@.str.1 = [29 x i8] c" putscom -v|--version\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [53 x i8] c" NB: --list-bits shows which PPC bits are set\0A\00"
define void @print_usage(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0))
%7 = load i32, i32* %2
%8 = call i32 @exit(i32 %7)
unreachable
}

LLVM IR (-O2):
@str = [63 x i8] c"usage: putscom [-c|--chip chip-id] [-b|--list-bits] addr value\00"
@str.4 = [28 x i8] c" putscom -v|--version\00"
@str.5 = [52 x i8] c" NB: --list-bits shows which PPC bits are set\00"
define void @print_usage(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.4, i64 0, i64 0))
%4 = tail call i32 @putchar(i32 10)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.5, i64 0, i64 0))
%6 = tail call i32 @exit(i32 %0)
unreachable
}
unsigned cdb_hash(const void *buf, unsigned len) {
  register const unsigned char *p = (const unsigned char *)buf;
  register const unsigned char *end = p + len;
  register unsigned hash = 5381;
  while (p < end)
    hash = (hash + (hash << 5)) ^ *p++;
  return hash;
}


x86 assembly (clang, -O0):
<cdb_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
movl   $0x1505,-0x24(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    115d <cdb_hash+0x5d>
mov    -0x24(%rbp),%eax
mov    -0x24(%rbp),%ecx
shl    $0x5,%ecx
add    %ecx,%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movzbl (%rcx),%ecx
xor    %ecx,%eax
mov    %eax,-0x24(%rbp)
jmp    1128 <cdb_hash+0x28>
mov    -0x24(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdb_hash>:
test   %esi,%esi
je     1126 <cdb_hash+0x26>
mov    %esi,%ecx
add    %rdi,%rcx
mov    $0x1505,%eax
xchg   %ax,%ax
mov    %eax,%edx
shl    $0x5,%edx
add    %eax,%edx
movzbl (%rdi),%eax
add    $0x1,%rdi
xor    %edx,%eax
cmp    %rcx,%rdi
jb     1110 <cdb_hash+0x10>
ret
mov    $0x1505,%eax
ret

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

LLVM IR (-O2):
define i32 @cdb_hash(i8* %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = icmp eq i32 %1, 0
br i1 %5, label %15, label %6
6: ; preds = %2, %6
%7 = phi i32 [ %13, %6 ], [ 5381, %2 ]
%8 = phi i8* [ %10, %6 ], [ %0, %2 ]
%9 = mul i32 %7, 33
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = load i8, i8* %8
%12 = zext i8 %11 to i32
%13 = xor i32 %9, %12
%14 = icmp ult i8* %10, %4
br i1 %14, label %6, label %15
15: ; preds = %6, %2
%16 = phi i32 [ 5381, %2 ], [ %13, %6 ]
ret i32 %16
}
int word_terminator(char ch1, char ch2) {
  if (((ch1 >= 'a') && (ch1 <= 'z')) || ((ch1 >= 'A') && (ch1 <= 'Z'))) {
    if (!(((ch2 >= 'a') && (ch2 <= 'z')) || ((ch2 >= 'A') && (ch2 <= 'Z')))) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<word_terminator>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     112a <word_terminator+0x2a>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jle    1144 <word_terminator+0x44>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1189 <word_terminator+0x89>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     1189 <word_terminator+0x89>
movsbl -0x6(%rbp),%eax
cmp    $0x61,%eax
jl     115e <word_terminator+0x5e>
movsbl -0x6(%rbp),%eax
cmp    $0x7a,%eax
jle    1184 <word_terminator+0x84>
movsbl -0x6(%rbp),%eax
cmp    $0x41,%eax
jl     1178 <word_terminator+0x78>
movsbl -0x6(%rbp),%eax
cmp    $0x5a,%eax
jle    1184 <word_terminator+0x84>
movl   $0x1,-0x4(%rbp)
jmp    1190 <word_terminator+0x90>
jmp    1189 <word_terminator+0x89>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<word_terminator>:
and    $0xdf,%dil
add    $0xbf,%dil
cmp    $0x1a,%dil
setb   %al
and    $0xdf,%sil
add    $0xa5,%sil
cmp    $0xe6,%sil
setb   %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @word_terminator(i8 signext %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
store i8 %0, i8* %4
store i8 %1, i8* %5
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
%8 = icmp sge i32 %7, 97
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i8, i8* %4
%11 = sext i8 %10 to i32
%12 = icmp sle i32 %11, 122
br i1 %12, label %21, label %13
13: ; preds = %9, %2
%14 = load i8, i8* %4
%15 = sext i8 %14 to i32
%16 = icmp sge i32 %15, 65
br i1 %16, label %17, label %39
17: ; preds = %13
%18 = load i8, i8* %4
%19 = sext i8 %18 to i32
%20 = icmp sle i32 %19, 90
br i1 %20, label %21, label %39
21: ; preds = %17, %9
%22 = load i8, i8* %5
%23 = sext i8 %22 to i32
%24 = icmp sge i32 %23, 97
br i1 %24, label %25, label %29
25: ; preds = %21
%26 = load i8, i8* %5
%27 = sext i8 %26 to i32
%28 = icmp sle i32 %27, 122
br i1 %28, label %38, label %29
29: ; preds = %25, %21
%30 = load i8, i8* %5
%31 = sext i8 %30 to i32
%32 = icmp sge i32 %31, 65
br i1 %32, label %33, label %37
33: ; preds = %29
%34 = load i8, i8* %5
%35 = sext i8 %34 to i32
%36 = icmp sle i32 %35, 90
br i1 %36, label %38, label %37
37: ; preds = %33, %29
store i32 1, i32* %3
br label %40
38: ; preds = %33, %25
br label %39
39: ; preds = %38, %17, %13
store i32 0, i32* %3
br label %40
40: ; preds = %39, %37
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
define i32 @word_terminator(i8 signext %0, i8 signext %1) {
%3 = and i8 %0, -33
%4 = add i8 %3, -65
%5 = icmp ult i8 %4, 26
%6 = and i8 %1, -33
%7 = add i8 %6, -91
%8 = icmp ult i8 %7, -26
%9 = and i1 %5, %8
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
void do_stdio_log_string(void *context, const char *val) {
  FILE *stdio = context;
  fprintf(stdio, "%s", val);
}


x86 assembly (clang, -O0):
<do_stdio_log_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_stdio_log_string>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @do_stdio_log_string(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 = bitcast i8* %6 to i32*
store i32* %7, i32** %5
%8 = load i32*, i32** %5
%9 = load i8*, i8** %4
%10 = call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %9)
ret void
}

LLVM IR (-O2):
define void @do_stdio_log_string(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = tail call i32 @fputs(i8* %1, i32* %3)
ret void
}
void serverShutdown(void) {}


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

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

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

LLVM IR (-O2):
define void @serverShutdown() {
ret void
}
/* Type definitions */
struct stat {
  scalar_t__ st_size;
};

/* Variables and functions */
int fstat(int, struct stat *);
int get_file_size(int fd) {
  struct stat stat_struct;
  if (fstat(fd, &stat_struct) == -1)
    return (1);
  return (int)stat_struct.st_size;
}


x86 assembly (clang, -O0):
<get_file_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1030 <fstat@plt>
cmp    $0xffffffff,%eax
jne    113c <get_file_size+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    1143 <get_file_size+0x33>
mov    -0x10(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_file_size>:
push   %rax
mov    %rsp,%rsi
call   1030 <fstat@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0xffffffff,%ecx
je     1128 <get_file_size+0x18>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i64 }
define i32 @get_file_size(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.stat
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @fstat(i32 %5, %struct.stat* %4)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 1, i32* %2
br label %13
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%11 = load i64, i64* %10
%12 = trunc i64 %11 to i32
store i32 %12, i32* %2
br label %13
13: ; preds = %9, %8
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
%struct.stat = type { i64 }
define i32 @get_file_size(i32 %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @fstat(i32 %0, %struct.stat* %2)
%5 = icmp eq i32 %4, -1
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
%9 = select i1 %5, i32 1, i32 %8
ret i32 %9
}
/* Variables and functions */
int errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *, int, int);
void handle_error(int retcode, char *msg) {
  if (retcode < 0) {
    printf("error: %s -- retcode=%d errno=%d\n", msg, retcode, errno);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<handle_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    115f <handle_error+0x3f>
mov    -0x10(%rbp),%rsi
mov    -0x4(%rbp),%edx
mov    0x2e99(%rip),%rax
mov    (%rax),%ecx
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_error>:
test   %edi,%edi
js     1125 <handle_error+0x5>
ret
push   %rax
mov    %edi,%edx
mov    0x2eb1(%rip),%rax
mov    (%rax),%ecx
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"error: %s -- retcode=%d errno=%d\0A\00"
@errno = global i32 0
define void @handle_error(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = load i32, i32* %3
%10 = load i32, i32* @errno
%11 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %9, i32 %10)
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"error: %s -- retcode=%d errno=%d\0A\00"
@errno = global i32 0
define void @handle_error(i32 %0, i8* %1) {
%3 = icmp slt i32 %0, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @errno
%6 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %0, i32 %5)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
unsigned long strtoul(char *, int /*<<< orphan*/ *, int);
unsigned long read_freq(char *fstr) {
  unsigned long freq = strtoul(fstr, NULL, 10);
  if (freq <= 0) {
    fprintf(stderr, "Frequency must be greater than 0.\n");
    exit(EXIT_FAILURE);
  }
  return freq;
}


x86 assembly (clang, -O0):
<read_freq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
ja     1180 <read_freq+0x50>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
lea    0xe93(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_freq>:
push   %rax
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtoul@plt>
test   %rax,%rax
je     1144 <read_freq+0x14>
pop    %rcx
ret
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
lea    0xeac(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"Frequency must be greater than 0.\0A\00"
@EXIT_FAILURE = global i32 0
define i64 @read_freq(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strtoul(i8* %4, i32* null, i32 10)
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = icmp ule i64 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %1
%14 = load i64, i64* %3
ret i64 %14
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"Frequency must be greater than 0.\0A\00"
@EXIT_FAILURE = global i32 0
define i64 @read_freq(i8* nocapture %0) {
%2 = tail call i64 @strtoul(i8* nocapture %0, i32* null, i32 10)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %1
ret i64 %2
}