xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ vga_clear();
int /*<<< orphan*/ vga_set_cursor_enable(int);
void vga_init() {
  vga_set_cursor_enable(1);
  vga_clear();
}


x86 assembly (clang, -O0):
<vga_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <vga_set_cursor_enable@plt>
mov    $0x0,%al
call   1040 <vga_clear@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<vga_init>:
push   %rax
mov    $0x1,%edi
call   1030 <vga_set_cursor_enable@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <vga_clear@plt>

LLVM IR (-O0):
define void @vga_init() {
%1 = call i32 @vga_set_cursor_enable(i32 1)
%2 = call i32 (...) @vga_clear()
ret void
}

LLVM IR (-O2):
define void @vga_init() {
%1 = tail call i32 @vga_set_cursor_enable(i32 1)
%2 = tail call i32 (...) @vga_clear()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ usage();
int rbcfg_cmd_help(int argc, const char *argv[]) {
  usage();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @rbcfg_cmd_help(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @usage()
ret i32 0
}

LLVM IR (-O2):
define i32 @rbcfg_cmd_help(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @usage()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ SA1Absolute(int);
int /*<<< orphan*/ STX8(int /*<<< orphan*/);
void Op8EX1(void) { STX8(SA1Absolute(2)); }


x86 assembly (clang, -O0):
<Op8EX1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <SA1Absolute@plt>
mov    %eax,%edi
call   1040 <STX8@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Op8EX1>:
push   %rax
mov    $0x2,%edi
call   1030 <SA1Absolute@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <STX8@plt>

LLVM IR (-O0):
define void @Op8EX1() {
%1 = call i32 @SA1Absolute(i32 2)
%2 = call i32 @STX8(i32 %1)
ret void
}

LLVM IR (-O2):
define void @Op8EX1() {
%1 = tail call i32 @SA1Absolute(i32 2)
%2 = tail call i32 @STX8(i32 %1)
ret void
}
/* Variables and functions */
float Du(float);
float Dv(float);
scalar_t__ abs(float);
float max(scalar_t__, double);
float ieFilterWidth(float x) {
  extern float du;
  extern float dv;
  return max(abs(Du(x) * du) + abs(Dv(x) * du), 1.0e-6);
}


x86 assembly (clang, -O0):
<ieFilterWidth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1050 <Du@plt>
mov    0x2e82(%rip),%rax
mulss  (%rax),%xmm0
call   1030 <abs@plt>
mov    %rax,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
call   1060 <Dv@plt>
mov    0x2e64(%rip),%rax
mulss  (%rax),%xmm0
call   1030 <abs@plt>
mov    -0x10(%rbp),%rdi
add    %rax,%rdi
movsd  0xe6c(%rip),%xmm0
call   1040 <max@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ieFilterWidth>:
push   %r14
push   %rbx
push   %rax
movss  %xmm0,0x4(%rsp)
call   1050 <Du@plt>
mov    0x2e8a(%rip),%r14
mulss  (%r14),%xmm0
call   1030 <abs@plt>
mov    %rax,%rbx
movss  0x4(%rsp),%xmm0
call   1060 <Dv@plt>
mulss  (%r14),%xmm0
call   1030 <abs@plt>
add    %rax,%rbx
movsd  0xe7d(%rip),%xmm0
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <max@plt>

LLVM IR (-O0):
@du = external global float
define float @ieFilterWidth(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @Du(float %3)
%5 = load float, float* @du
%6 = fmul float %4, %5
%7 = call i64 @abs(float %6)
%8 = load float, float* %2
%9 = call float @Dv(float %8)
%10 = load float, float* @du
%11 = fmul float %9, %10
%12 = call i64 @abs(float %11)
%13 = add nsw i64 %7, %12
%14 = call float @max(i64 %13, double 0x3EB0C6F7A0B5ED8D)
ret float %14
}

LLVM IR (-O2):
@du = external global float
define float @ieFilterWidth(float %0) {
%2 = tail call float @Du(float %0)
%3 = load float, float* @du
%4 = fmul float %2, %3
%5 = tail call i64 @abs(float %4)
%6 = tail call float @Dv(float %0)
%7 = load float, float* @du
%8 = fmul float %6, %7
%9 = tail call i64 @abs(float %8)
%10 = add nsw i64 %9, %5
%11 = tail call float @max(i64 %10, double 0x3EB0C6F7A0B5ED8D)
ret float %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void mlPrintSpaces(int n) {
  for (int i = 0; i < n; i++) {
    printf("  ");
  }
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c" \00"
define void @mlPrintSpaces(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %4, label %3
3: ; preds = %4, %1
ret void
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ 0, %1 ]
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %0
br i1 %8, label %3, label %4
}
void rct_set_ms_delay(void) {}


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

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

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

LLVM IR (-O2):
define void @rct_set_ms_delay() {
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t rot32l7(uint32_t x) { return (x << 7) | (x >> 25); }


x86 assembly (clang, -O0):
<rot32l7>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x7,%eax
mov    -0x4(%rbp),%ecx
sar    $0x19,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rot32l7>:
mov    %edi,%eax
shl    $0x7,%eax
sar    $0x19,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @rot32l7(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 7
%5 = load i32, i32* %2
%6 = ashr i32 %5, 25
%7 = or i32 %4, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @rot32l7(i32 %0) {
%2 = shl i32 %0, 7
%3 = ashr i32 %0, 25
%4 = or i32 %2, %3
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
void test_vmvn_s32x4(int32_t *__restrict__ dest, int32_t *a) {
  int i;
  for (i = 0; i < 4; i++) {
    dest[i] = ~a[i];
  }
}


x86 assembly (clang, -O0):
<test_vmvn_s32x4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1144 <test_vmvn_s32x4+0x44>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
xor    $0xffffffff,%edx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <test_vmvn_s32x4+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_vmvn_s32x4>:
movdqu (%rsi),%xmm0
pcmpeqd %xmm1,%xmm1
pxor   %xmm0,%xmm1
movdqu %xmm1,(%rdi)
ret

LLVM IR (-O0):
define void @test_vmvn_s32x4(i32* noalias %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 = %20, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 4
br i1 %8, label %9, label %23
9: ; preds = %6
%10 = load i32*, i32** %4
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %10, i64 %12
%14 = load i32, i32* %13
%15 = xor i32 %14, -1
%16 = load i32*, i32** %3
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
store i32 %15, i32* %19
br label %20
20: ; preds = %9
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %6
23: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @test_vmvn_s32x4(i32* noalias nocapture writeonly %0, i32* nocapture %1) {
%3 = bitcast i32* %1 to <4 x i32>*
%4 = load <4 x i32>, <4 x i32>* %3
%5 = xor <4 x i32> %4, <i32 -1, i32 -1, i32 -1, i32 -1>
%6 = bitcast i32* %0 to <4 x i32>*
store <4 x i32> %5, <4 x i32>* %6
ret void
}
/* Type definitions */
struct node {
  int dummy;
};

/* Variables and functions */
struct node *list_add(struct node *, int);
int /*<<< orphan*/ list_dispose(struct node *);
struct node *list_remove(struct node *);
int main(void) {
  struct node *l = NULL;
  l = list_add(l, 1);
  l = list_add(l, 2);
  l = list_add(l, 3);
  l = list_remove(l);
  list_dispose(l);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
call   1040 <list_add@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1040 <list_add@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1040 <list_add@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <list_remove@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <list_dispose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
mov    $0x1,%esi
call   1040 <list_add@plt>
mov    %rax,%rdi
mov    $0x2,%esi
call   1040 <list_add@plt>
mov    %rax,%rdi
mov    $0x3,%esi
call   1040 <list_add@plt>
mov    %rax,%rdi
call   1050 <list_remove@plt>
mov    %rax,%rdi
call   1030 <list_dispose@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.node = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.node*
store i32 0, i32* %1
store %struct.node* null, %struct.node** %2
%3 = load %struct.node*, %struct.node** %2
%4 = call %struct.node* @list_add(%struct.node* %3, i32 1)
store %struct.node* %4, %struct.node** %2
%5 = load %struct.node*, %struct.node** %2
%6 = call %struct.node* @list_add(%struct.node* %5, i32 2)
store %struct.node* %6, %struct.node** %2
%7 = load %struct.node*, %struct.node** %2
%8 = call %struct.node* @list_add(%struct.node* %7, i32 3)
store %struct.node* %8, %struct.node** %2
%9 = load %struct.node*, %struct.node** %2
%10 = call %struct.node* @list_remove(%struct.node* %9)
store %struct.node* %10, %struct.node** %2
%11 = load %struct.node*, %struct.node** %2
%12 = call i32 @list_dispose(%struct.node* %11)
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
define i32 @main() {
%1 = tail call %struct.node* @list_add(%struct.node* null, i32 1)
%2 = tail call %struct.node* @list_add(%struct.node* %1, i32 2)
%3 = tail call %struct.node* @list_add(%struct.node* %2, i32 3)
%4 = tail call %struct.node* @list_remove(%struct.node* %3)
%5 = tail call i32 @list_dispose(%struct.node* %4)
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t ts_packet_get_pid(uint8_t *ts_packet) {
  return (ts_packet[1] & ~0xE0) << 8 | ts_packet[2];
}


x86 assembly (clang, -O0):
<ts_packet_get_pid>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
and    $0xffffff1f,%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
or     0x8(%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ts_packet_get_pid>:
mov    0x4(%rdi),%eax
shl    $0x8,%eax
and    $0xffff1f00,%eax
or     0x8(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @ts_packet_get_pid(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 1
%5 = load i32, i32* %4
%6 = and i32 %5, -225
%7 = shl i32 %6, 8
%8 = load i32*, i32** %2
%9 = getelementptr inbounds i32, i32* %8, i64 2
%10 = load i32, i32* %9
%11 = or i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @ts_packet_get_pid(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = load i32, i32* %2
%4 = shl i32 %3, 8
%5 = and i32 %4, -57600
%6 = getelementptr inbounds i32, i32* %0, i64 2
%7 = load i32, i32* %6
%8 = or i32 %5, %7
ret i32 %8
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
char base64b8(unsigned char Val) {
  const uint32_t base64b8values =
      (uint32_t)((uint32_t)'A' + ((uint32_t)'Q' << 8) + ((uint32_t)'g' << 16) +
                 ((uint32_t)'w' << 24));
  return (char)((base64b8values >> (Val << 3)) & 0xFF);
}


x86 assembly (clang, -O0):
<base64b8>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x77675141,-0x8(%rbp)
movzbl -0x1(%rbp),%ecx
shl    $0x3,%ecx
mov    $0x77675141,%eax
sar    %cl,%eax
and    $0xff,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<base64b8>:
lea    0x0(,%rdi,8),%ecx
mov    $0x77675141,%eax
shr    %cl,%eax
ret

LLVM IR (-O0):
define signext i8 @base64b8(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 2003259713, i32* %3
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = shl i32 %5, 3
%7 = ashr i32 2003259713, %6
%8 = and i32 %7, 255
%9 = trunc i32 %8 to i8
ret i8 %9
}

LLVM IR (-O2):
define signext i8 @base64b8(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = shl nuw nsw i32 %2, 3
%4 = lshr i32 2003259713, %3
%5 = trunc i32 %4 to i8
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int main(void) {
  char a = "a";
  printf("%c\n", a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rax
mov    %al,-0x5(%rbp)
lea    0xed2(%rip),%rdi
movsbl -0x5(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [2 x i8] c"a\00"
@.str.1 = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
store i8 ptrtoint ([2 x i8]* @.str to i8), i8* %2
%3 = load i8, i8* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"a\00"
@.str.1 = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext ptrtoint ([2 x i8]* @.str to i8))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void my_free(void *tofree) {
  if (1)
    free(tofree);
}


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

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

LLVM IR (-O2):
define void @my_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int memcmp(void const *, void const *, int);
int mem_comp(const void *a, const void *b, int size) {
  return memcmp(a, b, size);
}


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

x86 assembly (clang, -O2):
<mem_comp>:
jmp    1030 <memcmp@plt>

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

LLVM IR (-O2):
define i32 @mem_comp(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @memcmp(i8* %0, i8* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
double atof(char const *);
double c_atof_(const char *str) { return atof(str); }


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

x86 assembly (clang, -O2):
<c_atof_>:
jmp    1030 <atof@plt>

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

LLVM IR (-O2):
define double @c_atof_(i8* nocapture %0) {
%2 = tail call double @atof(i8* %0)
ret double %2
}
void TYPEOF() {
  asm volatile("movq (%%r11), %%rax\n\t"
               "movq %%rax, (%%rsp)\n\t" ::
                   :);
}


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

x86 assembly (clang, -O2):
<TYPEOF>:
mov    (%r11),%rax
mov    %rax,(%rsp)
ret

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

LLVM IR (-O2):
define void @TYPEOF() {
tail call void asm sideeffect "movq (%r11), %rax\0A\09movq %rax, (%rsp)\0A\09", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int int32_t;

/* Variables and functions */
void INT(uint8_t *res, int32_t i) {
  res[0] = (i >> 24) & 0xFF;
  res[1] = (i >> 16) & 0xFF;
  res[2] = (i >> 8) & 0xFF;
  res[3] = i & 0xFF;
}


x86 assembly (clang, -O0):
<INT>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x18,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x10,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<INT>:
mov    %esi,%eax
mov    %esi,%ecx
movzbl %ah,%edx
movzbl %al,%esi
shr    $0x18,%eax
mov    %eax,(%rdi)
shr    $0x10,%ecx
movzbl %cl,%eax
mov    %eax,0x4(%rdi)
mov    %edx,0x8(%rdi)
mov    %esi,0xc(%rdi)
ret

LLVM IR (-O0):
define void @INT(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = ashr i32 %5, 24
%7 = and i32 %6, 255
%8 = load i32*, i32** %3
%9 = getelementptr inbounds i32, i32* %8, i64 0
store i32 %7, i32* %9
%10 = load i32, i32* %4
%11 = ashr i32 %10, 16
%12 = and i32 %11, 255
%13 = load i32*, i32** %3
%14 = getelementptr inbounds i32, i32* %13, i64 1
store i32 %12, i32* %14
%15 = load i32, i32* %4
%16 = ashr i32 %15, 8
%17 = and i32 %16, 255
%18 = load i32*, i32** %3
%19 = getelementptr inbounds i32, i32* %18, i64 2
store i32 %17, i32* %19
%20 = load i32, i32* %4
%21 = and i32 %20, 255
%22 = load i32*, i32** %3
%23 = getelementptr inbounds i32, i32* %22, i64 3
store i32 %21, i32* %23
ret void
}

LLVM IR (-O2):
define void @INT(i32* nocapture writeonly %0, i32 %1) {
%3 = lshr i32 %1, 24
store i32 %3, i32* %0
%4 = lshr i32 %1, 16
%5 = and i32 %4, 255
%6 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %5, i32* %6
%7 = lshr i32 %1, 8
%8 = and i32 %7, 255
%9 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %8, i32* %9
%10 = and i32 %1, 255
%11 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %10, i32* %11
ret void
}
__attribute__((weak)) void SVC_Handler(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<SVC_Handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <SVC_Handler+0x9>
jmp    1109 <SVC_Handler+0x9>

x86 assembly (clang, -O2):
<SVC_Handler>:
jmp    1100 <SVC_Handler>

LLVM IR (-O0):
define weak void @SVC_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define weak void @SVC_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ crb_puts(int /*<<< orphan*/, char *, int);
void output_bell(void) { crb_puts(0, "\a", 1); }


x86 assembly (clang, -O0):
<output_bell>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x1,%edx
call   1030 <crb_puts@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_bell>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
mov    $0x1,%edx
jmp    1030 <crb_puts@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\07\00"
define void @output_bell() {
%1 = call i32 @crb_puts(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\07\00"
define void @output_bell() {
%1 = tail call i32 @crb_puts(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_items(void) {
  printf("    Size\tBandwidth(Byte/s)\tTime(micro sec.)\n");
}


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

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

LLVM IR (-O0):
@.str = [45 x i8] c" Size\09Bandwidth(Byte/s)\09Time(micro sec.)\0A\00"
define void @print_items() {
%1 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [44 x i8] c" Size\09Bandwidth(Byte/s)\09Time(micro sec.)\00"
define void @print_items() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
double RAND_MAX;
scalar_t__ rand();
double drand48() { return (double)rand() / RAND_MAX; }


x86 assembly (clang, -O0):
<drand48>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec1(%rip),%rax
divsd  (%rax),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<drand48>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec4(%rip),%rax
divsd  (%rax),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define double @drand48() {
%1 = call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load double, double* @RAND_MAX
%4 = fdiv double %2, %3
ret double %4
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define double @drand48() {
%1 = tail call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load double, double* @RAND_MAX
%4 = fdiv double %2, %3
ret double %4
}
char *strerror(int errno) { return ""; }


x86 assembly (clang, -O0):
<strerror>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    0xef2(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strerror>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @strerror(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @strerror(i32 %0) {
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}
int load_excalibur_library(char *buf) {
  (void)buf;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @load_excalibur_library(i8* nocapture readnone %0) {
ret i32 0
}
int main(void) {
  int i;
  char j;
  if (1 == 0)
    i = 0;
  else
    i = 1;
  while (1 == 0)
    i = 0;
  return 42;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    1121 <main+0x21>
jmp    112d <main+0x2d>
movl   $0x0,-0x8(%rbp)
jmp    1112 <main+0x12>
mov    $0x2a,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i32 0, i32* %1
store i32 1, i32* %2
br label %4
4: ; preds = %5, %0
br i1 false, label %5, label %6
5: ; preds = %4
store i32 0, i32* %2
br label %4
6: ; preds = %4
ret i32 42
}

LLVM IR (-O2):
define i32 @main() {
ret i32 42
}
void DEBUG_print_timespec(struct timespec *time) { ; }


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

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

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

LLVM IR (-O2):
%struct.timespec = type opaque
define void @DEBUG_print_timespec(%struct.timespec* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ sleep(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc != 2) {
    fprintf(stderr, "Usage: %s secs\n", argv[0]);
    exit(1);
  }
  sleep(atoi(argv[1]));
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1186 <main+0x46>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe89(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,%edi
call   1060 <sleep@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    115d <main+0x1d>
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
mov    %eax,%edi
call   1060 <sleep@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe90(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"Usage: %s secs\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @atoi(i8* %18)
%20 = call i32 @sleep(i32 %19)
%21 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"Usage: %s secs\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = tail call i32 @sleep(i32 %12)
%14 = tail call i32 @exit(i32 0)
unreachable
}
int compare_char(const void *c1, const void *c2) {
  char a, b;
  a = (long)c1;
  b = (long)c2;
  return (a > b) - (a < b);
}


x86 assembly (clang, -O0):
<compare_char>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    %al,-0x12(%rbp)
movsbl -0x11(%rbp),%eax
movsbl -0x12(%rbp),%ecx
cmp    %ecx,%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
movsbl -0x11(%rbp),%ecx
movsbl -0x12(%rbp),%edx
cmp    %edx,%ecx
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_char>:
movsbl %dil,%ecx
movsbl %sil,%edx
xor    %eax,%eax
xor    %esi,%esi
cmp    %edx,%ecx
setg   %al
setl   %sil
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @compare_char(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = ptrtoint i8* %7 to i64
%9 = trunc i64 %8 to i8
store i8 %9, i8* %5
%10 = load i8*, i8** %4
%11 = ptrtoint i8* %10 to i64
%12 = trunc i64 %11 to i8
store i8 %12, i8* %6
%13 = load i8, i8* %5
%14 = sext i8 %13 to i32
%15 = load i8, i8* %6
%16 = sext i8 %15 to i32
%17 = icmp sgt i32 %14, %16
%18 = zext i1 %17 to i32
%19 = load i8, i8* %5
%20 = sext i8 %19 to i32
%21 = load i8, i8* %6
%22 = sext i8 %21 to i32
%23 = icmp slt i32 %20, %22
%24 = zext i1 %23 to i32
%25 = sub nsw i32 %18, %24
ret i32 %25
}

LLVM IR (-O2):
define i32 @compare_char(i8* %0, i8* %1) {
%3 = ptrtoint i8* %0 to i64
%4 = trunc i64 %3 to i32
%5 = ptrtoint i8* %1 to i64
%6 = trunc i64 %5 to i32
%7 = shl i32 %4, 24
%8 = ashr exact i32 %7, 24
%9 = shl i32 %6, 24
%10 = ashr exact i32 %9, 24
%11 = icmp sgt i32 %8, %10
%12 = zext i1 %11 to i32
%13 = icmp slt i32 %8, %10
%14 = sext i1 %13 to i32
%15 = add nsw i32 %14, %12
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ abort_wrapper();
void indirect_abort_example_ok() {
  int *p = NULL;
  abort_wrapper();
  *p = 42;
}


x86 assembly (clang, -O0):
<indirect_abort_example_ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <abort_wrapper@plt>
mov    -0x8(%rbp),%rax
movl   $0x2a,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<indirect_abort_example_ok>:
push   %rax
xor    %eax,%eax
call   1030 <abort_wrapper@plt>

LLVM IR (-O0):
define void @indirect_abort_example_ok() {
%1 = alloca i32*
store i32* null, i32** %1
%2 = call i32 (...) @abort_wrapper()
%3 = load i32*, i32** %1
store i32 42, i32* %3
ret void
}

LLVM IR (-O2):
define void @indirect_abort_example_ok() {
%1 = tail call i32 (...) @abort_wrapper()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ do_work();
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("in main\n");
  do_work();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <do_work@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@str = [8 x i8] c"in main\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @do_work()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ log_write(char *, char *, int, int);
int log_erro(char *msg, char *sensor) { log_write(msg, sensor, 2, 1); }


x86 assembly (clang, -O0):
<log_erro>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x2,%edx
mov    $0x1,%ecx
call   1030 <log_write@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_erro>:
mov    $0x2,%edx
mov    $0x1,%ecx
jmp    1030 <log_write@plt>

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

LLVM IR (-O2):
define i32 @log_erro(i8* %0, i8* %1) {
%3 = tail call i32 @log_write(i8* %0, i8* %1, i32 2, i32 1)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ btDisconnect(unsigned char const);
void disconnect(const unsigned char port) { btDisconnect(port); }


x86 assembly (clang, -O0):
<disconnect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edi
call   1030 <btDisconnect@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disconnect>:
jmp    1030 <btDisconnect@plt>

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

LLVM IR (-O2):
define void @disconnect(i8 zeroext %0) {
%2 = tail call i32 @btDisconnect(i8 zeroext %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ base_test();
int /*<<< orphan*/ greth_test(int);
int /*<<< orphan*/ report_end();
int /*<<< orphan*/ report_start();
int main(void) {
  report_start();
  base_test();
  greth_test(0x80000e00);
  report_end();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <report_start@plt>
mov    $0x0,%al
call   1050 <base_test@plt>
mov    $0x80000e00,%edi
call   1040 <greth_test@plt>
mov    $0x0,%al
call   1030 <report_end@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <report_start@plt>
xor    %eax,%eax
call   1050 <base_test@plt>
mov    $0x80000e00,%edi
call   1040 <greth_test@plt>
xor    %eax,%eax
call   1030 <report_end@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @report_start()
%2 = call i32 (...) @base_test()
%3 = call i32 @greth_test(i32 -2147480064)
%4 = call i32 (...) @report_end()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @report_start()
%2 = tail call i32 (...) @base_test()
%3 = tail call i32 @greth_test(i32 -2147480064)
%4 = tail call i32 (...) @report_end()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ printf(char *, char const *);
void barf(const char *msg) {
  printf("barf: %s\n", msg);
  abort();
}


x86 assembly (clang, -O0):
<barf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<barf>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"barf: %s\0A\00"
define void @barf(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@.str = [10 x i8] c"barf: %s\0A\00"
define void @barf(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (...) @abort()
unreachable
}
int is_element(int *p, int n, int num) {
  for (int i = 0; i < n; i++)
    if (num == p[i])
      return i;
  return -1;
}


x86 assembly (clang, -O0):
<is_element>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1153 <is_element+0x53>
mov    -0x18(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    1140 <is_element+0x40>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115a <is_element+0x5a>
jmp    1145 <is_element+0x45>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1115 <is_element+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_element>:
mov    $0xffffffff,%eax
test   %esi,%esi
jle    111e <is_element+0x1e>
mov    %esi,%esi
xor    %ecx,%ecx
nopl   (%rax)
cmp    %edx,(%rdi,%rcx,4)
je     111f <is_element+0x1f>
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    1110 <is_element+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @is_element(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %12
%8 = phi i64 [ 0, %5 ], [ %13, %12 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, %2
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %17, label %7
15: ; preds = %7
%16 = trunc i64 %8 to i32
br label %17
17: ; preds = %12, %15, %3
%18 = phi i32 [ -1, %3 ], [ %16, %15 ], [ -1, %12 ]
ret i32 %18
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fscanf(int /*<<< orphan*/ *, char *, int *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ shutdown(int, char *, int);
int get(FILE *stream) {
  int value;
  rewind(stream);
  if (fscanf(stream, "%d", &value) != 1) {
    shutdown(4, "Error reading /proc entry", 143 - 1);
  }
  return value;
}


x86 assembly (clang, -O0):
<get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <rewind@plt>
mov    -0x8(%rbp),%rdi
lea    0xeb0(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <fscanf@plt>
cmp    $0x1,%eax
je     1178 <get+0x48>
mov    $0x4,%edi
lea    0xe95(%rip),%rsi
mov    $0x8e,%edx
call   1030 <shutdown@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1040 <rewind@plt>
lea    0xebc(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
call   1050 <fscanf@plt>
cmp    $0x1,%eax
je     116c <get+0x3c>
lea    0xea6(%rip),%rsi
mov    $0x4,%edi
mov    $0x8e,%edx
call   1030 <shutdown@plt>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [26 x i8] c"Error reading /proc entry\00"
define i32 @get(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @rewind(i32* %4)
%6 = load i32*, i32** %2
%7 = call i32 @fscanf(i32* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = icmp ne i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @shutdown(i32 4, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 142)
br label %11
11: ; preds = %9, %1
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [26 x i8] c"Error reading /proc entry\00"
define i32 @get(i32* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @rewind(i32* %0)
%5 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = icmp eq i32 %5, 1
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = call i32 @shutdown(i32 4, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 142)
br label %9
9: ; preds = %7, %1
%10 = load i32, i32* %2
ret i32 %10
}
/* Type definitions */
struct flashrom_flashctx {
  int dummy;
};

/* Variables and functions */
int spi_disable_blockprotect_generic(struct flashrom_flashctx *, int, int,
                                     int /*<<< orphan*/, int);
int spi_disable_blockprotect_at25fs010(struct flashrom_flashctx *flash) {
  return spi_disable_blockprotect_generic(flash, 0x6C, 1 << 7, 0, 0xFF);
}


x86 assembly (clang, -O0):
<spi_disable_blockprotect_at25fs010>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x6c,%esi
mov    $0x80,%edx
xor    %ecx,%ecx
mov    $0xff,%r8d
call   1030 <spi_disable_blockprotect_generic@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_disable_blockprotect_at25fs010>:
mov    $0x6c,%esi
mov    $0x80,%edx
xor    %ecx,%ecx
mov    $0xff,%r8d
jmp    1030 <spi_disable_blockprotect_generic@plt>

LLVM IR (-O0):
%struct.flashrom_flashctx = type { i32 }
define i32 @spi_disable_blockprotect_at25fs010(%struct.flashrom_flashctx* %0) {
%2 = alloca %struct.flashrom_flashctx*
store %struct.flashrom_flashctx* %0, %struct.flashrom_flashctx** %2
%3 = load %struct.flashrom_flashctx*, %struct.flashrom_flashctx** %2
%4 = call i32 @spi_disable_blockprotect_generic(%struct.flashrom_flashctx* %3, i32 108, i32 128, i32 0, i32 255)
ret i32 %4
}

LLVM IR (-O2):
%struct.flashrom_flashctx = type { i32 }
define i32 @spi_disable_blockprotect_at25fs010(%struct.flashrom_flashctx* %0) {
%2 = tail call i32 @spi_disable_blockprotect_generic(%struct.flashrom_flashctx* %0, i32 108, i32 128, i32 0, i32 255)
ret i32 %2
}
/* Variables and functions */
int from_gps(int);
int ch_i_track(int ch) { return (from_gps((ch << 2) + 0x84)); }


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

x86 assembly (clang, -O2):
<ch_i_track>:
lea    0x84(,%rdi,4),%edi
jmp    1030 <from_gps@plt>

LLVM IR (-O0):
define i32 @ch_i_track(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 2
%5 = add nsw i32 %4, 132
%6 = call i32 @from_gps(i32 %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @ch_i_track(i32 %0) {
%2 = shl i32 %0, 2
%3 = add nsw i32 %2, 132
%4 = tail call i32 @from_gps(i32 %3)
ret i32 %4
}
/* Variables and functions */
int getc_unlocked(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int getchar_unlocked(void) { return getc_unlocked(stdin); }


x86 assembly (clang, -O0):
<getchar_unlocked>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <getc_unlocked@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<getchar_unlocked>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <getc_unlocked@plt>

LLVM IR (-O0):
@stdin = global i32 0
define i32 @getchar_unlocked() {
%1 = load i32, i32* @stdin
%2 = call i32 @getc_unlocked(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @getchar_unlocked() {
%1 = load i32, i32* @stdin
%2 = tail call i32 @getc_unlocked(i32 %1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *);
int main() {
  char *p;
  p = malloc(50 * sizeof(int));
  if (p) {
    printf("Yes, is was successful allocation \n");
    free(p);
  } else
    printf("Sorry, there is not enough memory on the heap =/ \n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xc8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1172 <main+0x42>
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
jmp    117e <main+0x4e>
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xc8,%edi
call   1050 <malloc@plt>
test   %rax,%rax
je     1159 <main+0x29>
mov    %rax,%rbx
lea    0xee8(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    1165 <main+0x35>
lea    0xea0(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Yes, is was successful allocation \0A\00"
@.str.1 = [51 x i8] c"Sorry, there is not enough memory on the heap =/ \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* @malloc(i32 200)
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %2
%9 = call i32 @free(i8* %8)
br label %12
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %6
ret i32 0
}

LLVM IR (-O2):
@str = [50 x i8] c"Sorry, there is not enough memory on the heap =/ \00"
@str.2 = [35 x i8] c"Yes, is was successful allocation \00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(200) i8* @malloc(i32 200)
%2 = icmp eq i8* %1, null
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.2, i64 0, i64 0))
%5 = tail call i32 @free(i8* %1)
br label %8
6: ; preds = %0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret i32 0
}