xunge/DecIR huggingface dataset:
/* Variables and functions */
int in_byte(unsigned short);
int /*<<< orphan*/ out_byte(unsigned short, unsigned char);
void IRQ_clear_mask(unsigned char IRQline) {
  unsigned short port;
  unsigned char value;
  if (IRQline < 8) {
    port = (0x20 + 1);
  } else {
    port = (0xA0 + 1);
    IRQline -= 8;
  }
  value = in_byte(port) & ~(1 << IRQline);
  out_byte(port, value);
}


x86 assembly (clang, -O0):
<IRQ_clear_mask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x8,%eax
jge    1146 <IRQ_clear_mask+0x26>
movw   $0x21,-0x4(%rbp)
jmp    1156 <IRQ_clear_mask+0x36>
movw   $0xa1,-0x4(%rbp)
movzbl -0x1(%rbp),%eax
sub    $0x8,%eax
mov    %al,-0x1(%rbp)
movzwl -0x4(%rbp),%edi
call   1030 <in_byte@plt>
movzbl -0x1(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%ax
movzwl %ax,%edi
movzbl -0x5(%rbp),%esi
call   1040 <out_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IRQ_clear_mask>:
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
mov    %edi,%eax
sub    $0x8,%al
movzbl %al,%ebp
cmovb  %edi,%ebp
setae  %bl
shl    $0x7,%ebx
or     $0x21,%ebx
mov    %ebx,%edi
call   1030 <in_byte@plt>
btr    %ebp,%eax
movzbl %al,%esi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <out_byte@plt>

LLVM IR (-O0):
define void @IRQ_clear_mask(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i16
%4 = alloca i8
store i8 %0, i8* %2
%5 = load i8, i8* %2
%6 = zext i8 %5 to i32
%7 = icmp slt i32 %6, 8
br i1 %7, label %8, label %9
8: ; preds = %1
store i16 33, i16* %3
br label %14
9: ; preds = %1
store i16 161, i16* %3
%10 = load i8, i8* %2
%11 = zext i8 %10 to i32
%12 = sub nsw i32 %11, 8
%13 = trunc i32 %12 to i8
store i8 %13, i8* %2
br label %14
14: ; preds = %9, %8
%15 = load i16, i16* %3
%16 = call i32 @in_byte(i16 zeroext %15)
%17 = load i8, i8* %2
%18 = zext i8 %17 to i32
%19 = shl i32 1, %18
%20 = xor i32 %19, -1
%21 = and i32 %16, %20
%22 = trunc i32 %21 to i8
store i8 %22, i8* %4
%23 = load i16, i16* %3
%24 = load i8, i8* %4
%25 = call i32 @out_byte(i16 zeroext %23, i8 zeroext %24)
ret void
}

LLVM IR (-O2):
define void @IRQ_clear_mask(i8 zeroext %0) {
%2 = icmp ult i8 %0, 8
%3 = add i8 %0, -8
%4 = select i1 %2, i16 33, i16 161
%5 = select i1 %2, i8 %0, i8 %3
%6 = tail call i32 @in_byte(i16 zeroext %4)
%7 = zext i8 %5 to i32
%8 = shl nuw i32 1, %7
%9 = xor i32 %8, -1
%10 = and i32 %6, %9
%11 = trunc i32 %10 to i8
%12 = tail call i32 @out_byte(i16 zeroext %4, i8 zeroext %11)
ret void
}
/* Variables and functions */
int rand();
int randNum() {
  int num;
  num = rand();
  return num;
}


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

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

LLVM IR (-O0):
define i32 @randNum() {
%1 = alloca i32
%2 = call i32 (...) @rand()
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @randNum() {
%1 = tail call i32 (...) @rand()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int array[5] = {123, 77, 24, 14, 48};
  int i;
  int result = 0;
  for (i = 0; i < 5; ++i) {
    result += array[i];
  }
  printf("%d\n", result);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed5(%rip),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    1172 <main+0x62>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
add    -0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114c <main+0x3c>
mov    -0x28(%rbp),%esi
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 286)
ret i32 0
}
/* Type definitions */
struct sparsetable {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sparsetable_deinit(struct sparsetable *);
int /*<<< orphan*/ sparsetable_init_copy(struct sparsetable *,
                                         struct sparsetable const *);
void sparsetable_assign_copy(struct sparsetable *t,
                             const struct sparsetable *src) {
  sparsetable_deinit(t);
  sparsetable_init_copy(t, src);
}


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

x86 assembly (clang, -O2):
<sparsetable_assign_copy>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <sparsetable_deinit@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <sparsetable_init_copy@plt>

LLVM IR (-O0):
%struct.sparsetable = type { i32 }
define void @sparsetable_assign_copy(%struct.sparsetable* %0, %struct.sparsetable* %1) {
%3 = alloca %struct.sparsetable*
%4 = alloca %struct.sparsetable*
store %struct.sparsetable* %0, %struct.sparsetable** %3
store %struct.sparsetable* %1, %struct.sparsetable** %4
%5 = load %struct.sparsetable*, %struct.sparsetable** %3
%6 = call i32 @sparsetable_deinit(%struct.sparsetable* %5)
%7 = load %struct.sparsetable*, %struct.sparsetable** %3
%8 = load %struct.sparsetable*, %struct.sparsetable** %4
%9 = call i32 @sparsetable_init_copy(%struct.sparsetable* %7, %struct.sparsetable* %8)
ret void
}

LLVM IR (-O2):
%struct.sparsetable = type { i32 }
define void @sparsetable_assign_copy(%struct.sparsetable* %0, %struct.sparsetable* %1) {
%3 = tail call i32 @sparsetable_deinit(%struct.sparsetable* %0)
%4 = tail call i32 @sparsetable_init_copy(%struct.sparsetable* %0, %struct.sparsetable* %1)
ret void
}
void pb42_pci_init(void) {}


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

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

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

LLVM IR (-O2):
define void @pb42_pci_init() {
ret void
}
int dumb_it_callback_terminate(void *data) {
  (void)data;
  return 1;
}


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

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

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

LLVM IR (-O2):
define i32 @dumb_it_callback_terminate(i8* nocapture readnone %0) {
ret i32 1
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int lstat(char *, struct stat *);
int /*<<< orphan*/ stderr;
int xlstat(char *av, struct stat *buf) {
  if (lstat(av, buf) == -1) {
    fprintf(stderr, "Error in lstat function.\n");
    return (-1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<xlstat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <lstat@plt>
cmp    $0xffffffff,%eax
jne    1167 <xlstat+0x47>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
lea    0xeaa(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    116e <xlstat+0x4e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xlstat>:
push   %rax
call   1030 <lstat@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
je     1131 <xlstat+0x11>
pop    %rcx
ret
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
lea    0xebf(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [26 x i8] c"Error in lstat function.\0A\00"
define i32 @xlstat(i8* %0, %struct.stat* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.stat*
store i8* %0, i8** %4
store %struct.stat* %1, %struct.stat** %5
%6 = load i8*, i8** %4
%7 = load %struct.stat*, %struct.stat** %5
%8 = call i32 @lstat(i8* %6, %struct.stat* %7)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %14
13: ; preds = %2
store i32 0, i32* %3
br label %14
14: ; preds = %13, %10
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [26 x i8] c"Error in lstat function.\0A\00"
define i32 @xlstat(i8* nocapture %0, %struct.stat* nocapture %1) {
%3 = tail call i32 @lstat(i8* %0, %struct.stat* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %5
%9 = phi i32 [ -1, %5 ], [ 0, %2 ]
ret i32 %9
}
float acosf(float x) {
  float res;
  asm("fld	%%st\n\t"
      "fmul	%%st(0)\n\t"
      "fld1\n\t"
      "fsubp\n\t"
      "fsqrt\n\t"
      "fxch	%%st(1)\n\t"
      "fpatan"
      : "=t"(res)
      : "0"(x)
      : "st(1)");
  return res;
}


x86 assembly (clang, -O0):
<acosf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
flds   -0xc(%rbp)
fld    %st(0)
fmul   %st(0),%st
fld1
fsubp  %st,%st(1)
fsqrt
fxch   %st(1)
fpatan
fstps  -0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<acosf>:
movss  %xmm0,-0x4(%rsp)
flds   -0x4(%rsp)
fld    %st(0)
fmul   %st(0),%st
fld1
fsubp  %st,%st(1)
fsqrt
fxch   %st(1)
fpatan
fstps  -0x8(%rsp)
movss  -0x8(%rsp),%xmm0
ret

LLVM IR (-O0):
define float @acosf(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = call float asm "fld\09%st\0A\09fmul\09%st(0)\0A\09fld1\0A\09fsubp\0A\09fsqrt\0A\09fxch\09%st(1)\0A\09fpatan", "={st},0,~{st(1)},~{dirflag},~{fpsr},~{flags}"(float %4)
store float %5, float* %3
%6 = load float, float* %3
ret float %6
}

LLVM IR (-O2):
define float @acosf(float %0) {
%2 = tail call float asm "fld\09%st\0A\09fmul\09%st(0)\0A\09fld1\0A\09fsubp\0A\09fsqrt\0A\09fxch\09%st(1)\0A\09fpatan", "={st},0,~{st(1)},~{dirflag},~{fpsr},~{flags}"(float %0)
ret float %2
}
int nwd(int a, int b) {
  int c;
  while (b != 0) {
    c = a % b;
    a = b;
    b = c;
  }
  return a;
}


x86 assembly (clang, -O0):
<nwd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112f <nwd+0x2f>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    110a <nwd+0xa>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nwd>:
mov    %edi,%eax
test   %esi,%esi
je     111d <nwd+0x1d>
mov    %esi,%edx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <nwd+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @nwd(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %6, %4 ], [ %0, %2 ]
%6 = phi i32 [ %7, %4 ], [ %1, %2 ]
%7 = srem i32 %5, %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %6, %4 ]
ret i32 %10
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ type;
};
typedef TYPE_1__ XAnyEvent;

/* Variables and functions */
int get_XAnyEvent_type(void *_p) { return (int)((XAnyEvent *)_p)->type; }


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

x86 assembly (clang, -O2):
<get_XAnyEvent_type>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i32 @get_XAnyEvent_type(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @get_XAnyEvent_type(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Type definitions */
struct TreeNode {
  int dummy;
};

/* Variables and functions */
struct TreeNode *helper(int *, int /*<<< orphan*/, int);
struct TreeNode *constructMaximumBinaryTree(int *nums, int numsSize) {
  return helper(nums, 0, numsSize - 1);
}


x86 assembly (clang, -O0):
<constructMaximumBinaryTree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1030 <helper@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<constructMaximumBinaryTree>:
lea    -0x1(%rsi),%edx
xor    %esi,%esi
jmp    1030 <helper@plt>

LLVM IR (-O0):
%struct.TreeNode = type { i32 }
define %struct.TreeNode* @constructMaximumBinaryTree(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 = sub nsw i32 %6, 1
%8 = call %struct.TreeNode* @helper(i32* %5, i32 0, i32 %7)
ret %struct.TreeNode* %8
}

LLVM IR (-O2):
%struct.TreeNode = type { i32 }
define %struct.TreeNode* @constructMaximumBinaryTree(i32* %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = tail call %struct.TreeNode* @helper(i32* %0, i32 0, i32 %3)
ret %struct.TreeNode* %4
}
/* Variables and functions */
int /*<<< orphan*/ getPT();
int /*<<< orphan*/ putCMD(int);
int /*<<< orphan*/ putPT(int);
int /*<<< orphan*/ putPT_L(int);
int _dos_sleep(int ms) {
  putCMD(0x83);
  putPT(0x1d);
  putPT_L(ms);
  getPT();
  return 0;
}


x86 assembly (clang, -O0):
<_dos_sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x83,%edi
call   1060 <putCMD@plt>
mov    $0x1d,%edi
call   1030 <putPT@plt>
mov    -0x4(%rbp),%edi
call   1040 <putPT_L@plt>
mov    $0x0,%al
call   1050 <getPT@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_dos_sleep>:
push   %rbx
mov    %edi,%ebx
mov    $0x83,%edi
call   1060 <putCMD@plt>
mov    $0x1d,%edi
call   1030 <putPT@plt>
mov    %ebx,%edi
call   1040 <putPT_L@plt>
xor    %eax,%eax
call   1050 <getPT@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @_dos_sleep(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @putCMD(i32 131)
%4 = call i32 @putPT(i32 29)
%5 = load i32, i32* %2
%6 = call i32 @putPT_L(i32 %5)
%7 = call i32 (...) @getPT()
ret i32 0
}

LLVM IR (-O2):
define i32 @_dos_sleep(i32 %0) {
%2 = tail call i32 @putCMD(i32 131)
%3 = tail call i32 @putPT(i32 29)
%4 = tail call i32 @putPT_L(i32 %0)
%5 = tail call i32 (...) @getPT()
ret i32 0
}
int eng_publish() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @eng_publish() {
ret i32 0
}
void __attribute__((destructor)) __libmqueue_fini(void) {}


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

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

LLVM IR (-O0):
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @__libmqueue_fini, i8* null }]
define void @__libmqueue_fini() {
ret void
}

LLVM IR (-O2):
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @__libmqueue_fini, i8* null }]
define void @__libmqueue_fini() {
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
bool SHAREMIND_MAP_KEY_COPY_int32_t(int32_t *const dest, int32_t const src) {
  return (((*dest) = src), true);
}


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

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

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

LLVM IR (-O2):
define i32 @SHAREMIND_MAP_KEY_COPY_int32_t(i32* nocapture writeonly %0, i32 %1) {
store i32 %1, i32* %0
ret i32 1
}
int _write(int file, char *ptr, int len) {
  int counter;
  counter = len;
  for (; counter > 0; counter--) {
    if (*ptr == 0)
      break;
    ptr++;
  }
  return len;
}


x86 assembly (clang, -O0):
<_write>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jle    114d <_write+0x4d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1133 <_write+0x33>
jmp    114d <_write+0x4d>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1114 <_write+0x14>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_write>:
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @_write(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
store i32 %8, i32* %7
br label %9
9: ; preds = %21, %3
%10 = load i32, i32* %7
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %24
12: ; preds = %9
%13 = load i8*, i8** %5
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %12
br label %24
18: ; preds = %12
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %5
br label %21
21: ; preds = %18
%22 = load i32, i32* %7
%23 = add nsw i32 %22, -1
store i32 %23, i32* %7
br label %9
24: ; preds = %17, %9
%25 = load i32, i32* %6
ret i32 %25
}

LLVM IR (-O2):
define i32 @_write(i32 %0, i8* nocapture %1, i32 returned %2) {
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ client();
int fork();
int /*<<< orphan*/ server();
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ system(char *);
int main() {
  int pid = fork();
  if (pid == 0) {
    sleep(2);
    client();
  } else {
    server();
  }
  system("./shiviz.sh");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <fork@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1189 <main+0x39>
mov    $0x2,%edi
call   1060 <sleep@plt>
mov    $0x0,%al
call   1050 <client@plt>
jmp    1190 <main+0x40>
mov    $0x0,%al
call   1040 <server@plt>
lea    0xe69(%rip),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1070 <fork@plt>
test   %eax,%eax
je     1165 <main+0x15>
xor    %eax,%eax
call   1040 <server@plt>
jmp    1176 <main+0x26>
mov    $0x2,%edi
call   1060 <sleep@plt>
xor    %eax,%eax
call   1050 <client@plt>
lea    0xe83(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"./shiviz.sh\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @fork()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = call i32 @sleep(i32 2)
%8 = call i32 (...) @client()
br label %11
9: ; preds = %0
%10 = call i32 (...) @server()
br label %11
11: ; preds = %9, %6
%12 = call i32 @system(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@.str = [12 x i8] c"./shiviz.sh\00"
define i32 @main() {
%1 = tail call i32 (...) @fork()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 @sleep(i32 2)
%5 = tail call i32 (...) @client()
br label %8
6: ; preds = %0
%7 = tail call i32 (...) @server()
br label %8
8: ; preds = %6, %3
%9 = tail call i32 @system(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
char *strrchr(char *, char);
void KillEOL(char *str) {
  char *ptr;
  if ((ptr = strrchr(str, '\n')))
    *ptr = 0;
  if ((ptr = strrchr(str, '\r')))
    *ptr = 0;
}


x86 assembly (clang, -O0):
<KillEOL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     113f <KillEOL+0x2f>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    $0xd,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1162 <KillEOL+0x52>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<KillEOL>:
push   %rbx
mov    %rdi,%rbx
mov    $0xa,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     1126 <KillEOL+0x16>
movb   $0x0,(%rax)
mov    %rbx,%rdi
mov    $0xd,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     113b <KillEOL+0x2b>
movb   $0x0,(%rax)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @KillEOL(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 10)
%3 = icmp eq i8* %2, null
br i1 %3, label %5, label %4
4: ; preds = %1
store i8 0, i8* %2
br label %5
5: ; preds = %4, %1
%6 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 13)
%7 = icmp eq i8* %6, null
br i1 %7, label %9, label %8
8: ; preds = %5
store i8 0, i8* %6
br label %9
9: ; preds = %8, %5
ret void
}
int main() {
  int x = 6;
  x = x / 2;
  x -= 3;
  return x;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x6,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 6, i32* %2
%3 = load i32, i32* %2
%4 = sdiv i32 %3, 2
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = sub nsw i32 %5, 3
store i32 %6, i32* %2
%7 = load i32, i32* %2
ret i32 %7
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
struct lifo {
  int dummy;
};

/* Variables and functions */
double atan2(double, double);
double pop(struct lifo *);
double opr_atan2(struct lifo *stack) {
  double op1, op2;
  op1 = pop(stack);
  op2 = pop(stack);
  return atan2(op2, op1);
}


x86 assembly (clang, -O0):
<opr_atan2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <pop@plt>
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <pop@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <atan2@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<opr_atan2>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1040 <pop@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1040 <pop@plt>
movsd  0x8(%rsp),%xmm1
add    $0x10,%rsp
pop    %rbx
jmp    1030 <atan2@plt>

LLVM IR (-O0):
%struct.lifo = type { i32 }
define double @opr_atan2(%struct.lifo* %0) {
%2 = alloca %struct.lifo*
%3 = alloca double
%4 = alloca double
store %struct.lifo* %0, %struct.lifo** %2
%5 = load %struct.lifo*, %struct.lifo** %2
%6 = call double @pop(%struct.lifo* %5)
store double %6, double* %3
%7 = load %struct.lifo*, %struct.lifo** %2
%8 = call double @pop(%struct.lifo* %7)
store double %8, double* %4
%9 = load double, double* %4
%10 = load double, double* %3
%11 = call double @atan2(double %9, double %10)
ret double %11
}

LLVM IR (-O2):
%struct.lifo = type { i32 }
define double @opr_atan2(%struct.lifo* %0) {
%2 = tail call double @pop(%struct.lifo* %0)
%3 = tail call double @pop(%struct.lifo* %0)
%4 = tail call double @atan2(double %3, double %2)
ret double %4
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t prod8(uint32_t a, uint32_t b) {
  uint32_t r = 0;
  while (a) {
    if (a % 2)
      r ^= b;
    a >>= 1;
    b <<= 1;
  }
  return r;
}


x86 assembly (clang, -O0):
<prod8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     114f <prod8+0x4f>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1138 <prod8+0x38>
mov    -0x8(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1111 <prod8+0x11>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<prod8>:
xor    %eax,%eax
test   %edi,%edi
je     1126 <prod8+0x26>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edi,%edx
and    $0x1,%edx
neg    %edx
and    %esi,%edx
xor    %edx,%eax
sar    %ecx
add    %esi,%esi
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <prod8+0x10>
ret

LLVM IR (-O0):
define i32 @prod8(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %22
9: ; preds = %6
%10 = load i32, i32* %3
%11 = srem i32 %10, 2
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = xor i32 %15, %14
store i32 %16, i32* %5
br label %17
17: ; preds = %13, %9
%18 = load i32, i32* %3
%19 = ashr i32 %18, 1
store i32 %19, i32* %3
%20 = load i32, i32* %4
%21 = shl i32 %20, 1
store i32 %21, i32* %4
br label %6
22: ; preds = %6
%23 = load i32, i32* %5
ret i32 %23
}

LLVM IR (-O2):
define i32 @prod8(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %15, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %11, %4 ], [ 0, %2 ]
%6 = phi i32 [ %13, %4 ], [ %1, %2 ]
%7 = phi i32 [ %12, %4 ], [ %0, %2 ]
%8 = and i32 %7, 1
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 0, i32 %6
%11 = xor i32 %10, %5
%12 = ashr i32 %7, 1
%13 = shl i32 %6, 1
%14 = icmp ult i32 %7, 2
br i1 %14, label %15, label %4
15: ; preds = %4, %2
%16 = phi i32 [ 0, %2 ], [ %11, %4 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void die(const char *msg) {
  fprintf(stderr, "-1\nError: %s\n", msg);
  exit(1);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [14 x i8] c"-1\0AError: %s\0A\00"
define void @die(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [14 x i8] c"-1\0AError: %s\0A\00"
define void @die(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int a, b;
  a = 1;
  b = a / 2;
  printf("%d, %d", a, b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xebf(%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
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%d, %d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 1, i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __asan_poison_memory_region(char *, int);
int /*<<< orphan*/ assert(int);
char *strstr(char *, char *);
int main(int argc, char **argv) {
  char *r = 0;
  char s1[] = "ab";
  char s2[4] = "cab";
  __asan_poison_memory_region((char *)&s2[2], 2);
  r = strstr(s1, s2);
  assert(r == 0);
  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)
movq   $0x0,-0x18(%rbp)
mov    0xeac(%rip),%ax
mov    %ax,-0x1b(%rbp)
mov    0xea4(%rip),%al
mov    %al,-0x19(%rbp)
mov    0xe98(%rip),%eax
mov    %eax,-0x1f(%rbp)
lea    -0x1f(%rbp),%rdi
add    $0x2,%rdi
mov    $0x2,%esi
call   1030 <__asan_poison_memory_region@plt>
lea    -0x1b(%rbp),%rdi
lea    -0x1f(%rbp),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movb   $0x0,0x2(%rsp)
movw   $0x6261,(%rsp)
movl   $0x626163,0x4(%rsp)
lea    0x6(%rsp),%rdi
mov    $0x2,%esi
call   1030 <__asan_poison_memory_region@plt>
mov    %rsp,%rdi
lea    0x4(%rsp),%rsi
call   1050 <strstr@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.s1 = [3 x i8] c"ab\00"
@__const.main.s2 = [4 x i8] c"cab\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [3 x i8]
%8 = alloca [4 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
%9 = bitcast [3 x i8]* %7 to i8*
%10 = bitcast [4 x i8]* %8 to i8*
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 2
%12 = call i32 @__asan_poison_memory_region(i8* %11, i32 2)
%13 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 0
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%15 = call i8* @strstr(i8* %13, i8* %14)
store i8* %15, i8** %6
%16 = load i8*, i8** %6
%17 = icmp eq i8* %16, null
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s1 = [3 x i8] c"ab\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [3 x i8]
%4 = alloca i32
%5 = bitcast i32* %4 to [4 x i8]*
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%7 = bitcast i32* %4 to i8*
store i32 6447459, i32* %4
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 2
%9 = call i32 @__asan_poison_memory_region(i8* %8, i32 2)
%10 = call i8* @strstr(i8* %6, i8* %7)
%11 = icmp eq i8* %10, null
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
ret i32 0
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int __sys_fstat(int, struct stat *);
int fstat(int file, struct stat *st) { return __sys_fstat(file, st); }


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

x86 assembly (clang, -O2):
<fstat>:
jmp    1030 <__sys_fstat@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @fstat(i32 %0, %struct.stat* %1) {
%3 = alloca i32
%4 = alloca %struct.stat*
store i32 %0, i32* %3
store %struct.stat* %1, %struct.stat** %4
%5 = load i32, i32* %3
%6 = load %struct.stat*, %struct.stat** %4
%7 = call i32 @__sys_fstat(i32 %5, %struct.stat* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @fstat(i32 %0, %struct.stat* %1) {
%3 = tail call i32 @__sys_fstat(i32 %0, %struct.stat* %1)
ret i32 %3
}
/* Variables and functions */
int lrint(double);
int main(void) {
  double fval;
  int k, ival;
  fval = 1.0 * 0x7FFFFFFF;
  for (k = 0; k < 100; k++) {
    ival = (lrint(fval)) >> 24;
    if (ival != 127)
      return 1;
    fval *= 1.2499999;
  };
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    1183 <main+0x73>
movsd  -0x10(%rbp),%xmm0
call   1030 <lrint@plt>
sar    $0x18,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x7f,-0x18(%rbp)
je     1163 <main+0x53>
movl   $0x1,-0x4(%rbp)
jmp    118a <main+0x7a>
movsd  0xe9d(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1133 <main+0x23>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movsd  0xee3(%rip),%xmm0
mov    $0x64,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  %xmm0,0x8(%rsp)
call   1030 <lrint@plt>
and    $0xff000000,%eax
cmp    $0x7f000000,%eax
jne    115e <main+0x4e>
movsd  0x8(%rsp),%xmm0
mulsd  0xeb3(%rip),%xmm0
add    $0xffffffff,%ebx
jne    1130 <main+0x20>
xor    %eax,%eax
jmp    1163 <main+0x53>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store double 0x41DFFFFFFFC00000, double* %2
store i32 0, i32* %3
br label %5
5: ; preds = %18, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 100
br i1 %7, label %8, label %21
8: ; preds = %5
%9 = load double, double* %2
%10 = call i32 @lrint(double %9)
%11 = ashr i32 %10, 24
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 127
br i1 %13, label %14, label %15
14: ; preds = %8
store i32 1, i32* %1
br label %22
15: ; preds = %8
%16 = load double, double* %2
%17 = fmul double %16, 0x3FF3FFFFE5280D65
store double %17, double* %2
br label %18
18: ; preds = %15
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %5
21: ; preds = %5
store i32 0, i32* %1
br label %22
22: ; preds = %21, %14
%23 = load i32, i32* %1
ret i32 %23
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %7
%2 = phi i32 [ 0, %0 ], [ %9, %7 ]
%3 = phi double [ 0x41DFFFFFFFC00000, %0 ], [ %8, %7 ]
%4 = tail call i32 @lrint(double %3)
%5 = and i32 %4, -16777216
%6 = icmp eq i32 %5, 2130706432
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = fmul double %3, 0x3FF3FFFFE5280D65
%9 = add nuw nsw i32 %2, 1
%10 = icmp eq i32 %9, 100
br i1 %10, label %11, label %1
11: ; preds = %7, %1
%12 = phi i32 [ 1, %1 ], [ 0, %7 ]
ret i32 %12
}
void RTSocketSgWrite(void) {}


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

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

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

LLVM IR (-O2):
define void @RTSocketSgWrite() {
ret void
}
void AcpiShutdown(void) {
  unsigned int port = GetShutdownPort();
  if (port)
    asm volatile("outw %0, %1"
                 :
                 : "a"((unsigned short)0x2000), "d"((unsigned short)port));
  else
    uioPrint("Error: Shutdown failed.\n");
}


x86 assembly (clang, -O0):
<AcpiShutdown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <GetShutdownPort@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     114d <AcpiShutdown+0x2d>
mov    -0x4(%rbp),%eax
mov    %ax,%dx
mov    $0x2000,%ax
out    %ax,(%dx)
jmp    115b <AcpiShutdown+0x3b>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <uioPrint@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AcpiShutdown>:
push   %rax
xor    %eax,%eax
call   1040 <GetShutdownPort@plt>
test   %eax,%eax
je     1136 <AcpiShutdown+0x16>
mov    %eax,%edx
mov    $0x2000,%ax
out    %ax,(%dx)
pop    %rax
ret
lea    0xec3(%rip),%rdi
xor    %eax,%eax
pop    %rcx
jmp    1030 <uioPrint@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Error: Shutdown failed.\0A\00"
define void @AcpiShutdown() {
%1 = alloca i32
%2 = call i32 (...) @GetShutdownPort()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i32, i32* %1
%7 = trunc i32 %6 to i16
br label %10
8: ; preds = %0
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @uioPrint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Error: Shutdown failed.\0A\00"
define void @AcpiShutdown() {
%1 = tail call i32 (...) @GetShutdownPort()
%2 = icmp eq i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = trunc i32 %1 to i16
tail call void asm sideeffect "outw $0, $1", "{ax},{dx},~{dirflag},~{fpsr},~{flags}"(i16 8192, i16 %4)
br label %7
5: ; preds = %0
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @uioPrint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %3
ret void
}
int octave_wnohang_wrapper(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @octave_wnohang_wrapper() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
int sched_getcpu();
void *runner(void *p) {
  while (1)
    printf("Esta é a execucao da Thread %d na CPU=%d\n", (int)(size_t)p,
           sched_getcpu());
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<runner>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1040 <sched_getcpu@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
jmp    112c <runner+0xc>

x86 assembly (clang, -O2):
<runner>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed2(%rip),%r14
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <sched_getcpu@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
jmp    1130 <runner+0x10>

LLVM IR (-O0):
@.str = [43 x i8] c"Esta \C3\A9 a execucao da Thread %d na CPU=%d\0A\00"
define i8* @runner(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1, %3
%4 = load i8*, i8** %2
%5 = ptrtoint i8* %4 to i64
%6 = trunc i64 %5 to i32
%7 = call i32 (...) @sched_getcpu()
%8 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
br label %3
}

LLVM IR (-O2):
@.str = [43 x i8] c"Esta \C3\A9 a execucao da Thread %d na CPU=%d\0A\00"
define noalias i8* @runner(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
br label %4
4: ; preds = %1, %4
%5 = tail call i32 (...) @sched_getcpu()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %5)
br label %4
}
int cookieSet(char *buf) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @cookieSet(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
void usage(void) {
  printf("Usage: gps-sdr-sim [options]\n"
         "Options:\n"
         "  -e <gps_nav>     RINEX navigation file for GPS ephemerides "
         "(required)\n"
         "  -t <date,time>   Scenario start time YYYY/MM/DD,hh:mm:ss\n"
         "  -T <date,time>   Overwrite TOC and TOE to scenario start time\n"
         "  -o <output>      I/Q sampling data file (default: gpssim.bin)\n"
         "  -s <frequency>   Sampling frequency [Hz] (default: 2600000)\n"
         "  -v               Show details about simulated channels\n",
         ((double)(3000)) / 10.0);
  return;
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xeed(%rip),%rdi
movsd  0xedd(%rip),%xmm0
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
lea    0xef1(%rip),%rdi
movsd  0xee1(%rip),%xmm0
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [417 x i8] c"Usage: gps-sdr-sim [options]\0AOptions:\0A -e <gps_nav> RINEX navigation file for GPS ephemerides (required)\0A -t <date,time> Scenario start time YYYY/MM/DD,hh:mm:ss\0A -T <date,time> Overwrite TOC and TOE to scenario start time\0A -o <output> I/Q sampling data file (default: gpssim.bin)\0A -s <frequency> Sampling frequency [Hz] (default: 2600000)\0A -v Show details about simulated channels\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([417 x i8], [417 x i8]* @.str, i64 0, i64 0), double 3.000000e+02)
ret void
}

LLVM IR (-O2):
@.str = [417 x i8] c"Usage: gps-sdr-sim [options]\0AOptions:\0A -e <gps_nav> RINEX navigation file for GPS ephemerides (required)\0A -t <date,time> Scenario start time YYYY/MM/DD,hh:mm:ss\0A -T <date,time> Overwrite TOC and TOE to scenario start time\0A -o <output> I/Q sampling data file (default: gpssim.bin)\0A -s <frequency> Sampling frequency [Hz] (default: 2600000)\0A -v Show details about simulated channels\0A\00"
define void @usage() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([417 x i8], [417 x i8]* @.str, i64 0, i64 0), double 3.000000e+02)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int sumsq = 0;
  int i;
  for (i = 0; i < 100; ++i) {
    sumsq += (i + 1) * (i + 1);
  }
  int sqsum = (101 * 50) * (101 * 50);
  printf("%d\n", sqsum - sumsq);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jge    115a <main+0x4a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
movl   $0x1852324,-0x10(%rbp)
mov    -0x10(%rbp),%esi
sub    -0x8(%rbp),%esi
lea    0xe92(%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
mov    $0x17ff976,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 25164150)
ret i32 0
}