xunge/DecIR huggingface dataset:
int arch_hack(const char *cmd) {}


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

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

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

LLVM IR (-O2):
define i32 @arch_hack(i8* nocapture readnone %0) {
ret i32 undef
}
int fixednamep(s)
char *s;
{
  return (!strncmp("/", s, 1) || !strncmp("./", s, 2) || !strncmp("../", s, 3));
}


x86 assembly (clang, -O0):
<fixednamep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xedb(%rip),%rdi
mov    $0x1,%edx
call   1030 <strncmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     1186 <fixednamep+0x76>
mov    -0x8(%rbp),%rsi
lea    0xeb5(%rip),%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
mov    %eax,%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     1186 <fixednamep+0x76>
mov    -0x8(%rbp),%rsi
lea    0xe8f(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fixednamep>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebp
cmpb   $0x2f,(%rdi)
je     1154 <fixednamep+0x44>
mov    %rdi,%rbx
lea    0xeda(%rip),%rdi
mov    $0x2,%edx
mov    %rbx,%rsi
call   1030 <strncmp@plt>
test   %eax,%eax
je     1154 <fixednamep+0x44>
lea    0xec1(%rip),%rdi
mov    $0x3,%edx
mov    %rbx,%rsi
call   1030 <strncmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"/\00"
@.str.1 = [3 x i8] c"./\00"
@.str.2 = [4 x i8] c"../\00"
define i32 @fixednamep(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strncmp(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %3, i64 1)
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %15
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @strncmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7, i64 2)
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = load i8*, i8** %2
%12 = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %11, i64 3)
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
br label %15
15: ; preds = %10, %6, %1
%16 = phi i1 [ true, %6 ], [ true, %1 ], [ %14, %10 ]
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"./\00"
@.str.2 = [4 x i8] c"../\00"
define i32 @fixednamep(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 47
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = tail call i32 @strncmp(i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0, i64 2)
%6 = icmp eq i32 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = tail call i32 @strncmp(i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %0, i64 3)
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %7, %4, %1
%12 = phi i32 [ 1, %4 ], [ 1, %1 ], [ %10, %7 ]
ret i32 %12
}
int prio_in_range(int prio) {
  if ((prio < 0) || (prio > 7))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<prio_in_range>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     111b <prio_in_range+0x1b>
cmpl   $0x7,-0x8(%rbp)
jle    1127 <prio_in_range+0x27>
movl   $0x0,-0x4(%rbp)
jmp    112e <prio_in_range+0x2e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<prio_in_range>:
xor    %eax,%eax
cmp    $0x8,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @prio_in_range(i32 %0) {
%2 = icmp ult i32 %0, 8
%3 = zext i1 %2 to i32
ret i32 %3
}
int empty() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @empty() {
ret i32 0
}
void *allocate(nb)
int nb;
{
  void *mem;
  mem = (void *)calloc(nb, 1);
  if (mem == 0)
    error("allocate: not enuf memory (%d bytes)\n", nb);
  return (mem);
}


x86 assembly (clang, -O0):
<allocate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rdi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1159 <allocate+0x39>
mov    -0x4(%rbp),%esi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1040 <error@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allocate>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
movslq %edi,%rdi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114a <allocate+0x2a>
lea    0xebf(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <error@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"allocate: not enuf memory (%d bytes)\0A\00"
define i8* @allocate(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = call i8* @calloc(i64 %5, i64 1)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* %2
%11 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @error to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %9, %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@.str = [38 x i8] c"allocate: not enuf memory (%d bytes)\0A\00"
define i8* @allocate(i32 %0) {
%2 = sext i32 %0 to i64
%3 = tail call i8* @calloc(i64 %2, i64 1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @error to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %7
7: ; preds = %5, %1
ret i8* %3
}
/* Variables and functions */
float nearbyintf(float);
float rintf(float x) { return nearbyintf(x); }


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

x86 assembly (clang, -O2):
<rintf>:
jmp    1030 <nearbyintf@plt>

LLVM IR (-O0):
define float @rintf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @llvm.nearbyint.f32(float %3)
ret float %4
}

LLVM IR (-O2):
define float @rintf(float %0) {
%2 = tail call float @llvm.nearbyint.f32(float %0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ f2(int);
void f1(int age) {
  int local = 10;
  f2(age + local);
}


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

x86 assembly (clang, -O2):
<f1>:
add    $0xa,%edi
jmp    1030 <f2@plt>

LLVM IR (-O0):
define void @f1(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 10, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = add nsw i32 %4, %5
%7 = call i32 @f2(i32 %6)
ret void
}

LLVM IR (-O2):
define void @f1(i32 %0) {
%2 = add nsw i32 %0, 10
%3 = tail call i32 @f2(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LoadArtworkInfo();
void InitArtworkInfo() { LoadArtworkInfo(); }


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

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

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

LLVM IR (-O2):
define void @InitArtworkInfo() {
%1 = tail call i32 (...) @LoadArtworkInfo()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ link_error();
void utest(unsigned int x) {
  if (x >> 0 != x)
    link_error();
  if (x << 0 != x)
    link_error();
  if (0 << x != 0)
    link_error();
  if (0 >> x != 0)
    link_error();
  if (-1 >> x != -1)
    link_error();
  if (~0 >> x != ~0)
    link_error();
}


x86 assembly (clang, -O0):
<utest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x0,%eax
cmp    -0x4(%rbp),%eax
je     1131 <utest+0x21>
mov    $0x0,%al
call   1030 <link_error@plt>
mov    -0x4(%rbp),%eax
shl    $0x0,%eax
cmp    -0x4(%rbp),%eax
je     1147 <utest+0x37>
mov    $0x0,%al
call   1030 <link_error@plt>
mov    -0x4(%rbp),%ecx
xor    %eax,%eax
shl    %cl,%eax
cmp    $0x0,%eax
je     115e <utest+0x4e>
mov    $0x0,%al
call   1030 <link_error@plt>
mov    -0x4(%rbp),%ecx
xor    %eax,%eax
sar    %cl,%eax
cmp    $0x0,%eax
je     1175 <utest+0x65>
mov    $0x0,%al
call   1030 <link_error@plt>
mov    -0x4(%rbp),%ecx
mov    $0xffffffff,%eax
sar    %cl,%eax
cmp    $0xffffffff,%eax
je     118f <utest+0x7f>
mov    $0x0,%al
call   1030 <link_error@plt>
mov    -0x4(%rbp),%ecx
mov    $0xffffffff,%eax
sar    %cl,%eax
cmp    $0xffffffff,%eax
je     11a9 <utest+0x99>
mov    $0x0,%al
call   1030 <link_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @utest(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 0
%5 = load i32, i32* %2
%6 = icmp ne i32 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 (...) @link_error()
br label %9
9: ; preds = %7, %1
%10 = load i32, i32* %2
%11 = shl i32 %10, 0
%12 = load i32, i32* %2
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = call i32 (...) @link_error()
br label %16
16: ; preds = %14, %9
%17 = load i32, i32* %2
%18 = shl i32 0, %17
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 (...) @link_error()
br label %22
22: ; preds = %20, %16
%23 = load i32, i32* %2
%24 = ashr i32 0, %23
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = call i32 (...) @link_error()
br label %28
28: ; preds = %26, %22
%29 = load i32, i32* %2
%30 = ashr i32 -1, %29
%31 = icmp ne i32 %30, -1
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = call i32 (...) @link_error()
br label %34
34: ; preds = %32, %28
%35 = load i32, i32* %2
%36 = ashr i32 -1, %35
%37 = icmp ne i32 %36, -1
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = call i32 (...) @link_error()
br label %40
40: ; preds = %38, %34
ret void
}

LLVM IR (-O2):
define void @utest(i32 %0) {
ret void
}
int libc_strlen(const char *str) {
  int len = 0;
  while (*str++)
    len++;
  return len;
}


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

x86 assembly (clang, -O2):
<libc_strlen>:
cmpb   $0x0,(%rdi)
je     111c <libc_strlen+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <libc_strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @libc_strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
int EOF;
int fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ fputc(int, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main() {
  int c;
  while ((c = fgetc(stdin)) != EOF) {
    fputc(c, stdout);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e99(%rip),%rcx
cmp    (%rcx),%eax
je     1165 <main+0x45>
mov    -0x8(%rbp),%edi
mov    0x2e77(%rip),%rax
mov    (%rax),%esi
call   1040 <fputc@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    0x2ebc(%rip),%r14
mov    (%r14),%edi
call   1030 <fgetc@plt>
mov    0x2ea5(%rip),%r15
cmp    (%r15),%eax
je     1166 <main+0x46>
mov    0x2e89(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%esi
mov    %eax,%edi
call   1040 <fputc@plt>
mov    (%r14),%edi
call   1030 <fgetc@plt>
cmp    (%r15),%eax
jne    1150 <main+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@EOF = global i32 0
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %8, %0
%4 = load i32, i32* @stdin
%5 = call i32 @fgetc(i32 %4)
store i32 %5, i32* %2
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = load i32, i32* %2
%10 = load i32, i32* @stdout
%11 = call i32 @fputc(i32 %9, i32 %10)
br label %3
12: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@EOF = global i32 0
@stdout = global i32 0
define i32 @main() {
%1 = load i32, i32* @stdin
%2 = tail call i32 @fgetc(i32 %1)
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %13, label %5
5: ; preds = %0, %5
%6 = phi i32 [ %10, %5 ], [ %2, %0 ]
%7 = load i32, i32* @stdout
%8 = tail call i32 @fputc(i32 %6, i32 %7)
%9 = load i32, i32* @stdin
%10 = tail call i32 @fgetc(i32 %9)
%11 = load i32, i32* @EOF
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %5
13: ; preds = %5, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, double *);
int main(void) {
  double r;
  scanf("%lf", &r);
  printf("VOLUME = %.3f\n", 4.0 / 3.0 * 3.14159 * r * r * r);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movsd  0xeb9(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee0(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
movsd  (%rsp),%xmm1
movsd  0xec3(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [15 x i8] c"VOLUME = %.3f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%4 = load double, double* %2
%5 = fmul double 0x4010C1514ABD0449, %4
%6 = load double, double* %2
%7 = fmul double %5, %6
%8 = load double, double* %2
%9 = fmul double %7, %8
%10 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), double %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [15 x i8] c"VOLUME = %.3f\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = load double, double* %1
%5 = fmul double %4, 0x4010C1514ABD0449
%6 = fmul double %4, %5
%7 = fmul double %4, %6
%8 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), double %7)
ret i32 0
}
/* Type definitions */
struct inode {
  int dummy;
};
struct dentry {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ d_instantiate(struct dentry *, struct inode *);
int /*<<< orphan*/ d_rehash(struct dentry *);
__attribute__((always_)) void d_add(struct dentry *entry, struct inode *inode) {
  d_instantiate(entry, inode);
  d_rehash(entry);
}


x86 assembly (clang, -O0):
<d_add>:
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 <d_instantiate@plt>
mov    -0x8(%rbp),%rdi
call   1040 <d_rehash@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_add>:
push   %rbx
mov    %rdi,%rbx
call   1030 <d_instantiate@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <d_rehash@plt>

LLVM IR (-O0):
%struct.dentry = type { i32 }
%struct.inode = type { i32 }
define void @d_add(%struct.dentry* %0, %struct.inode* %1) {
%3 = alloca %struct.dentry*
%4 = alloca %struct.inode*
store %struct.dentry* %0, %struct.dentry** %3
store %struct.inode* %1, %struct.inode** %4
%5 = load %struct.dentry*, %struct.dentry** %3
%6 = load %struct.inode*, %struct.inode** %4
%7 = call i32 @d_instantiate(%struct.dentry* %5, %struct.inode* %6)
%8 = load %struct.dentry*, %struct.dentry** %3
%9 = call i32 @d_rehash(%struct.dentry* %8)
ret void
}

LLVM IR (-O2):
%struct.dentry = type { i32 }
%struct.inode = type { i32 }
define void @d_add(%struct.dentry* %0, %struct.inode* %1) {
%3 = tail call i32 @d_instantiate(%struct.dentry* %0, %struct.inode* %1)
%4 = tail call i32 @d_rehash(%struct.dentry* %0)
ret void
}
/* Type definitions */
struct timespec {
  int tv_sec;
  int tv_nsec;
};
typedef int int64_t;

/* Variables and functions */
struct timespec nano_to_time(int64_t n) {
  struct timespec ret;
  ret.tv_sec = n / 1000000000;
  ret.tv_nsec = n % 1000000000;
  return ret;
}


x86 assembly (clang, -O0):
<nano_to_time>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3b9aca00,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3b9aca00,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nano_to_time>:
movslq %edi,%rcx
imul   $0x44b82fa1,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x3c,%rax
add    %edx,%eax
imul   $0x3b9aca00,%eax,%edx
sub    %edx,%ecx
shl    $0x20,%rcx
or     %rcx,%rax
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
define i64 @nano_to_time(i32 %0) {
%2 = alloca %struct.timespec
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = sdiv i32 %4, 1000000000
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i32 0, i32 0
store i32 %5, i32* %6
%7 = load i32, i32* %3
%8 = srem i32 %7, 1000000000
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i32 0, i32 1
store i32 %8, i32* %9
%10 = bitcast %struct.timespec* %2 to i64*
%11 = load i64, i64* %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @nano_to_time(i32 %0) {
%2 = sdiv i32 %0, 1000000000
%3 = srem i32 %0, 1000000000
%4 = zext i32 %3 to i64
%5 = shl nuw i64 %4, 32
%6 = zext i32 %2 to i64
%7 = or i64 %5, %6
ret i64 %7
}
/* Variables and functions */
bool is_eol(int c) {
  if (c == '\n') {
    return true;
  }
  return false;
}


x86 assembly (clang, -O0):
<is_eol>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jne    111d <is_eol+0x1d>
movl   $0x1,-0x4(%rbp)
jmp    1124 <is_eol+0x24>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_eol>:
xor    %eax,%eax
cmp    $0xa,%edi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @is_eol(i32 %0) {
%2 = icmp eq i32 %0, 10
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int h, p;
  scanf("%d %d", &h, &p);
  printf("%.2lf\n", h / (double)p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
cvtsi2sdl -0x8(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
lea    0xeaa(%rip),%rdi
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    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
cvtsi2sdl 0x4(%rsp),%xmm0
cvtsi2sdl (%rsp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [7 x i8] c"%.2lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%5 = load i32, i32* %2
%6 = sitofp i32 %5 to double
%7 = load i32, i32* %3
%8 = sitofp i32 %7 to double
%9 = fdiv double %6, %8
%10 = fptosi double %9 to i32
%11 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [7 x i8] c"%.2lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = sitofp i32 %6 to double
%8 = load i32, i32* %2
%9 = sitofp i32 %8 to double
%10 = fdiv double %7, %9
%11 = fptosi double %10 to i32
%12 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %11)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
unsigned int aarch64_banked_spsr_index(unsigned int el) {
  static const unsigned int map[4] = {
      0,
      0,
      6,
      7,
  };
  assert(el >= 1 && el <= 3);
  return map[el];
}


x86 assembly (clang, -O0):
<aarch64_banked_spsr_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x1,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jb     1134 <aarch64_banked_spsr_index+0x24>
cmpl   $0x3,-0x4(%rbp)
setbe  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0xeb3(%rip),%rax
mov    (%rax,%rcx,4),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aarch64_banked_spsr_index>:
push   %rbx
mov    %edi,%ebx
lea    -0x1(%rbx),%eax
xor    %edi,%edi
cmp    $0x3,%eax
setb   %dil
call   1030 <assert@plt>
mov    %ebx,%eax
lea    0xed3(%rip),%rcx
mov    (%rcx,%rax,4),%eax
pop    %rbx
ret

LLVM IR (-O0):
@aarch64_banked_spsr_index.map = internal constant [4 x i32] [i32 0, i32 0, i32 6, i32 7]
define i32 @aarch64_banked_spsr_index(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp uge i32 %3, 1
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp ule i32 %6, 3
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i32, i32* %2
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds [4 x i32], [4 x i32]* @aarch64_banked_spsr_index.map, i64 0, i64 %13
%15 = load i32, i32* %14
ret i32 %15
}

LLVM IR (-O2):
@aarch64_banked_spsr_index.map = internal unnamed_addr constant [4 x i32] [i32 0, i32 0, i32 6, i32 7]
define i32 @aarch64_banked_spsr_index(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 3
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = zext i32 %0 to i64
%7 = getelementptr inbounds [4 x i32], [4 x i32]* @aarch64_banked_spsr_index.map, i64 0, i64 %6
%8 = load i32, i32* %7
ret i32 %8
}
/* Variables and functions */
int real_main(int, char **);
main(int argc, char *argv[]) { return real_main(argc, argv); }


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)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <real_main@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1030 <real_main@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @real_main(i32 %0, i8** %1)
ret i32 %3
}
void grpc_security_init(void) {}


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

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

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

LLVM IR (-O2):
define void @grpc_security_init() {
ret void
}
int test_imm_37int8_reg(signed char val) {
  return ((val) & (-0x37 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_37int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xffffffc9,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_37int8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, -55
%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_37int8_reg(i8 signext %0) {
%2 = and i8 %0, -55
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ assert(void *);
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
__attribute__((__used__)) void checked_free(void *p, size_t size) {
  assert(p);
  free(p);
  memset(p, 0, size);
}


x86 assembly (clang, -O0):
<checked_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
xor    %esi,%esi
call   1040 <memset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checked_free>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <memset@plt>

LLVM IR (-O0):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void (i8*, i64)* @checked_free to i8*)], section "llvm.metadata"
define void @checked_free(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = call i32 @assert(i8* %5)
%7 = load i8*, i8** %3
%8 = call i32 @free(i8* %7)
%9 = load i8*, i8** %3
%10 = load i64, i64* %4
%11 = call i32 @memset(i8* %9, i32 0, i64 %10)
ret void
}

LLVM IR (-O2):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void (i8*, i64)* @checked_free to i8*)], section "llvm.metadata"
define void @checked_free(i8* %0, i64 %1) {
%3 = tail call i32 @assert(i8* %0)
%4 = tail call i32 @free(i8* %0)
%5 = tail call i32 @memset(i8* %0, i32 0, i64 %1)
ret void
}
void of_exit(void) {
  struct {
    const char *name;
  } args;
  for (;;) {
    args.name = "exit";
    of(&args);
  }
}


x86 assembly (clang, -O0):
<of_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <of@plt>
jmp    1118 <of_exit+0x8>

x86 assembly (clang, -O2):
<of_exit>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%r14
mov    %rsp,%rbx
xchg   %ax,%ax
mov    %r14,(%rsp)
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <of@plt>
jmp    1120 <of_exit+0x10>

LLVM IR (-O0):
%struct.anon = type { i8* }
@.str = [5 x i8] c"exit\00"
define void @of_exit() {
%1 = alloca %struct.anon
br label %2
2: ; preds = %2, %0
%3 = getelementptr inbounds %struct.anon, %struct.anon* %1, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = call i32 (%struct.anon*, ...) bitcast (i32 (...)* @of to i32 (%struct.anon*, ...)*)(%struct.anon* %1)
br label %2
}

LLVM IR (-O2):
%struct.anon = type { i8* }
@.str = [5 x i8] c"exit\00"
define void @of_exit() {
%1 = alloca %struct.anon
%2 = bitcast %struct.anon* %1 to i8*
%3 = getelementptr inbounds %struct.anon, %struct.anon* %1, i64 0, i32 0
br label %4
4: ; preds = %4, %0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %3
%5 = call i32 (%struct.anon*, ...) bitcast (i32 (...)* @of to i32 (%struct.anon*, ...)*)(%struct.anon* %1)
br label %4
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
uint32_t CCFGRead_XOSC_FREQ(void) {
  return (
      ((*((volatile unsigned long *)(0x50003000 + 0x00001FB4))) & 0x000C0000) >>
      18);
}


x86 assembly (clang, -O0):
<CCFGRead_XOSC_FREQ>:
push   %rbp
mov    %rsp,%rbp
mov    $0x50004fb4,%eax
mov    (%rax),%rax
and    $0xc0000,%rax
shr    $0x12,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CCFGRead_XOSC_FREQ>:
mov    0x50004fb4,%rax
50
shr    $0x12,%eax
and    $0x3,%eax
ret

LLVM IR (-O0):
define i64 @CCFGRead_XOSC_FREQ() {
%1 = load volatile i64, i64* inttoptr (i64 1342197684 to i64*)
%2 = and i64 %1, 786432
%3 = lshr i64 %2, 18
ret i64 %3
}

LLVM IR (-O2):
define i64 @CCFGRead_XOSC_FREQ() {
%1 = load volatile i64, i64* inttoptr (i64 1342197684 to i64*)
%2 = lshr i64 %1, 18
%3 = and i64 %2, 3
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int create_tcp_socket() {
  int socket_desc;
  if ((socket_desc = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
    perror("Can't create TCP socket");
    exit(1);
  }
  return socket_desc;
}


x86 assembly (clang, -O0):
<create_tcp_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
mov    0x2e88(%rip),%rax
mov    (%rax),%esi
mov    0x2e8f(%rip),%rax
mov    (%rax),%edx
call   1050 <socket@plt>
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jge    117a <create_tcp_socket+0x4a>
lea    0xe95(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_tcp_socket>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
mov    0x2e8f(%rip),%rax
mov    (%rax),%esi
mov    0x2e96(%rip),%rax
mov    (%rax),%edx
call   1050 <socket@plt>
test   %eax,%eax
js     1157 <create_tcp_socket+0x27>
pop    %rcx
ret
lea    0xea2(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str = [24 x i8] c"Can't create TCP socket\00"
define i32 @create_tcp_socket() {
%1 = alloca i32
%2 = load i32, i32* @AF_INET
%3 = load i32, i32* @SOCK_STREAM
%4 = load i32, i32* @IPPROTO_TCP
%5 = call i32 @socket(i32 %2, i32 %3, i32 %4)
store i32 %5, i32* %1
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %0
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str = [24 x i8] c"Can't create TCP socket\00"
define i32 @create_tcp_socket() {
%1 = load i32, i32* @AF_INET
%2 = load i32, i32* @SOCK_STREAM
%3 = load i32, i32* @IPPROTO_TCP
%4 = tail call i32 @socket(i32 %1, i32 %2, i32 %3)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %0
ret i32 %4
}
int test_imm_13uint16_reg(unsigned short val) {
  return ((val) & (-0x13 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_13uint16_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, -19
%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_13uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -19
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void rop3_64_0_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = ~*D;
  stk2 = S & stk3;
  stk1 = T & stk2;
  *D = (stk1 & S) | (stk1 & (~T)) | (T & (~S) & *D);
}


x86 assembly (clang, -O0):
<rop3_64_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
xor    $0xffffffff,%eax
mov    %al,-0xd(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xd(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
movzbl -0xb(%rbp),%ecx
movzbl -0xa(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
movzbl -0xa(%rbp),%ecx
movzbl -0x9(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
mov    -0x8(%rbp),%rdx
movzbl (%rdx),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_64_0_1>:
mov    %edx,%eax
and    %sil,%al
not    %sil
and    %dl,%sil
xor    %al,%sil
and    (%rdi),%sil
xor    %al,%sil
mov    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_64_0_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8*, i8** %4
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = xor i32 %12, -1
%14 = trunc i32 %13 to i8
store i8 %14, i8* %9
%15 = load i8, i8* %5
%16 = zext i8 %15 to i32
%17 = load i8, i8* %9
%18 = zext i8 %17 to i32
%19 = and i32 %16, %18
%20 = trunc i32 %19 to i8
store i8 %20, i8* %8
%21 = load i8, i8* %6
%22 = zext i8 %21 to i32
%23 = load i8, i8* %8
%24 = zext i8 %23 to i32
%25 = and i32 %22, %24
%26 = trunc i32 %25 to i8
store i8 %26, i8* %7
%27 = load i8, i8* %7
%28 = zext i8 %27 to i32
%29 = load i8, i8* %5
%30 = zext i8 %29 to i32
%31 = and i32 %28, %30
%32 = load i8, i8* %7
%33 = zext i8 %32 to i32
%34 = load i8, i8* %6
%35 = zext i8 %34 to i32
%36 = xor i32 %35, -1
%37 = and i32 %33, %36
%38 = or i32 %31, %37
%39 = load i8, i8* %6
%40 = zext i8 %39 to i32
%41 = load i8, i8* %5
%42 = zext i8 %41 to i32
%43 = xor i32 %42, -1
%44 = and i32 %40, %43
%45 = load i8*, i8** %4
%46 = load i8, i8* %45
%47 = zext i8 %46 to i32
%48 = and i32 %44, %47
%49 = or i32 %38, %48
%50 = trunc i32 %49 to i8
%51 = load i8*, i8** %4
store i8 %50, i8* %51
ret void
}

LLVM IR (-O2):
define void @rop3_64_0_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = xor i8 %4, -1
%6 = and i8 %2, %1
%7 = and i8 %6, %5
%8 = xor i8 %1, -1
%9 = and i8 %8, %2
%10 = and i8 %9, %4
%11 = or i8 %7, %10
store i8 %11, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SV_SendServerCommand(void *, int /*<<< orphan*/);
int /*<<< orphan*/ va(char *, char *, char *, char *);
void SendItemsChanges(char *item, char *dest, char *value) {
  if (!item || !dest || !value)
    return;
  SV_SendServerCommand(((void *)0), va("itch %s %s %s", item, dest, value));
}


x86 assembly (clang, -O0):
<SendItemsChanges>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1155 <SendItemsChanges+0x35>
cmpq   $0x0,-0x10(%rbp)
je     1155 <SendItemsChanges+0x35>
cmpq   $0x0,-0x18(%rbp)
jne    115a <SendItemsChanges+0x3a>
jmp    117d <SendItemsChanges+0x5d>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe93(%rip),%rdi
call   1040 <va@plt>
mov    %eax,%esi
xor    %eax,%eax
mov    %eax,%edi
call   1030 <SV_SendServerCommand@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SendItemsChanges>:
test   %rdi,%rdi
je     114f <SendItemsChanges+0x2f>
mov    %rdx,%rcx
mov    %rsi,%rdx
test   %rsi,%rsi
je     114f <SendItemsChanges+0x2f>
test   %rcx,%rcx
je     114f <SendItemsChanges+0x2f>
push   %rax
mov    %rdi,%rsi
lea    0xec0(%rip),%rdi
call   1040 <va@plt>
xor    %edi,%edi
mov    %eax,%esi
pop    %rax
jmp    1030 <SV_SendServerCommand@plt>
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"itch %s %s %s\00"
define void @SendItemsChanges(i8* %0, i8* %1, i8* %2) {
%4 = icmp ne i8* %0, null
%5 = icmp ne i8* %1, null
%6 = and i1 %4, %5
%7 = icmp ne i8* %2, null
%8 = and i1 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = tail call i32 @va(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i8* %2)
%11 = tail call i32 @SV_SendServerCommand(i8* null, i32 %10)
br label %12
12: ; preds = %3, %9
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("Hello thon");
  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
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [11 x i8] c"Hello thon\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 ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"Hello thon\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void put_16(unsigned char *p, unsigned int v) {
  p[1] = (unsigned char)((v)&0xff);
  p[0] = (unsigned char)(((v) >> 8) & 0xff);
}


x86 assembly (clang, -O0):
<put_16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_16>:
rol    $0x8,%si
mov    %si,(%rdi)
ret

LLVM IR (-O0):
define void @put_16(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = and i32 %5, 255
%7 = trunc i32 %6 to i8
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %7, i8* %9
%10 = load i32, i32* %4
%11 = lshr i32 %10, 8
%12 = and i32 %11, 255
%13 = trunc i32 %12 to i8
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 0
store i8 %13, i8* %15
ret void
}

LLVM IR (-O2):
define void @put_16(i8* nocapture writeonly %0, i32 %1) {
%3 = trunc i32 %1 to i8
%4 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %3, i8* %4
%5 = lshr i32 %1, 8
%6 = trunc i32 %5 to i8
store i8 %6, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_help() {
  printf(
      "802_3 options:\n"
      "--802_3-sap [!] protocol       : 802.3 DSAP/SSAP- 1 byte value (hex)\n"
      "  DSAP and SSAP are always the same.  One SAP applies to both fields\n"
      "--802_3-type [!] protocol      : 802.3 SNAP Type- 2 byte value (hex)\n"
      "  Type implies SAP value 0xaa\n");
}


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

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

LLVM IR (-O0):
@.str = [253 x i8] c"802_3 options:\0A--802_3-sap [!] protocol : 802.3 DSAP/SSAP- 1 byte value (hex)\0A DSAP and SSAP are always the same. One SAP applies to both fields\0A--802_3-type [!] protocol : 802.3 SNAP Type- 2 byte value (hex)\0A Type implies SAP value 0xaa\0A\00"
define void @print_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([253 x i8], [253 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [252 x i8] c"802_3 options:\0A--802_3-sap [!] protocol : 802.3 DSAP/SSAP- 1 byte value (hex)\0A DSAP and SSAP are always the same. One SAP applies to both fields\0A--802_3-type [!] protocol : 802.3 SNAP Type- 2 byte value (hex)\0A Type implies SAP value 0xaa\00"
define void @print_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([252 x i8], [252 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ add_cmd_char(char);
void add_cmd_str(char *s) {
  for (; *s != '\0'; s++)
    add_cmd_char(*s);
}


x86 assembly (clang, -O0):
<add_cmd_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1149 <add_cmd_str+0x39>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <add_cmd_char@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <add_cmd_str+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_cmd_str>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <add_cmd_str+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <add_cmd_char@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <add_cmd_str+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @add_cmd_str(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 @add_cmd_char(i8 signext %5)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int strtol(char const *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ usleep(int);
int main(int argc, const char *argv[]) {
  if (argc != 2) {
    printf("#argument != 1");
    return 1;
  }
  int us = strtol(argv[1], NULL, 10);
  usleep(us);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1168 <main+0x38>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1190 <main+0x60>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <usleep@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    1151 <main+0x21>
mov    0x8(%rsi),%rdi
xor    %ebx,%ebx
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,%edi
call   1050 <usleep@plt>
jmp    1162 <main+0x32>
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [15 x i8] c"#argument != 1\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %11
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @strtol(i8* nocapture %8, i32* null, i32 10)
%10 = tail call i32 @usleep(i32 %9)
br label %11
11: ; preds = %6, %4
%12 = phi i32 [ 1, %4 ], [ 0, %6 ]
ret i32 %12
}