xunge/DecIR huggingface dataset:
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int stat(char *, struct stat *);
int pkg_exists(char *rpm_path) {
  struct stat sbuf;
  return (stat(rpm_path, &sbuf) == -1) ? 0 : 1;
}


x86 assembly (clang, -O0):
<pkg_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <stat@plt>
mov    %eax,%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0xffffffff,%edx
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pkg_exists>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @pkg_exists(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @stat(i8* %4, %struct.stat* %3)
%6 = icmp eq i32 %5, -1
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 0, i32 1
ret i32 %8
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @pkg_exists(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @stat(i8* %0, %struct.stat* %2)
%5 = icmp ne i32 %4, -1
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ link_error();
void foo(void) {
  int j = 256;
  do {
    if (j < 0 || j > 256)
      link_error();
    j--;
  } while (j >= 0);
  if (j != -1)
    link_error();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x100,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1136 <foo+0x26>
cmpl   $0x100,-0x4(%rbp)
jle    113d <foo+0x2d>
mov    $0x0,%al
call   1030 <link_error@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111f <foo+0xf>
cmpl   $0xffffffff,-0x4(%rbp)
je     1161 <foo+0x51>
mov    $0x0,%al
call   1030 <link_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @foo() {
%1 = alloca i32
store i32 256, i32* %1
br label %2
2: ; preds = %13, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 256
br i1 %7, label %8, label %10
8: ; preds = %5, %2
%9 = call i32 (...) @link_error()
br label %10
10: ; preds = %8, %5
%11 = load i32, i32* %1
%12 = add nsw i32 %11, -1
store i32 %12, i32* %1
br label %13
13: ; preds = %10
%14 = load i32, i32* %1
%15 = icmp sge i32 %14, 0
br i1 %15, label %2, label %16
16: ; preds = %13
%17 = load i32, i32* %1
%18 = icmp ne i32 %17, -1
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 (...) @link_error()
br label %21
21: ; preds = %19, %16
ret void
}

LLVM IR (-O2):
define void @foo() {
ret void
}
/* Type definitions */
struct deflate {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct deflate *);
void deflate_free(struct deflate *ctx) { free(ctx); }


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

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

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

LLVM IR (-O2):
%struct.deflate = type { i32 }
define void @deflate_free(%struct.deflate* nocapture %0) {
%2 = tail call i32 @free(%struct.deflate* %0)
ret void
}
unsigned int yac_storage_align_size(unsigned int size) {
  int bits = 0;
  while ((size = size >> 1)) {
    ++bits;
  }
  return (1 << bits);
}


x86 assembly (clang, -O0):
<yac_storage_align_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
je     112e <yac_storage_align_size+0x2e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <yac_storage_align_size+0xe>
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<yac_storage_align_size>:
xor    %ecx,%ecx
cmp    $0x2,%edi
jb     111c <yac_storage_align_size+0x1c>
xor    %ecx,%ecx
mov    %edi,%eax
nopl   0x0(%rax,%rax,1)
shr    %eax
add    $0x1,%ecx
cmp    $0x3,%edi
mov    %eax,%edi
ja     1110 <yac_storage_align_size+0x10>
mov    $0x1,%eax
shl    %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @yac_storage_align_size(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = lshr i32 %5, 1
%7 = add nuw nsw i32 %4, 1
%8 = icmp ult i32 %5, 4
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %7, %3 ]
%11 = shl nuw i32 1, %10
ret i32 %11
}
int shim_call(int number, unsigned long arg1, unsigned long arg2) {
  long (*handle_call)(int number, unsigned long arg1, unsigned long arg2);
  __asm__("movq %%gs:%c1, %0" : "=r"(handle_call) : "i"(40) : "memory");
  return handle_call(number, arg1, arg2);
}


x86 assembly (clang, -O0):
<shim_call>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %gs:0x28,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   *%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shim_call>:
mov    %gs:0x28,%rax
jmp    *%rax

LLVM IR (-O0):
define i32 @shim_call(i32 %0, i64 %1, i64 %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64 (i32, i64, i64)*
store i32 %0, i32* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = call i64 (i32, i64, i64)* asm "movq %gs:${1:c}, $0", "=r,i,~{memory},~{dirflag},~{fpsr},~{flags}"(i32 40)
store i64 (i32, i64, i64)* %8, i64 (i32, i64, i64)** %7
%9 = load i64 (i32, i64, i64)*, i64 (i32, i64, i64)** %7
%10 = load i32, i32* %4
%11 = load i64, i64* %5
%12 = load i64, i64* %6
%13 = call i64 %9(i32 %10, i64 %11, i64 %12)
%14 = trunc i64 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @shim_call(i32 %0, i64 %1, i64 %2) {
%4 = tail call i64 (i32, i64, i64)* asm "movq %gs:${1:c}, $0", "=r,i,~{memory},~{dirflag},~{fpsr},~{flags}"(i32 40)
%5 = tail call i64 %4(i32 %0, i64 %1, i64 %2)
%6 = trunc i64 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef scalar_t__ CRYPTO_THREAD_ID;

/* Variables and functions */
int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b) {
  return (a == b);
}


x86 assembly (clang, -O0):
<CRYPTO_THREAD_compare_id>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CRYPTO_THREAD_compare_id>:
xor    %eax,%eax
cmp    %rsi,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @CRYPTO_THREAD_compare_id(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp eq i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @CRYPTO_THREAD_compare_id(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int btic1h_errfrac4(int, int);
int btic1h_errfrac8(int a, int b) {
  return (btic1h_errfrac4(a >> 4, b >> 4) + btic1h_errfrac4(a & 15, b & 15));
}


x86 assembly (clang, -O0):
<btic1h_errfrac8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
sar    $0x4,%edi
mov    -0x8(%rbp),%esi
sar    $0x4,%esi
call   1030 <btic1h_errfrac4@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
and    $0xf,%edi
mov    -0x8(%rbp),%esi
and    $0xf,%esi
call   1030 <btic1h_errfrac4@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btic1h_errfrac8>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%ebp
sar    $0x4,%edi
sar    $0x4,%esi
call   1030 <btic1h_errfrac4@plt>
mov    %eax,%r14d
and    $0xf,%ebp
and    $0xf,%ebx
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <btic1h_errfrac4@plt>
add    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @btic1h_errfrac8(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = ashr i32 %5, 4
%7 = load i32, i32* %4
%8 = ashr i32 %7, 4
%9 = call i32 @btic1h_errfrac4(i32 %6, i32 %8)
%10 = load i32, i32* %3
%11 = and i32 %10, 15
%12 = load i32, i32* %4
%13 = and i32 %12, 15
%14 = call i32 @btic1h_errfrac4(i32 %11, i32 %13)
%15 = add nsw i32 %9, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @btic1h_errfrac8(i32 %0, i32 %1) {
%3 = ashr i32 %0, 4
%4 = ashr i32 %1, 4
%5 = tail call i32 @btic1h_errfrac4(i32 %3, i32 %4)
%6 = and i32 %0, 15
%7 = and i32 %1, 15
%8 = tail call i32 @btic1h_errfrac4(i32 %6, i32 %7)
%9 = add nsw i32 %8, %5
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ take_input();
int main() {
  take_input();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @take_input()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ print_trace();
void sig_handler(int signo) {
  print_trace();
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<sig_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <print_trace@plt>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<sig_handler>:
push   %rax
xor    %eax,%eax
call   1030 <print_trace@plt>
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define void @sig_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @print_trace()
%4 = load i32, i32* @EXIT_FAILURE
%5 = call i32 @exit(i32 %4)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define void @sig_handler(i32 %0) {
%2 = tail call i32 (...) @print_trace()
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ memfrob(char *, int);
int /*<<< orphan*/ str2hex(char *, char *, int /*<<< orphan*/);
int strlen(char *);
char *frobstr(char *src) {
  char *retval = (char *)malloc(strlen(src) * 2 + 1);
  memfrob(src, strlen(src));
  str2hex(retval, src, 0);
  memfrob(src, strlen(src));
  return (retval);
}


x86 assembly (clang, -O0):
<frobstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%edi
shl    $0x1,%edi
add    $0x1,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1030 <memfrob@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
xor    %edx,%edx
call   1050 <str2hex@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1030 <memfrob@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<frobstr>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <strlen@plt>
lea    (%rax,%rax,1),%edi
add    $0x1,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <memfrob@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1050 <str2hex@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <memfrob@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @frobstr(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = mul nsw i32 %5, 2
%7 = add nsw i32 %6, 1
%8 = call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %3
%10 = load i8*, i8** %2
%11 = load i8*, i8** %2
%12 = call i32 @strlen(i8* %11)
%13 = call i32 @memfrob(i8* %10, i32 %12)
%14 = load i8*, i8** %3
%15 = load i8*, i8** %2
%16 = call i32 @str2hex(i8* %14, i8* %15, i32 0)
%17 = load i8*, i8** %2
%18 = load i8*, i8** %2
%19 = call i32 @strlen(i8* %18)
%20 = call i32 @memfrob(i8* %17, i32 %19)
%21 = load i8*, i8** %3
ret i8* %21
}

LLVM IR (-O2):
define i8* @frobstr(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = shl nsw i32 %2, 1
%4 = or i32 %3, 1
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to i8*
%7 = tail call i32 @strlen(i8* %0)
%8 = tail call i32 @memfrob(i8* %0, i32 %7)
%9 = tail call i32 @str2hex(i8* %6, i8* %0, i32 0)
%10 = tail call i32 @strlen(i8* %0)
%11 = tail call i32 @memfrob(i8* %0, i32 %10)
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ TIOCSCTTY;
int /*<<< orphan*/ die(char *, int /*<<< orphan*/ *, void *);
scalar_t__ ioctl(int, int /*<<< orphan*/, int /*<<< orphan*/);
void setctty(void) {
  if (ioctl(1, TIOCSCTTY, 0) < 0)
    die("ioctl(TIOCSCTTY) failed", NULL, ((void *)-1));
}


x86 assembly (clang, -O0):
<setctty>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
xor    %edx,%edx
call   1030 <ioctl@plt>
cmp    $0x0,%rax
jge    115a <setctty+0x3a>
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xffffffffffffffff,%rdx
call   1040 <die@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<setctty>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%edi
xor    %edx,%edx
call   1030 <ioctl@plt>
test   %rax,%rax
js     113d <setctty+0x1d>
pop    %rax
ret
lea    0xebc(%rip),%rdi
xor    %esi,%esi
mov    $0xffffffffffffffff,%rdx
pop    %rax
jmp    1040 <die@plt>

LLVM IR (-O0):
@TIOCSCTTY = global i32 0
@.str = [24 x i8] c"ioctl(TIOCSCTTY) failed\00"
define void @setctty() {
%1 = load i32, i32* @TIOCSCTTY
%2 = call i64 @ioctl(i32 1, i32 %1, i32 0)
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @die(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32* null, i8* inttoptr (i64 -1 to i8*))
br label %6
6: ; preds = %4, %0
ret void
}

LLVM IR (-O2):
@TIOCSCTTY = global i32 0
@.str = [24 x i8] c"ioctl(TIOCSCTTY) failed\00"
define void @setctty() {
%1 = load i32, i32* @TIOCSCTTY
%2 = tail call i64 @ioctl(i32 1, i32 %1, i32 0)
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 @die(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32* null, i8* inttoptr (i64 -1 to i8*))
br label %6
6: ; preds = %4, %0
ret void
}
int get24(unsigned char *p) { return p[0] << 16 | p[1] << 8 | p[2]; }


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

x86 assembly (clang, -O2):
<get24>:
movzbl (%rdi),%eax
shl    $0x10,%eax
movzbl 0x1(%rdi),%ecx
shl    $0x8,%ecx
or     %eax,%ecx
movzbl 0x2(%rdi),%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @get24(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl i32 %6, 16
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = or i32 %7, %12
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 2
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = or i32 %13, %17
ret i32 %18
}

LLVM IR (-O2):
define i32 @get24(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = shl nuw nsw i32 %3, 16
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 8
%9 = or i32 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = or i32 %9, %12
ret i32 %13
}
long __ccaprice_syscall_args_2(long A0, long A1, long A2) {
  unsigned long R;
  __asm__ __volatile__("int $0x80"
                       : "=a"(R)
                       : "a"(A0), "b"(A1), "c"(A2)
                       : "memory");
  return R;
}


x86 assembly (clang, -O0):
<__ccaprice_syscall_args_2>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rbx
mov    -0x20(%rbp),%rcx
int    $0x80
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ccaprice_syscall_args_2>:
push   %rbx
mov    %rdx,%rcx
mov    %rsi,%rbx
mov    %rdi,%rax
int    $0x80
pop    %rbx
ret

LLVM IR (-O0):
define i64 @__ccaprice_syscall_args_2(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load i64, i64* %4
%9 = load i64, i64* %5
%10 = load i64, i64* %6
%11 = call i64 asm sideeffect "int $$0x80", "={ax},{ax},{bx},{cx},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %8, i64 %9, i64 %10)
store i64 %11, i64* %7
%12 = load i64, i64* %7
ret i64 %12
}

LLVM IR (-O2):
define i64 @__ccaprice_syscall_args_2(i64 %0, i64 %1, i64 %2) {
%4 = tail call i64 asm sideeffect "int $$0x80", "={ax},{ax},{bx},{cx},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %0, i64 %1, i64 %2)
ret i64 %4
}
int((hop_counter_dump))(struct ss7 *ss7, int messagetype, unsigned char *parm,
                        int len) {
  return 1;
}


x86 assembly (clang, -O0):
<hop_counter_dump>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.ss7 = type opaque
define i32 @hop_counter_dump(%struct.ss7* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca %struct.ss7*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store %struct.ss7* %0, %struct.ss7** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
ret i32 1
}

LLVM IR (-O2):
%struct.ss7 = type opaque
define i32 @hop_counter_dump(%struct.ss7* nocapture readnone %0, i32 %1, i8* nocapture readnone %2, i32 %3) {
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int set_parser_input_filename(char *filename) {
  extern FILE *nwsin;
  FILE *fin = fopen(filename, "r");
  if (NULL == fin)
    return 0;
  nwsin = fin;
  return 1;
}


x86 assembly (clang, -O0):
<set_parser_input_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <fopen@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
jne    1148 <set_parser_input_filename+0x38>
movl   $0x0,-0x4(%rbp)
jmp    115d <set_parser_input_filename+0x4d>
mov    -0x18(%rbp),%rcx
mov    0x2e95(%rip),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_parser_input_filename>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <fopen@plt>
test   %rax,%rax
je     1133 <set_parser_input_filename+0x23>
mov    0x2ebf(%rip),%rcx
mov    %rax,(%rcx)
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@nwsin = external global i32*
define i32 @set_parser_input_filename(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %5, label %4
4: ; preds = %1
store i32* %2, i32** @nwsin
br label %5
5: ; preds = %1, %4
%6 = phi i32 [ 1, %4 ], [ 0, %1 ]
ret i32 %6
}
int ctr_utf8size(char c) {
  if ((c & 240) == 240)
    return 4;
  if ((c & 224) == 224)
    return 3;
  if ((c & 192) == 192)
    return 2;
  return 1;
}


x86 assembly (clang, -O0):
<ctr_utf8size>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
and    $0xf0,%eax
cmp    $0xf0,%eax
jne    112a <ctr_utf8size+0x2a>
movl   $0x4,-0x4(%rbp)
jmp    1171 <ctr_utf8size+0x71>
movsbl -0x5(%rbp),%eax
and    $0xe0,%eax
cmp    $0xe0,%eax
jne    114a <ctr_utf8size+0x4a>
movl   $0x3,-0x4(%rbp)
jmp    1171 <ctr_utf8size+0x71>
movsbl -0x5(%rbp),%eax
and    $0xc0,%eax
cmp    $0xc0,%eax
jne    116a <ctr_utf8size+0x6a>
movl   $0x2,-0x4(%rbp)
jmp    1171 <ctr_utf8size+0x71>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ctr_utf8size>:
mov    %edi,%ecx
not    %ecx
mov    $0x4,%eax
test   $0xf0,%cl
je     112f <ctr_utf8size+0x2f>
movzbl %dil,%ecx
not    %ecx
mov    $0x3,%eax
test   $0xe0,%cl
je     112f <ctr_utf8size+0x2f>
and    $0xc0,%ecx
cmp    $0x1,%ecx
mov    $0x1,%eax
adc    $0x0,%eax
ret

LLVM IR (-O0):
define i32 @ctr_utf8size(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, 240
%7 = icmp eq i32 %6, 240
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 4, i32* %2
br label %22
9: ; preds = %1
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
%12 = and i32 %11, 224
%13 = icmp eq i32 %12, 224
br i1 %13, label %14, label %15
14: ; preds = %9
store i32 3, i32* %2
br label %22
15: ; preds = %9
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = and i32 %17, 192
%19 = icmp eq i32 %18, 192
br i1 %19, label %20, label %21
20: ; preds = %15
store i32 2, i32* %2
br label %22
21: ; preds = %15
store i32 1, i32* %2
br label %22
22: ; preds = %21, %20, %14, %8
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @ctr_utf8size(i8 signext %0) {
%2 = zext i8 %0 to i32
%3 = and i32 %2, 240
%4 = icmp eq i32 %3, 240
br i1 %4, label %12, label %5
5: ; preds = %1
%6 = and i32 %2, 224
%7 = icmp eq i32 %6, 224
br i1 %7, label %12, label %8
8: ; preds = %5
%9 = and i32 %2, 192
%10 = icmp eq i32 %9, 192
%11 = select i1 %10, i32 2, i32 1
br label %12
12: ; preds = %8, %5, %1
%13 = phi i32 [ 4, %1 ], [ 3, %5 ], [ %11, %8 ]
ret i32 %13
}
int limitDetection(int depth, int decoded_bytes, int decode_bytes_total) {
  if (!depth)
    return decoded_bytes;
  else if (depth < decode_bytes_total - decoded_bytes)
    return 0;
  else if (depth > decode_bytes_total)
    return decoded_bytes;
  else
    return (depth + decoded_bytes - decode_bytes_total);
}


x86 assembly (clang, -O0):
<limitDetection>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1122 <limitDetection+0x22>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1162 <limitDetection+0x62>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jge    113f <limitDetection+0x3f>
movl   $0x0,-0x4(%rbp)
jmp    1162 <limitDetection+0x62>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1156 <limitDetection+0x56>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1162 <limitDetection+0x62>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<limitDetection>:
test   %edi,%edi
je     1116 <limitDetection+0x16>
mov    %edx,%ecx
sub    %esi,%ecx
xor    %eax,%eax
cmp    %edi,%ecx
jg     1118 <limitDetection+0x18>
cmp    %edx,%edi
jg     1116 <limitDetection+0x16>
add    %edi,%esi
sub    %edx,%esi
mov    %esi,%eax
ret

LLVM IR (-O0):
define i32 @limitDetection(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %5
%9 = icmp ne i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %3
%11 = load i32, i32* %6
store i32 %11, i32* %4
br label %31
12: ; preds = %3
%13 = load i32, i32* %5
%14 = load i32, i32* %7
%15 = load i32, i32* %6
%16 = sub nsw i32 %14, %15
%17 = icmp slt i32 %13, %16
br i1 %17, label %18, label %19
18: ; preds = %12
store i32 0, i32* %4
br label %31
19: ; preds = %12
%20 = load i32, i32* %5
%21 = load i32, i32* %7
%22 = icmp sgt i32 %20, %21
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = load i32, i32* %6
store i32 %24, i32* %4
br label %31
25: ; preds = %19
%26 = load i32, i32* %5
%27 = load i32, i32* %6
%28 = add nsw i32 %26, %27
%29 = load i32, i32* %7
%30 = sub nsw i32 %28, %29
store i32 %30, i32* %4
br label %31
31: ; preds = %25, %23, %18, %10
%32 = load i32, i32* %4
ret i32 %32
}

LLVM IR (-O2):
define i32 @limitDetection(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %13, label %5
5: ; preds = %3
%6 = sub nsw i32 %2, %1
%7 = icmp sgt i32 %6, %0
br i1 %7, label %13, label %8
8: ; preds = %5
%9 = icmp sgt i32 %0, %2
br i1 %9, label %13, label %10
10: ; preds = %8
%11 = add nsw i32 %1, %0
%12 = sub i32 %11, %2
br label %13
13: ; preds = %8, %5, %3, %10
%14 = phi i32 [ %12, %10 ], [ %1, %3 ], [ 0, %5 ], [ %1, %8 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int prc_b2(int a) {
  a = a - 20;
  printf("a-20 [%d]\n", a);
  return a;
}


x86 assembly (clang, -O0):
<prc_b2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x14,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prc_b2>:
push   %rbx
lea    -0x14(%rdi),%ebx
lea    0xee5(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"a-20 [%d]\0A\00"
define i32 @prc_b2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 20
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %2
ret i32 %7
}

LLVM IR (-O2):
@.str = [11 x i8] c"a-20 [%d]\0A\00"
define i32 @prc_b2(i32 %0) {
%2 = add nsw i32 %0, -20
%3 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 %2
}
/* Variables and functions */
char *ltoa(int, char *, int);
char *itoa(int val, char *s, int radix) { return ltoa(val, s, radix); }


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

x86 assembly (clang, -O2):
<itoa>:
jmp    1030 <ltoa@plt>

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

LLVM IR (-O2):
define i8* @itoa(i32 %0, i8* %1, i32 %2) {
%4 = tail call i8* @ltoa(i32 %0, i8* %1, i32 %2)
ret i8* %4
}
void debug(const char *format, ...) {}


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

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

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

LLVM IR (-O2):
define void @debug(i8* nocapture %0, ...) {
ret void
}
unsigned char sd_raw_sync() { return 1; }


x86 assembly (clang, -O0):
<sd_raw_sync>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i8 @sd_raw_sync() {
ret i8 1
}

LLVM IR (-O2):
define zeroext i8 @sd_raw_sync() {
ret i8 1
}
long DINT_TO_LINT(int var) {
  long newvar;
  newvar = (long)var;
  return newvar;
}


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

x86 assembly (clang, -O2):
<DINT_TO_LINT>:
movslq %edi,%rax
ret

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

LLVM IR (-O2):
define i64 @DINT_TO_LINT(i32 %0) {
%2 = sext i32 %0 to i64
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ cgneg();
int /*<<< orphan*/ commit();
int /*<<< orphan*/ gentext();
void genneg(void) {
  gentext();
  commit();
  cgneg();
}


x86 assembly (clang, -O0):
<genneg>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <gentext@plt>
mov    $0x0,%al
call   1040 <commit@plt>
mov    $0x0,%al
call   1050 <cgneg@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<genneg>:
push   %rax
xor    %eax,%eax
call   1030 <gentext@plt>
xor    %eax,%eax
call   1040 <commit@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <cgneg@plt>

LLVM IR (-O0):
define void @genneg() {
%1 = call i32 (...) @gentext()
%2 = call i32 (...) @commit()
%3 = call i32 (...) @cgneg()
ret void
}

LLVM IR (-O2):
define void @genneg() {
%1 = tail call i32 (...) @gentext()
%2 = tail call i32 (...) @commit()
%3 = tail call i32 (...) @cgneg()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Section1(float);
int /*<<< orphan*/ Section2(float);
int /*<<< orphan*/ Section3(float);
int /*<<< orphan*/ Section4(float);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float radius;
  printf("Insert radius: ");
  scanf("%g", &radius);
  Section1(radius);
  Section2(radius);
  Section3(radius);
  Section4(radius);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
call   1050 <printf@plt>
lea    0xe8e(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1080 <scanf@plt>
movss  -0x8(%rbp),%xmm0
call   1060 <Section1@plt>
movss  -0x8(%rbp),%xmm0
call   1030 <Section2@plt>
movss  -0x8(%rbp),%xmm0
call   1070 <Section3@plt>
movss  -0x8(%rbp),%xmm0
call   1040 <Section4@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xe98(%rip),%rdi
call   1050 <printf@plt>
lea    0xe9c(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1080 <scanf@plt>
movss  0x4(%rsp),%xmm0
call   1060 <Section1@plt>
movss  0x4(%rsp),%xmm0
call   1030 <Section2@plt>
movss  0x4(%rsp),%xmm0
call   1070 <Section3@plt>
movss  0x4(%rsp),%xmm0
call   1040 <Section4@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Insert radius: \00"
@.str.1 = [3 x i8] c"%g\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%5 = load float, float* %2
%6 = call i32 @Section1(float %5)
%7 = load float, float* %2
%8 = call i32 @Section2(float %7)
%9 = load float, float* %2
%10 = call i32 @Section3(float %9)
%11 = load float, float* %2
%12 = call i32 @Section4(float %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Insert radius: \00"
@.str.1 = [3 x i8] c"%g\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = call i32 @Section1(float %5)
%7 = load float, float* %1
%8 = call i32 @Section2(float %7)
%9 = load float, float* %1
%10 = call i32 @Section3(float %9)
%11 = load float, float* %1
%12 = call i32 @Section4(float %11)
ret i32 0
}
void vde_chain_nm2_incref(void) {}


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

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

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

LLVM IR (-O2):
define void @vde_chain_nm2_incref() {
ret void
}
int dft_c(int x, int NX) { return x - (NX * (x / (NX / 2 + 1))); }


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

x86 assembly (clang, -O2):
<dft_c>:
mov    %esi,%ecx
shr    $0x1f,%ecx
add    %esi,%ecx
sar    %ecx
add    $0x1,%ecx
mov    %edi,%eax
cltd
idiv   %ecx
imul   %esi,%eax
sub    %eax,%edi
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @dft_c(i32 %0, i32 %1) {
%3 = sdiv i32 %1, 2
%4 = add nsw i32 %3, 1
%5 = sdiv i32 %0, %4
%6 = mul nsw i32 %5, %1
%7 = sub nsw i32 %0, %6
ret i32 %7
}
int f(unsigned char x) { return (0x50 | (x >> 4)) ^ 0xff; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
sar    $0x4,%eax
or     $0x50,%eax
xor    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
shr    $0x4,%dil
xor    $0xaf,%dil
movzbl %dil,%eax
ret

LLVM IR (-O0):
define i32 @f(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = ashr i32 %4, 4
%6 = or i32 80, %5
%7 = xor i32 %6, 255
ret i32 %7
}

LLVM IR (-O2):
define i32 @f(i8 zeroext %0) {
%2 = lshr i8 %0, 4
%3 = xor i8 %2, -81
%4 = zext i8 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
void wczytaj_liczbe(int *n) {
  printf("Wpisz liczbę naturalną: ");
  scanf("%d", &*n);
}


x86 assembly (clang, -O0):
<wczytaj_liczbe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xed8(%rip),%rdi
call   1040 <scanf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wczytaj_liczbe>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <scanf@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Wpisz liczb\C4\99 naturaln\C4\85: \00"
@.str.1 = [3 x i8] c"%d\00"
define void @wczytaj_liczbe(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%4 = load i32*, i32** %2
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"Wpisz liczb\C4\99 naturaln\C4\85: \00"
@.str.1 = [3 x i8] c"%d\00"
define void @wczytaj_liczbe(i32* %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %0)
ret void
}
/* Type definitions */
struct usb_hcd {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ hcd_to_ohci(struct usb_hcd *);
int /*<<< orphan*/ kfree(int /*<<< orphan*/);
void ohci_hcd_free(struct usb_hcd *hcd) { kfree(hcd_to_ohci(hcd)); }


x86 assembly (clang, -O0):
<ohci_hcd_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <hcd_to_ohci@plt>
mov    %eax,%edi
call   1040 <kfree@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ohci_hcd_free>:
push   %rax
call   1030 <hcd_to_ohci@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <kfree@plt>

LLVM IR (-O0):
%struct.usb_hcd = type { i32 }
define void @ohci_hcd_free(%struct.usb_hcd* %0) {
%2 = alloca %struct.usb_hcd*
store %struct.usb_hcd* %0, %struct.usb_hcd** %2
%3 = load %struct.usb_hcd*, %struct.usb_hcd** %2
%4 = call i32 @hcd_to_ohci(%struct.usb_hcd* %3)
%5 = call i32 @kfree(i32 %4)
ret void
}

LLVM IR (-O2):
%struct.usb_hcd = type { i32 }
define void @ohci_hcd_free(%struct.usb_hcd* %0) {
%2 = tail call i32 @hcd_to_ohci(%struct.usb_hcd* %0)
%3 = tail call i32 @kfree(i32 %2)
ret void
}
/* Type definitions */
struct ev_loop {
  int dummy;
};

/* Variables and functions */
struct ev_loop *ev_default_loop_init(unsigned int);
struct ev_loop *ev_default_loop_uc();
struct ev_loop *ev_default_loop(unsigned int flags) {
  struct ev_loop *loop = ev_default_loop_uc();
  if (!loop) {
    loop = ev_default_loop_init(flags);
  }
  return loop;
}


x86 assembly (clang, -O0):
<ev_default_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <ev_default_loop_uc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114d <ev_default_loop+0x2d>
mov    -0x4(%rbp),%edi
call   1030 <ev_default_loop_init@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ev_default_loop>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <ev_default_loop_uc@plt>
test   %rax,%rax
je     1131 <ev_default_loop+0x11>
pop    %rbx
ret
mov    %ebx,%edi
pop    %rbx
jmp    1030 <ev_default_loop_init@plt>

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

LLVM IR (-O2):
%struct.ev_loop = type { i32 }
define %struct.ev_loop* @ev_default_loop(i32 %0) {
%2 = tail call %struct.ev_loop* (...) @ev_default_loop_uc()
%3 = icmp eq %struct.ev_loop* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call %struct.ev_loop* @ev_default_loop_init(i32 %0)
br label %6
6: ; preds = %4, %1
%7 = phi %struct.ev_loop* [ %2, %1 ], [ %5, %4 ]
ret %struct.ev_loop* %7
}
/* Variables and functions */
char *kl_malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *kl_strdup(char const *src) {
  char *dest = kl_malloc(strlen(src) + 1);
  strcpy(dest, src);
  return dest;
}


x86 assembly (clang, -O0):
<kl_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <kl_malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kl_strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <kl_malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @kl_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i8* @kl_malloc(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8*, i8** %2
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define i8* @kl_strdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @kl_malloc(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
char c_ascii_tolower(char c) {
  return c >= 'A' && c <= 'Z' ? c + ('a' - 'A') : c;
}


x86 assembly (clang, -O0):
<c_ascii_tolower>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     1133 <c_ascii_tolower+0x33>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
jg     1133 <c_ascii_tolower+0x33>
movsbl -0x1(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x8(%rbp)
jmp    113a <c_ascii_tolower+0x3a>
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_ascii_tolower>:
lea    -0x41(%rdi),%eax
lea    0x20(%rdi),%ecx
cmp    $0x1a,%al
movzbl %cl,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @c_ascii_tolower(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 90
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = add nsw i32 %12, 32
br label %17
14: ; preds = %6, %1
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
br label %17
17: ; preds = %14, %10
%18 = phi i32 [ %13, %10 ], [ %16, %14 ]
%19 = trunc i32 %18 to i8
ret i8 %19
}

LLVM IR (-O2):
define signext i8 @c_ascii_tolower(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
%4 = add i8 %0, 32
%5 = select i1 %3, i8 %4, i8 %0
ret i8 %5
}
/* Variables and functions */
int *get_int_ptr(float *fp) { return fp; }


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

x86 assembly (clang, -O2):
<get_int_ptr>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i32* @get_int_ptr(float* readnone %0) {
%2 = bitcast float* %0 to i32*
ret i32* %2
}
void outadr(adr) struct symstruct *adr;
{
  outnnadr(adr);
  outnl();
}


x86 assembly (clang, -O0):
<outadr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <outnnadr@plt>
mov    $0x0,%al
call   1040 <outnl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outadr>:
push   %rax
xor    %eax,%eax
call   1030 <outnnadr@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <outnl@plt>

LLVM IR (-O0):
%struct.symstruct = type opaque
define void @outadr(%struct.symstruct* %0) {
%2 = alloca %struct.symstruct*
store %struct.symstruct* %0, %struct.symstruct** %2
%3 = load %struct.symstruct*, %struct.symstruct** %2
%4 = call i32 (%struct.symstruct*, ...) bitcast (i32 (...)* @outnnadr to i32 (%struct.symstruct*, ...)*)(%struct.symstruct* %3)
%5 = call i32 (...) @outnl()
ret void
}

LLVM IR (-O2):
%struct.symstruct = type opaque
define void @outadr(%struct.symstruct* %0) {
%2 = tail call i32 (%struct.symstruct*, ...) bitcast (i32 (...)* @outnnadr to i32 (%struct.symstruct*, ...)*)(%struct.symstruct* %0)
%3 = tail call i32 (...) @outnl()
ret void
}
/* Variables and functions */
unsigned int spi_sendcmd(int, int /*<<< orphan*/, int, int);
void spi_flash_erase(unsigned int addr) {
  unsigned int cmd, s;
  spi_sendcmd(0x6, 0, 1, 0);
  cmd = (addr << 8) | 0xd8;
  spi_sendcmd(cmd, 0, 4, 0);
  do {
    s = spi_sendcmd(0x5, 0, 1, 1);
  } while (s & 0x1);
}


x86 assembly (clang, -O0):
<spi_flash_erase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x6,%edi
xor    %ecx,%ecx
mov    $0x1,%edx
mov    %ecx,%esi
call   1030 <spi_sendcmd@plt>
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
or     $0xd8,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
xor    %ecx,%ecx
mov    $0x4,%edx
mov    %ecx,%esi
call   1030 <spi_sendcmd@plt>
mov    $0x5,%edi
xor    %esi,%esi
mov    $0x1,%ecx
mov    %ecx,%edx
call   1030 <spi_sendcmd@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    114d <spi_flash_erase+0x3d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_flash_erase>:
push   %rbx
mov    %edi,%ebx
mov    $0x6,%edi
xor    %esi,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <spi_sendcmd@plt>
shl    $0x8,%ebx
or     $0xd8,%ebx
mov    %ebx,%edi
xor    %esi,%esi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1030 <spi_sendcmd@plt>
nop
mov    $0x5,%edi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1030 <spi_sendcmd@plt>
test   $0x1,%al
jne    1140 <spi_flash_erase+0x30>
pop    %rbx
ret

LLVM IR (-O0):
define void @spi_flash_erase(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 @spi_sendcmd(i32 6, i32 0, i32 1, i32 0)
%6 = load i32, i32* %2
%7 = shl i32 %6, 8
%8 = or i32 %7, 216
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = call i32 @spi_sendcmd(i32 %9, i32 0, i32 4, i32 0)
br label %11
11: ; preds = %13, %1
%12 = call i32 @spi_sendcmd(i32 5, i32 0, i32 1, i32 1)
store i32 %12, i32* %4
br label %13
13: ; preds = %11
%14 = load i32, i32* %4
%15 = and i32 %14, 1
%16 = icmp ne i32 %15, 0
br i1 %16, label %11, label %17
17: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @spi_flash_erase(i32 %0) {
%2 = tail call i32 @spi_sendcmd(i32 6, i32 0, i32 1, i32 0)
%3 = shl i32 %0, 8
%4 = or i32 %3, 216
%5 = tail call i32 @spi_sendcmd(i32 %4, i32 0, i32 4, i32 0)
br label %6
6: ; preds = %6, %1
%7 = tail call i32 @spi_sendcmd(i32 5, i32 0, i32 1, i32 1)
%8 = and i32 %7, 1
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %6
10: ; preds = %6
ret void
}