xunge/DecIR huggingface dataset:
char *hex(int ch, char *p) {
  static const char tab[] = "0123456789ABCDEF";
  *p++ = tab[(ch >> 4) & 0xF];
  *p++ = tab[ch & 0xF];
  return p;
}


x86 assembly (clang, -O0):
<hex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
and    $0xf,%eax
movslq %eax,%rcx
lea    0xee2(%rip),%rax
mov    (%rax,%rcx,1),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
movslq %eax,%rcx
lea    0xebe(%rip),%rax
mov    (%rax,%rcx,1),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex>:
mov    %edi,%eax
shr    $0x4,%eax
and    $0xf,%eax
lea    0xef1(%rip),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,(%rsi)
and    $0xf,%edi
mov    (%rdi,%rcx,1),%al
mov    %al,0x1(%rsi)
lea    0x2(%rsi),%rax
ret

LLVM IR (-O0):
@hex.tab = internal constant [17 x i8] c"0123456789ABCDEF\00"
define i8* @hex(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 = ashr i32 %5, 4
%7 = and i32 %6, 15
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [17 x i8], [17 x i8]* @hex.tab, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %4
store i8 %10, i8* %11
%13 = load i32, i32* %3
%14 = and i32 %13, 15
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [17 x i8], [17 x i8]* @hex.tab, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %4
store i8 %17, i8* %18
%20 = load i8*, i8** %4
ret i8* %20
}

LLVM IR (-O2):
@hex.tab = internal unnamed_addr constant [17 x i8] c"0123456789ABCDEF\00"
define i8* @hex(i32 %0, i8* writeonly %1) {
%3 = lshr i32 %0, 4
%4 = and i32 %3, 15
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds [17 x i8], [17 x i8]* @hex.tab, i64 0, i64 %5
%7 = load i8, i8* %6
%8 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %7, i8* %1
%9 = and i32 %0, 15
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds [17 x i8], [17 x i8]* @hex.tab, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %12, i8* %8
ret i8* %13
}
void null_writeback(int drive) { return; }


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

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

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

LLVM IR (-O2):
define void @null_writeback(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, double, double, double);
void dump3d(double *v, char *prefix) {
  printf("%s %8.3f %8.3f %8.3f\n", prefix, v[0], v[1], v[2]);
}


x86 assembly (clang, -O0):
<dump3d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump3d>:
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
movsd  0x10(%rdi),%xmm2
lea    0xedb(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"%s %8.3f %8.3f %8.3f\0A\00"
define void @dump3d(double* %0, i8* %1) {
%3 = alloca double*
%4 = alloca i8*
store double* %0, double** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load double*, double** %3
%7 = getelementptr inbounds double, double* %6, i64 0
%8 = load double, double* %7
%9 = load double*, double** %3
%10 = getelementptr inbounds double, double* %9, i64 1
%11 = load double, double* %10
%12 = load double*, double** %3
%13 = getelementptr inbounds double, double* %12, i64 2
%14 = load double, double* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %5, double %8, double %11, double %14)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"%s %8.3f %8.3f %8.3f\0A\00"
define void @dump3d(double* nocapture %0, i8* %1) {
%3 = load double, double* %0
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = load double, double* %4
%6 = getelementptr inbounds double, double* %0, i64 2
%7 = load double, double* %6
%8 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %1, double %3, double %5, double %7)
ret void
}
/* Variables and functions */
int g();
f() {
  int x[g()];
  return sizeof x;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <g@plt>
mov    %eax,%eax
mov    %rsp,%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
shl    $0x2,%rax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rax
xor    %eax,%eax
call   1030 <g@plt>
shl    $0x2,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @f() {
%1 = alloca i8*
%2 = alloca i64
%3 = call i32 (...) @g()
%4 = zext i32 %3 to i64
%5 = call i8* @llvm.stacksave()
store i8* %5, i8** %1
%6 = alloca i32, i64 %4
store i64 %4, i64* %2
%7 = mul nuw i64 4, %4
%8 = trunc i64 %7 to i32
%9 = load i8*, i8** %1
ret i32 %8
}

LLVM IR (-O2):
define i32 @f() {
%1 = tail call i32 (...) @g()
%2 = shl i32 %1, 2
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fread(unsigned char *, int, int, int /*<<< orphan*/ *);
unsigned long interpret_uint32(unsigned char *);
unsigned long read_uint32(FILE *in) {
  unsigned char buffer[4];
  fread(buffer, 1, 4, in);
  return interpret_uint32(buffer);
}


x86 assembly (clang, -O0):
<read_uint32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1040 <fread@plt>
lea    -0xc(%rbp),%rdi
call   1030 <interpret_uint32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_uint32>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rcx
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1040 <fread@plt>
mov    %rbx,%rdi
call   1030 <interpret_uint32@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i64 @read_uint32(i32* %0) {
%2 = alloca i32*
%3 = alloca [4 x i8]
store i32* %0, i32** %2
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = load i32*, i32** %2
%6 = call i32 @fread(i8* %4, i32 1, i32 4, i32* %5)
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%8 = call i64 @interpret_uint32(i8* %7)
ret i64 %8
}

LLVM IR (-O2):
define i64 @read_uint32(i32* nocapture %0) {
%2 = alloca [4 x i8]
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%4 = call i32 @fread(i8* %3, i32 1, i32 4, i32* %0)
%5 = call i64 @interpret_uint32(i8* %3)
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void ErrorHandling(char *message) {
  perror(message);
  exit(1);
}


x86 assembly (clang, -O0):
<ErrorHandling>:
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):
<ErrorHandling>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @ErrorHandling(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 @ErrorHandling(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int strlen(const char *str) {
  unsigned int i = 0;
  while (str[i]) {
    i++;
  }
  return i;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
cmpb   $0x0,(%rax,%rcx,1)
je     112e <strlen+0x2e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi,%rax,1)
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 0, %1 ], [ %8, %2 ]
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = add i32 %3, 1
br i1 %7, label %9, label %2
9: ; preds = %2
ret i32 %3
}
float __fsmul(float a1, float a2) { return (a1 + a2); }


x86 assembly (clang, -O0):
<__fsmul>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<__fsmul>:
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @__fsmul(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* %4
%7 = fadd float %5, %6
ret float %7
}

LLVM IR (-O2):
define float @__fsmul(float %0, float %1) {
%3 = fadd float %0, %1
ret float %3
}
unsigned base64_decode_length(unsigned length) {
  return ((((length) + 1) * 6) / 8);
}


x86 assembly (clang, -O0):
<base64_decode_length>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
imul   $0x6,%eax,%eax
shr    $0x3,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<base64_decode_length>:
lea    (%rdi,%rdi,2),%eax
add    %eax,%eax
add    $0x6,%eax
shr    $0x3,%eax
ret

LLVM IR (-O0):
define i32 @base64_decode_length(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add i32 %3, 1
%5 = mul i32 %4, 6
%6 = udiv i32 %5, 8
ret i32 %6
}

LLVM IR (-O2):
define i32 @base64_decode_length(i32 %0) {
%2 = mul i32 %0, 6
%3 = add i32 %2, 6
%4 = lshr i32 %3, 3
ret i32 %4
}
/* Variables and functions */
scalar_t__ rintf(float);
int interpNN_b(unsigned char *sl, int w, int h, float x, float y, float o,
               unsigned char *v, int is_atop) {
  *v = sl[(int)rintf(x) + (int)rintf(y) * w];
  return 0;
}


x86 assembly (clang, -O0):
<interpNN_b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movss  %xmm1,-0x18(%rbp)
movss  %xmm2,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
movss  -0x14(%rbp),%xmm0
call   1030 <rintf@plt>
mov    %eax,-0x3c(%rbp)
movss  -0x18(%rbp),%xmm0
call   1030 <rintf@plt>
mov    -0x3c(%rbp),%ecx
mov    %rax,%rdx
mov    -0x38(%rbp),%rax
imul   -0xc(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x28(%rbp),%rax
mov    %cl,(%rax)
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<interpNN_b>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
movss  %xmm1,0x4(%rsp)
mov    %esi,%ebp
mov    %rdi,%r15
call   1030 <rintf@plt>
mov    %rax,%rbx
movss  0x4(%rsp),%xmm0
call   1030 <rintf@plt>
imul   %ebp,%eax
add    %ebx,%eax
cltq
mov    (%r15,%rax,1),%al
mov    %al,(%r14)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @interpNN_b(i8* %0, i32 %1, i32 %2, float %3, float %4, float %5, i8* %6, i32 %7) {
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca i8*
%16 = alloca i32
store i8* %0, i8** %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store float %3, float* %12
store float %4, float* %13
store float %5, float* %14
store i8* %6, i8** %15
store i32 %7, i32* %16
%17 = load i8*, i8** %9
%18 = load float, float* %12
%19 = call i64 @rintf(float %18)
%20 = trunc i64 %19 to i32
%21 = load float, float* %13
%22 = call i64 @rintf(float %21)
%23 = trunc i64 %22 to i32
%24 = load i32, i32* %10
%25 = mul nsw i32 %23, %24
%26 = add nsw i32 %20, %25
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %17, i64 %27
%29 = load i8, i8* %28
%30 = load i8*, i8** %15
store i8 %29, i8* %30
ret i32 0
}

LLVM IR (-O2):
define i32 @interpNN_b(i8* nocapture %0, i32 %1, i32 %2, float %3, float %4, float %5, i8* nocapture writeonly %6, i32 %7) {
%9 = tail call i64 @rintf(float %3)
%10 = trunc i64 %9 to i32
%11 = tail call i64 @rintf(float %4)
%12 = trunc i64 %11 to i32
%13 = mul nsw i32 %12, %1
%14 = add nsw i32 %13, %10
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
store i8 %17, i8* %6
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void i2c_close(int bus) { close(bus); }


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

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

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

LLVM IR (-O2):
define void @i2c_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
OP(ed, d8) {}


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

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char letter;
  scanf("%c", &letter);
  printf("%c\n", 'a' + ('z' - letter));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x1(%rbp),%ecx
mov    $0x7a,%eax
sub    %ecx,%eax
add    $0x61,%eax
lea    0xeb6(%rip),%rdi
movsbl %al,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1040 <scanf@plt>
mov    $0xdb,%al
sub    0x7(%rsp),%al
movsbl %al,%esi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = load i8, i8* %1
%4 = sext i8 %3 to i32
%5 = sub nsw i32 122, %4
%6 = add nsw i32 97, %5
%7 = trunc i32 %6 to i8
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@.str.1 = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = load i8, i8* %1
%4 = sub i8 -37, %3
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
unsigned long __generic_copy_from_user(void *x, const void *y,
                                       unsigned long z) {
  assert(0);
}


x86 assembly (clang, -O0):
<__generic_copy_from_user>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
xor    %edi,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__generic_copy_from_user>:
xor    %edi,%edi
jmp    1030 <assert@plt>

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

LLVM IR (-O2):
define i64 @__generic_copy_from_user(i8* nocapture readnone %0, i8* nocapture readnone %1, i64 %2) {
%4 = tail call i32 @assert(i32 0)
ret i64 undef
}
/* Variables and functions */
int /*<<< orphan*/ embedded_ftoa(char *, float, int, int);
unsigned int embedded_prints(char *, int /*<<< orphan*/, int /*<<< orphan*/);
unsigned int print_scientific(float number, int dp) {
  char buffer[36];
  embedded_ftoa(buffer, number, dp, 1);
  return embedded_prints(buffer, 0, 0);
}


x86 assembly (clang, -O0):
<print_scientific>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
lea    -0x30(%rbp),%rdi
movss  -0x4(%rbp),%xmm0
mov    -0x8(%rbp),%esi
mov    $0x1,%edx
call   1030 <embedded_ftoa@plt>
lea    -0x30(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1040 <embedded_prints@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_scientific>:
push   %rbx
sub    $0x30,%rsp
mov    %edi,%esi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1,%edx
call   1030 <embedded_ftoa@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <embedded_prints@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @print_scientific(float %0, i32 %1) {
%3 = alloca float
%4 = alloca i32
%5 = alloca [36 x i8]
store float %0, float* %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [36 x i8], [36 x i8]* %5, i64 0, i64 0
%7 = load float, float* %3
%8 = load i32, i32* %4
%9 = call i32 @embedded_ftoa(i8* %6, float %7, i32 %8, i32 1)
%10 = getelementptr inbounds [36 x i8], [36 x i8]* %5, i64 0, i64 0
%11 = call i32 @embedded_prints(i8* %10, i32 0, i32 0)
ret i32 %11
}

LLVM IR (-O2):
define i32 @print_scientific(float %0, i32 %1) {
%3 = alloca [36 x i8]
%4 = getelementptr inbounds [36 x i8], [36 x i8]* %3, i64 0, i64 0
%5 = call i32 @embedded_ftoa(i8* %4, float %0, i32 %1, i32 1)
%6 = call i32 @embedded_prints(i8* %4, i32 0, i32 0)
ret i32 %6
}
/* Variables and functions */
int errno;
int unlink(char const *);
int /*<<< orphan*/ warn(char *);
void remove_tmpfile(const char *tmppath) {
  int error, saved_errno;
  saved_errno = errno;
  error = unlink(tmppath);
  if (error != 0)
    warn("unlink");
  errno = saved_errno;
}


x86 assembly (clang, -O0):
<remove_tmpfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <unlink@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     115a <remove_tmpfile+0x3a>
lea    0xeab(%rip),%rdi
call   1040 <warn@plt>
mov    -0x10(%rbp),%ecx
mov    0x2e7c(%rip),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_tmpfile>:
push   %rbp
push   %rbx
push   %rax
mov    0x2eb6(%rip),%rbx
mov    (%rbx),%ebp
call   1030 <unlink@plt>
test   %eax,%eax
je     1141 <remove_tmpfile+0x21>
lea    0xec4(%rip),%rdi
call   1040 <warn@plt>
mov    %ebp,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i32 0
@.str = [7 x i8] c"unlink\00"
define void @remove_tmpfile(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i32, i32* @errno
store i32 %5, i32* %4
%6 = load i8*, i8** %2
%7 = call i32 @unlink(i8* %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 @warn(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %1
%13 = load i32, i32* %4
store i32 %13, i32* @errno
ret void
}

LLVM IR (-O2):
@errno = global i32 0
@.str = [7 x i8] c"unlink\00"
define void @remove_tmpfile(i8* nocapture %0) {
%2 = load i32, i32* @errno
%3 = tail call i32 @unlink(i8* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @warn(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
store i32 %2, i32* @errno
ret void
}
void s3c_gpiolib_track(struct s3c_gpio_chip *chip) {}


x86 assembly (clang, -O0):
<s3c_gpiolib_track>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.s3c_gpio_chip = type opaque
define void @s3c_gpiolib_track(%struct.s3c_gpio_chip* %0) {
%2 = alloca %struct.s3c_gpio_chip*
store %struct.s3c_gpio_chip* %0, %struct.s3c_gpio_chip** %2
ret void
}

LLVM IR (-O2):
%struct.s3c_gpio_chip = type opaque
define void @s3c_gpiolib_track(%struct.s3c_gpio_chip* nocapture %0) {
ret void
}
int logicalShift(int x, int n) { return ~(1 << 31 >> n << 1) & (x >> n); }


x86 assembly (clang, -O0):
<logicalShift>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x80000000,%eax
sar    %cl,%eax
shl    $0x1,%eax
xor    $0xffffffff,%eax
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
sar    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<logicalShift>:
mov    %esi,%ecx
mov    $0x80000000,%eax
sar    %cl,%eax
add    %eax,%eax
not    %eax
sar    %cl,%edi
and    %edi,%eax
ret

LLVM IR (-O0):
define i32 @logicalShift(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 = ashr i32 -2147483648, %5
%7 = shl i32 %6, 1
%8 = xor i32 %7, -1
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = ashr i32 %9, %10
%12 = and i32 %8, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @logicalShift(i32 %0, i32 %1) {
%3 = ashr i32 -2147483648, %1
%4 = shl i32 %3, 1
%5 = xor i32 %4, -1
%6 = ashr i32 %0, %1
%7 = and i32 %6, %5
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ ReleaseBMP195();
void releasebmp() { ReleaseBMP195(); }


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

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

LLVM IR (-O0):
define void @releasebmp() {
%1 = call i32 (...) @ReleaseBMP195()
ret void
}

LLVM IR (-O2):
define void @releasebmp() {
%1 = tail call i32 (...) @ReleaseBMP195()
ret void
}
/* Variables and functions */
unsigned long getpid();
unsigned long path_get_process_id_(void) { return getpid(); }


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

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

LLVM IR (-O0):
define i64 @path_get_process_id_() {
%1 = call i64 (...) @getpid()
ret i64 %1
}

LLVM IR (-O2):
define i64 @path_get_process_id_() {
%1 = tail call i64 (...) @getpid()
ret i64 %1
}
unsigned int fedfs_delay(unsigned int seconds) {
  return seconds < (2 << 4) ? seconds << 1 : (2 << 4);
}


x86 assembly (clang, -O0):
<fedfs_delay>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x20,-0x4(%rbp)
jae    111f <fedfs_delay+0x1f>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112c <fedfs_delay+0x2c>
mov    $0x20,%eax
mov    %eax,-0x8(%rbp)
jmp    112c <fedfs_delay+0x2c>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fedfs_delay>:
lea    (%rdi,%rdi,1),%ecx
cmp    $0x20,%edi
mov    $0x20,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @fedfs_delay(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ult i32 %3, 32
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = shl i32 %6, 1
br label %9
8: ; preds = %1
br label %9
9: ; preds = %8, %5
%10 = phi i32 [ %7, %5 ], [ 32, %8 ]
ret i32 %10
}

LLVM IR (-O2):
define i32 @fedfs_delay(i32 %0) {
%2 = icmp ult i32 %0, 32
%3 = shl i32 %0, 1
%4 = select i1 %2, i32 %3, i32 32
ret i32 %4
}
/* Variables and functions */
int frobcmp(char const *, char const *);
int frobcmp_helper(const void *a, const void *b) {
  char const *aa = *(char const **)a;
  char const *bb = *(char const **)b;
  int value = frobcmp(aa, bb);
  return value;
}


x86 assembly (clang, -O0):
<frobcmp_helper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <frobcmp@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<frobcmp_helper>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <frobcmp@plt>

LLVM IR (-O0):
define i32 @frobcmp_helper(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to i8**
%10 = load i8*, i8** %9
store i8* %10, i8** %5
%11 = load i8*, i8** %4
%12 = bitcast i8* %11 to i8**
%13 = load i8*, i8** %12
store i8* %13, i8** %6
%14 = load i8*, i8** %5
%15 = load i8*, i8** %6
%16 = call i32 @frobcmp(i8* %14, i8* %15)
store i32 %16, i32* %7
%17 = load i32, i32* %7
ret i32 %17
}

LLVM IR (-O2):
define i32 @frobcmp_helper(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @frobcmp(i8* %4, i8* %6)
ret i32 %7
}
/* Type definitions */
struct stat {
  int st_size;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fileno(int /*<<< orphan*/ *);
int fstat(int /*<<< orphan*/, struct stat *);
int syn_file_length(FILE *fd) {
  struct stat stat_buf;
  if (fstat(fileno(fd), &stat_buf) != -1)
    return (stat_buf.st_size);
  return (-1);
}


x86 assembly (clang, -O0):
<syn_file_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fileno@plt>
mov    %eax,%edi
lea    -0x18(%rbp),%rsi
call   1040 <fstat@plt>
cmp    $0xffffffff,%eax
je     1154 <syn_file_length+0x34>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115b <syn_file_length+0x3b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<syn_file_length>:
push   %rax
call   1030 <fileno@plt>
mov    %rsp,%rsi
mov    %eax,%edi
call   1040 <fstat@plt>
cmp    $0xffffffff,%eax
je     1138 <syn_file_length+0x18>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @syn_file_length(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 @fileno(i32* %5)
%7 = call i32 @fstat(i32 %6, %struct.stat* %4)
%8 = icmp ne i32 %7, -1
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%11 = load i32, i32* %10
store i32 %11, i32* %2
br label %13
12: ; preds = %1
store i32 -1, i32* %2
br label %13
13: ; preds = %12, %9
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @syn_file_length(i32* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = tail call i32 @fileno(i32* %0)
%5 = call i32 @fstat(i32 %4, %struct.stat* %2)
%6 = icmp eq i32 %5, -1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = select i1 %6, i32 -1, i32 %8
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ bbb(int);
void aaa(int arg) { bbb(456); }


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

x86 assembly (clang, -O2):
<aaa>:
mov    $0x1c8,%edi
jmp    1030 <bbb@plt>

LLVM IR (-O0):
define void @aaa(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @bbb(i32 456)
ret void
}

LLVM IR (-O2):
define void @aaa(i32 %0) {
%2 = tail call i32 @bbb(i32 456)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lineEight();
int /*<<< orphan*/ lineFive();
int /*<<< orphan*/ lineFour();
int /*<<< orphan*/ lineNine();
int /*<<< orphan*/ lineOne();
int /*<<< orphan*/ lineSeven();
int /*<<< orphan*/ lineSix();
int /*<<< orphan*/ lineThree();
int /*<<< orphan*/ lineTwo();
void printFigure() {
  lineOne();
  lineTwo();
  lineThree();
  lineFour();
  lineFive();
  lineSix();
  lineSeven();
  lineEight();
  lineNine();
}


x86 assembly (clang, -O0):
<printFigure>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <lineOne@plt>
mov    $0x0,%al
call   1060 <lineTwo@plt>
mov    $0x0,%al
call   1070 <lineThree@plt>
mov    $0x0,%al
call   1050 <lineFour@plt>
mov    $0x0,%al
call   10a0 <lineFive@plt>
mov    $0x0,%al
call   1090 <lineSix@plt>
mov    $0x0,%al
call   1080 <lineSeven@plt>
mov    $0x0,%al
call   10b0 <lineEight@plt>
mov    $0x0,%al
call   1040 <lineNine@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<printFigure>:
push   %rax
xor    %eax,%eax
call   1030 <lineOne@plt>
xor    %eax,%eax
call   1060 <lineTwo@plt>
xor    %eax,%eax
call   1070 <lineThree@plt>
xor    %eax,%eax
call   1050 <lineFour@plt>
xor    %eax,%eax
call   10a0 <lineFive@plt>
xor    %eax,%eax
call   1090 <lineSix@plt>
xor    %eax,%eax
call   1080 <lineSeven@plt>
xor    %eax,%eax
call   10b0 <lineEight@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <lineNine@plt>

LLVM IR (-O0):
define void @printFigure() {
%1 = call i32 (...) @lineOne()
%2 = call i32 (...) @lineTwo()
%3 = call i32 (...) @lineThree()
%4 = call i32 (...) @lineFour()
%5 = call i32 (...) @lineFive()
%6 = call i32 (...) @lineSix()
%7 = call i32 (...) @lineSeven()
%8 = call i32 (...) @lineEight()
%9 = call i32 (...) @lineNine()
ret void
}

LLVM IR (-O2):
define void @printFigure() {
%1 = tail call i32 (...) @lineOne()
%2 = tail call i32 (...) @lineTwo()
%3 = tail call i32 (...) @lineThree()
%4 = tail call i32 (...) @lineFour()
%5 = tail call i32 (...) @lineFive()
%6 = tail call i32 (...) @lineSix()
%7 = tail call i32 (...) @lineSeven()
%8 = tail call i32 (...) @lineEight()
%9 = tail call i32 (...) @lineNine()
ret void
}
void outb_p(unsigned char value, unsigned short port) {
  asm volatile("out"
               "b"
               " %"
               "b"
               "0,%"
               "w"
               "1"
               :
               : "a"(value), "Nd"(port));
  slow_down_io();
}


x86 assembly (clang, -O0):
<outb_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x1(%rbp),%al
mov    -0x4(%rbp),%dx
out    %al,(%dx)
mov    $0x0,%al
call   1030 <slow_down_io@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outb_p>:
mov    %esi,%edx
mov    %edi,%eax
out    %al,(%dx)
xor    %eax,%eax
jmp    1030 <slow_down_io@plt>

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

LLVM IR (-O2):
define void @outb_p(i8 zeroext %0, i16 zeroext %1) {
tail call void asm sideeffect "outb ${0:b},${1:w}", "{ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i8 %0, i16 %1)
%3 = tail call i32 (...) @slow_down_io()
ret void
}
/* Type definitions */
struct server_list {
  int dummy;
};
struct server {
  int dummy;
};
struct genlist {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ genlist_unlink(struct genlist *, struct server *);
void server_list_unlink(struct server_list *tthis, struct server *pfoo) {
  genlist_unlink(((struct genlist *)(tthis)), pfoo);
}


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

x86 assembly (clang, -O2):
<server_list_unlink>:
jmp    1030 <genlist_unlink@plt>

LLVM IR (-O0):
%struct.server_list = type { i32 }
%struct.server = type { i32 }
%struct.genlist = type { i32 }
define void @server_list_unlink(%struct.server_list* %0, %struct.server* %1) {
%3 = alloca %struct.server_list*
%4 = alloca %struct.server*
store %struct.server_list* %0, %struct.server_list** %3
store %struct.server* %1, %struct.server** %4
%5 = load %struct.server_list*, %struct.server_list** %3
%6 = bitcast %struct.server_list* %5 to %struct.genlist*
%7 = load %struct.server*, %struct.server** %4
%8 = call i32 @genlist_unlink(%struct.genlist* %6, %struct.server* %7)
ret void
}

LLVM IR (-O2):
%struct.server_list = type { i32 }
%struct.server = type { i32 }
%struct.genlist = type { i32 }
define void @server_list_unlink(%struct.server_list* %0, %struct.server* %1) {
%3 = bitcast %struct.server_list* %0 to %struct.genlist*
%4 = tail call i32 @genlist_unlink(%struct.genlist* %3, %struct.server* %1)
ret void
}
int isgraph(int ch) { return (((ch >= 33) && (ch <= 126))); }


x86 assembly (clang, -O0):
<isgraph>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x21,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <isgraph+0x20>
cmpl   $0x7e,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isgraph>:
add    $0xffffffdf,%edi
xor    %eax,%eax
cmp    $0x5e,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @isgraph(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 33
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 126
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @isgraph(i32 %0) {
%2 = add i32 %0, -33
%3 = icmp ult i32 %2, 94
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ put8(int);
void mov_preg32_reg32(int reg1, int reg2) {
  put8(0x89);
  put8((reg2 << 3) | reg1);
}


x86 assembly (clang, -O0):
<mov_preg32_reg32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x89,%edi
call   1030 <put8@plt>
mov    -0x8(%rbp),%edi
shl    $0x3,%edi
or     -0x4(%rbp),%edi
call   1030 <put8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mov_preg32_reg32>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x89,%edi
call   1030 <put8@plt>
shl    $0x3,%ebx
or     %ebp,%ebx
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <put8@plt>

LLVM IR (-O0):
define void @mov_preg32_reg32(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @put8(i32 137)
%6 = load i32, i32* %4
%7 = shl i32 %6, 3
%8 = load i32, i32* %3
%9 = or i32 %7, %8
%10 = call i32 @put8(i32 %9)
ret void
}

LLVM IR (-O2):
define void @mov_preg32_reg32(i32 %0, i32 %1) {
%3 = tail call i32 @put8(i32 137)
%4 = shl i32 %1, 3
%5 = or i32 %4, %0
%6 = tail call i32 @put8(i32 %5)
ret void
}
/* Variables and functions */
scalar_t__ htbl_create(unsigned int, unsigned int (*)(void *), int);
void *rtl_htblCreate(unsigned int size, unsigned int (*hashfunc)(void *)) {
  return (void *)htbl_create(size, hashfunc, 1);
}


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

x86 assembly (clang, -O2):
<rtl_htblCreate>:
mov    $0x1,%edx
jmp    1030 <htbl_create@plt>

LLVM IR (-O0):
define i8* @rtl_htblCreate(i32 %0, i32 (i8*)* %1) {
%3 = alloca i32
%4 = alloca i32 (i8*)*
store i32 %0, i32* %3
store i32 (i8*)* %1, i32 (i8*)** %4
%5 = load i32, i32* %3
%6 = load i32 (i8*)*, i32 (i8*)** %4
%7 = call i64 @htbl_create(i32 %5, i32 (i8*)* %6, i32 1)
%8 = inttoptr i64 %7 to i8*
ret i8* %8
}

LLVM IR (-O2):
define i8* @rtl_htblCreate(i32 %0, i32 (i8*)* %1) {
%3 = tail call i64 @htbl_create(i32 %0, i32 (i8*)* %1, i32 1)
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
int funcX() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @funcX() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  char t[10];
  printf("Hello world!\n");
  (void)strcpy(t, argv[0]);
  return (int)t[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)
lea    0xec3(%rip),%rdi
call   1040 <printf@plt>
lea    -0x1a(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcpy@plt>
movsbl -0x1a(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0xed1(%rip),%rdi
call   1040 <puts@plt>
mov    (%rbx),%rsi
lea    0x6(%rsp),%rdi
call   1030 <strcpy@plt>
movsbl 0x6(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hello world!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @strcpy(i8* %8, i8* %11)
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
@str = [13 x i8] c"Hello world!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%6 = load i8*, i8** %1
%7 = call i32 @strcpy(i8* %4, i8* %6)
%8 = load i8, i8* %4
%9 = sext i8 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void cough(int n) {
  for (int i = 0; i < n; i++) {
    printf("cough\n");
  }
}


x86 assembly (clang, -O0):
<cough>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1148 <cough+0x38>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <cough+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cough>:
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    113d <cough+0x2d>
mov    %edi,%ebx
lea    0xedf(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
add    $0xffffffff,%ebx
jne    1130 <cough+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@str = [6 x i8] c"cough\00"
define void @cough(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %4, label %3
3: ; preds = %4, %1
ret void
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ 0, %1 ]
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %0
br i1 %8, label %3, label %4
}
int test_imm_B1uint8_mem(unsigned char *val) {
  return ((*val) & (-0xB1 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_B1uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 79
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int arch_timer_init(void) { return 32; }


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

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

LLVM IR (-O0):
define i32 @arch_timer_init() {
ret i32 32
}

LLVM IR (-O2):
define i32 @arch_timer_init() {
ret i32 32
}
/* Variables and functions */
char *strstr(char *, char const *);
int g_pos(char *str, const char *to_find) {
  char *pp;
  pp = strstr(str, to_find);
  if (pp == 0) {
    return -1;
  }
  return (pp - str);
}


x86 assembly (clang, -O0):
<g_pos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1148 <g_pos+0x38>
movl   $0xffffffff,-0x4(%rbp)
jmp    1156 <g_pos+0x46>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_pos>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strstr@plt>
mov    %eax,%ecx
sub    %ebx,%ecx
cmp    $0x1,%rax
sbb    %eax,%eax
or     %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @g_pos(i8* %0, i8* nocapture %1) {
%3 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = icmp eq i8* %3, null
%5 = ptrtoint i8* %3 to i64
%6 = ptrtoint i8* %0 to i64
%7 = sub i64 %5, %6
%8 = trunc i64 %7 to i32
%9 = select i1 %4, i32 -1, i32 %8
ret i32 %9
}
float sinapprox(float val) {
  float val2 = val * val;
  return val *
         (0.99997937679290771484375f +
          val2 *
              (-0.166624367237091064453125f +
               val2 *
                   (8.30897875130176544189453125e-3f +
                    val2 *
                        (-1.92649182281456887722015380859375e-4f +
                         val2 * 2.147840177713078446686267852783203125e-6f))));
}


x86 assembly (clang, -O0):
<sinapprox>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0x8(%rbp),%xmm2
movss  -0x8(%rbp),%xmm3
movss  -0x8(%rbp),%xmm4
movss  0xed3(%rip),%xmm5
mulss  %xmm5,%xmm4
movss  0xecb(%rip),%xmm5
addss  %xmm5,%xmm4
mulss  %xmm4,%xmm3
movss  0xeb3(%rip),%xmm4
addss  %xmm4,%xmm3
mulss  %xmm3,%xmm2
movss  0xe9f(%rip),%xmm3
addss  %xmm3,%xmm2
mulss  %xmm2,%xmm1
movss  0xe8b(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinapprox>:
movaps %xmm0,%xmm1
mulss  %xmm0,%xmm1
movss  0xef1(%rip),%xmm2
mulss  %xmm1,%xmm2
addss  0xee9(%rip),%xmm2
mulss  %xmm1,%xmm2
addss  0xee1(%rip),%xmm2
mulss  %xmm1,%xmm2
addss  0xed9(%rip),%xmm2
mulss  %xmm1,%xmm2
addss  0xed1(%rip),%xmm2
mulss  %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @sinapprox(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = load float, float* %2
%6 = fmul float %4, %5
store float %6, float* %3
%7 = load float, float* %2
%8 = load float, float* %3
%9 = load float, float* %3
%10 = load float, float* %3
%11 = load float, float* %3
%12 = call float @llvm.fmuladd.f32(float %11, float 0x3EC20473A0000000, float 0xBF29403BE0000000)
%13 = call float @llvm.fmuladd.f32(float %10, float %12, float 0x3F81044C40000000)
%14 = call float @llvm.fmuladd.f32(float %9, float %13, float 0xBFC553F280000000)
%15 = call float @llvm.fmuladd.f32(float %8, float %14, float 0x3FEFFFD4C0000000)
%16 = fmul float %7, %15
ret float %16
}

LLVM IR (-O2):
define float @sinapprox(float %0) {
%2 = fmul float %0, %0
%3 = tail call float @llvm.fmuladd.f32(float %2, float 0x3EC20473A0000000, float 0xBF29403BE0000000)
%4 = tail call float @llvm.fmuladd.f32(float %2, float %3, float 0x3F81044C40000000)
%5 = tail call float @llvm.fmuladd.f32(float %2, float %4, float 0xBFC553F280000000)
%6 = tail call float @llvm.fmuladd.f32(float %2, float %5, float 0x3FEFFFD4C0000000)
%7 = fmul float %6, %0
ret float %7
}
int test_imm_BEuint16_reg(unsigned short val) {
  return ((val) & (-0xBE << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_BEuint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffff42,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_BEuint16_reg>:
test   $0xff42,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_BEuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -190
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}