xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint8_t;
typedef unsigned int uint32_t;

/* Variables and functions */
uint32_t le32dec(const void *pp) {
  uint8_t const *p = (uint8_t const *)pp;
  return (((unsigned)p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]);
}


x86 assembly (clang, -O0):
<le32dec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%eax
shl    $0x18,%eax
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
or     (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<le32dec>:
mov    0xc(%rdi),%ecx
shl    $0x18,%ecx
mov    0x4(%rdi),%eax
mov    0x8(%rdi),%edx
shl    $0x10,%edx
or     %ecx,%edx
shl    $0x8,%eax
or     %edx,%eax
or     (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @le32dec(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = getelementptr inbounds i8, i8* %0, i64 12
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
%6 = shl i32 %5, 24
%7 = getelementptr inbounds i8, i8* %0, i64 8
%8 = bitcast i8* %7 to i32*
%9 = load i32, i32* %8
%10 = shl i32 %9, 16
%11 = or i32 %10, %6
%12 = getelementptr inbounds i8, i8* %0, i64 4
%13 = bitcast i8* %12 to i32*
%14 = load i32, i32* %13
%15 = shl i32 %14, 8
%16 = or i32 %11, %15
%17 = load i32, i32* %2
%18 = or i32 %16, %17
ret i32 %18
}
/* Variables and functions */
char *strncpy(char *dest, const char *src, size_t count) {
  char *tmp = dest;
  while (count-- && (*dest++ = *src++) != '\0') {
    ;
  }
  return tmp;
}


x86 assembly (clang, -O0):
<strncpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rcx
mov    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x21(%rbp)
je     1164 <strncpy+0x64>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1174 <strncpy+0x74>
jmp    1179 <strncpy+0x79>
jmp    1118 <strncpy+0x18>
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %rcx,%rdx
je     1126 <strncpy+0x26>
movzbl (%rsi,%rcx,1),%edi
mov    %dil,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dil,%dil
jne    1110 <strncpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @strncpy(i8* returned writeonly %0, i8* nocapture %1, i64 %2) {
br label %4
4: ; preds = %9, %3
%5 = phi i8* [ %1, %3 ], [ %11, %9 ]
%6 = phi i64 [ %2, %3 ], [ %10, %9 ]
%7 = phi i8* [ %0, %3 ], [ %13, %9 ]
%8 = icmp eq i64 %6, 0
br i1 %8, label %15, label %9
9: ; preds = %4
%10 = add i64 %6, -1
%11 = getelementptr inbounds i8, i8* %5, i64 1
%12 = load i8, i8* %5
%13 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %12, i8* %7
%14 = icmp eq i8 %12, 0
br i1 %14, label %15, label %4
15: ; preds = %4, %9
ret i8* %0
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ XPointer;
struct TYPE_3__ {
  scalar_t__ type;
};
typedef TYPE_1__ XEvent;
typedef int /*<<< orphan*/ Display;
typedef int /*<<< orphan*/ Bool;

/* Variables and functions */
scalar_t__ Expose;
int /*<<< orphan*/ False;
int /*<<< orphan*/ True;
Bool test_if_exposed(Display *disp, XEvent *event_ptr, XPointer dummy) {
  if (event_ptr->type == Expose) {
    return (True);
  }
  return (False);
}


x86 assembly (clang, -O0):
<test_if_exposed>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    0x2ec3(%rip),%rcx
cmp    (%rcx),%rax
jne    1137 <test_if_exposed+0x37>
mov    0x2eab(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1143 <test_if_exposed+0x43>
mov    0x2eaa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_if_exposed>:
mov    (%rsi),%rax
mov    0x2ed6(%rip),%rcx
cmp    (%rcx),%rax
jne    1119 <test_if_exposed+0x19>
mov    0x2ec2(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2ec8(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64 }
@Expose = global i64 0
@True = global i32 0
@False = global i32 0
define i32 @test_if_exposed(i32* %0, %struct.TYPE_3__* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca %struct.TYPE_3__*
%7 = alloca i32
store i32* %0, i32** %5
store %struct.TYPE_3__* %1, %struct.TYPE_3__** %6
store i32 %2, i32* %7
%8 = load %struct.TYPE_3__*, %struct.TYPE_3__** %6
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
%10 = load i64, i64* %9
%11 = load i64, i64* @Expose
%12 = icmp eq i64 %10, %11
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = load i32, i32* @True
store i32 %14, i32* %4
br label %17
15: ; preds = %3
%16 = load i32, i32* @False
store i32 %16, i32* %4
br label %17
17: ; preds = %15, %13
%18 = load i32, i32* %4
ret i32 %18
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i64 }
@Expose = global i64 0
@True = global i32 0
@False = global i32 0
define i32 @test_if_exposed(i32* nocapture readnone %0, %struct.TYPE_3__* nocapture %1, i32 %2) {
%4 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 0
%5 = load i64, i64* %4
%6 = load i64, i64* @Expose
%7 = icmp eq i64 %5, %6
%8 = load i32, i32* @True
%9 = load i32, i32* @False
%10 = select i1 %7, i32 %8, i32 %9
ret i32 %10
}
void foo(void) { int x; }


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

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

LLVM IR (-O0):
define void @foo() {
%1 = alloca i32
ret void
}

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

/* Variables and functions */
int __os_host_addr(char const *, struct in_addr *);
int /*<<< orphan*/ errno;
int os_error_from_gai(int, int /*<<< orphan*/);
int os_host_addr(const char *hostname, struct in_addr *addr) {
  int ret = __os_host_addr(hostname, addr);
  if (ret != 0)
    return -os_error_from_gai(ret, errno);
  return 0;
}


x86 assembly (clang, -O0):
<os_host_addr>:
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 <__os_host_addr@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1169 <os_host_addr+0x49>
mov    -0x1c(%rbp),%edi
mov    0x2e8c(%rip),%rax
mov    (%rax),%esi
call   1040 <os_error_from_gai@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1170 <os_host_addr+0x50>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_host_addr>:
push   %rax
call   1030 <__os_host_addr@plt>
test   %eax,%eax
je     113e <os_host_addr+0x1e>
mov    0x2eaf(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1040 <os_error_from_gai@plt>
neg    %eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.in_addr = type { i32 }
@errno = global i32 0
define i32 @os_host_addr(i8* %0, %struct.in_addr* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.in_addr*
%6 = alloca i32
store i8* %0, i8** %4
store %struct.in_addr* %1, %struct.in_addr** %5
%7 = load i8*, i8** %4
%8 = load %struct.in_addr*, %struct.in_addr** %5
%9 = call i32 @__os_host_addr(i8* %7, %struct.in_addr* %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i32, i32* %6
%14 = load i32, i32* @errno
%15 = call i32 @os_error_from_gai(i32 %13, i32 %14)
%16 = sub nsw i32 0, %15
store i32 %16, i32* %3
br label %18
17: ; preds = %2
store i32 0, i32* %3
br label %18
18: ; preds = %17, %12
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
%struct.in_addr = type { i32 }
@errno = global i32 0
define i32 @os_host_addr(i8* %0, %struct.in_addr* %1) {
%3 = tail call i32 @__os_host_addr(i8* %0, %struct.in_addr* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i32, i32* @errno
%7 = tail call i32 @os_error_from_gai(i32 %3, i32 %6)
%8 = sub nsw i32 0, %7
br label %9
9: ; preds = %2, %5
%10 = phi i32 [ %8, %5 ], [ 0, %2 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_version(void) {
  printf("fosrec-"
         "0.4.0"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"fosrec-0.4.0\0A\00"
define void @print_version() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [13 x i8] c"fosrec-0.4.0\00"
define void @print_version() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int COLOR_PAIR(int);
int color_pair(int n) { return COLOR_PAIR(n); }


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

x86 assembly (clang, -O2):
<color_pair>:
jmp    1030 <COLOR_PAIR@plt>

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

LLVM IR (-O2):
define i32 @color_pair(i32 %0) {
%2 = tail call i32 @COLOR_PAIR(i32 %0)
ret i32 %2
}
void rop3_174_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = ~T;
  stk2 = S & stk3;
  stk1 = *D | stk2;
  *D = (stk1 & (~S)) | (*D & S);
}


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

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

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

LLVM IR (-O2):
define void @rop3_174_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
ret void
}
unsigned int cast_uchar_uint_fast(unsigned char x) { return (unsigned int)x; }


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

x86 assembly (clang, -O2):
<cast_uchar_uint_fast>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @cast_uchar_uint_fast(i8 zeroext %0) {
%2 = zext i8 %0 to i32
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
scalar_t__ getpid();
scalar_t__ gettid();
int /*<<< orphan*/ printf(char *, long, long, char *);
int /*<<< orphan*/ stdout;
void whoami(char *msg) {
  printf("pid %ld Thread %ld %s\n", (long)getpid(), (long)gettid(), msg);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<whoami>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <gettid@plt>
mov    -0x10(%rbp),%rsi
mov    %rax,%rdx
mov    -0x8(%rbp),%rcx
lea    0xe90(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<whoami>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <gettid@plt>
lea    0xea1(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
mov    %r14,%rcx
call   1050 <printf@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <fflush@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"pid %ld Thread %ld %s\0A\00"
@stdout = global i32 0
define void @whoami(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i64 (...) @getpid()
%4 = call i64 (...) @gettid()
%5 = load i8*, i8** %2
%6 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i64 %3, i64 %4, i8* %5)
%7 = load i32, i32* @stdout
%8 = call i32 @fflush(i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"pid %ld Thread %ld %s\0A\00"
@stdout = global i32 0
define void @whoami(i8* %0) {
%2 = tail call i64 (...) @getpid()
%3 = tail call i64 (...) @gettid()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i64 %2, i64 %3, i8* %0)
%5 = load i32, i32* @stdout
%6 = tail call i32 @fflush(i32 %5)
ret void
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
char obstacle(char map[5][5]) {
  int i;
  srand(time(NULL));
  i = rand() % 5;
  map[i][4] = 'H';
  return (**map);
}


x86 assembly (clang, -O0):
<obstacle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x5,%rcx,%rcx
add    %rcx,%rax
movb   $0x48,0x4(%rax)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<obstacle>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
cltq
lea    (%rax,%rax,4),%rax
movb   $0x48,0x4(%rbx,%rax,1)
mov    (%rbx),%al
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @obstacle([5 x i8]* %0) {
%2 = alloca [5 x i8]*
%3 = alloca i32
store [5 x i8]* %0, [5 x i8]** %2
%4 = call i32 @time(i32* null)
%5 = call i32 @srand(i32 %4)
%6 = call i32 (...) @rand()
%7 = srem i32 %6, 5
store i32 %7, i32* %3
%8 = load [5 x i8]*, [5 x i8]** %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 %10
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %11, i64 0, i64 4
store i8 72, i8* %12
%13 = load [5 x i8]*, [5 x i8]** %2
%14 = getelementptr inbounds [5 x i8], [5 x i8]* %13, i64 0, i64 0
%15 = load i8, i8* %14
ret i8 %15
}

LLVM IR (-O2):
define signext i8 @obstacle([5 x i8]* nocapture %0) {
%2 = tail call i32 @time(i32* null)
%3 = tail call i32 @srand(i32 %2)
%4 = tail call i32 (...) @rand()
%5 = srem i32 %4, 5
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %0, i64 %6, i64 4
store i8 72, i8* %7
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %0, i64 0, i64 0
%9 = load i8, i8* %8
ret i8 %9
}
unsigned int TimerCalcMilliseconds(unsigned int m, unsigned int s) {
  return m * 60000 + s * 1000;
}


x86 assembly (clang, -O0):
<TimerCalcMilliseconds>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
imul   $0xea60,-0x4(%rbp),%eax
imul   $0x3e8,-0x8(%rbp),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerCalcMilliseconds>:
imul   $0xea60,%edi,%ecx
imul   $0x3e8,%esi,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @TimerCalcMilliseconds(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 = mul i32 %5, 60000
%7 = load i32, i32* %4
%8 = mul i32 %7, 1000
%9 = add i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @TimerCalcMilliseconds(i32 %0, i32 %1) {
%3 = mul i32 %0, 60000
%4 = mul i32 %1, 1000
%5 = add i32 %4, %3
ret i32 %5
}
/* Variables and functions */
long double expl(long double);
long double sinl(long double);
long double f_secondderivative(long double x) {
  return -expl(-x / 5.0L) / 25.0L + sinl(x);
}


x86 assembly (clang, -O0):
<f_secondderivative>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
flds   0xec9(%rip)
fdivrp %st,%st(1)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <expl@plt>
flds   0xebb(%rip)
fdivrp %st,%st(1)
fstpt  -0x1c(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <sinl@plt>
fldt   -0x1c(%rbp)
faddp  %st,%st(1)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_secondderivative>:
sub    $0x28,%rsp
fldt   0x30(%rsp)
fld    %st(0)
fstpt  0x1c(%rsp)
fdivs  0xecc(%rip)
fstpt  (%rsp)
call   1040 <expl@plt>
fdivs  0xec2(%rip)
fstpt  0x10(%rsp)
fldt   0x1c(%rsp)
fstpt  (%rsp)
call   1030 <sinl@plt>
fldt   0x10(%rsp)
faddp  %st,%st(1)
add    $0x28,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @f_secondderivative(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = fneg x86_fp80 %3
%5 = fdiv x86_fp80 %4, 0xK4001A000000000000000
%6 = call x86_fp80 @expl(x86_fp80 %5)
%7 = fneg x86_fp80 %6
%8 = fdiv x86_fp80 %7, 0xK4003C800000000000000
%9 = load x86_fp80, x86_fp80* %2
%10 = call x86_fp80 @sinl(x86_fp80 %9)
%11 = fadd x86_fp80 %8, %10
ret x86_fp80 %11
}

LLVM IR (-O2):
define x86_fp80 @f_secondderivative(x86_fp80 %0) {
%2 = fdiv x86_fp80 %0, 0xKC001A000000000000000
%3 = tail call x86_fp80 @expl(x86_fp80 %2)
%4 = fdiv x86_fp80 %3, 0xK4003C800000000000000
%5 = tail call x86_fp80 @sinl(x86_fp80 %0)
%6 = fsub x86_fp80 %5, %4
ret x86_fp80 %6
}
void remote_lookup(int tracknum, long int offset[tracknum]) {}


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

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

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

LLVM IR (-O2):
define void @remote_lookup(i32 %0, i64* nocapture %1) {
ret void
}
void foo528(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo528(i32 %0) {
ret void
}
char const *vr_id(void) { return "vr32"; }


x86 assembly (clang, -O0):
<vr_id>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [5 x i8] c"vr32\00"
define i8* @vr_id() {
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [5 x i8] c"vr32\00"
define i8* @vr_id() {
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
}
long kernel__Int__object_id(long self) {
  long var;
  var = self;
  goto RET_LABEL;
RET_LABEL:;
  return var;
}


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

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

LLVM IR (-O0):
define i64 @kernel__Int__object_id(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
store i64 %4, i64* %3
br label %5
5: ; preds = %1
%6 = load i64, i64* %3
ret i64 %6
}

LLVM IR (-O2):
define i64 @kernel__Int__object_id(i64 returned %0) {
ret i64 %0
}
/* Variables and functions */
char *malloc(int);
int main() {
  volatile char *c = malloc(sizeof(char));
  *c = 'a';
  return *c;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x61,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <malloc@plt>
movb   $0x61,(%rax)
movsbl (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* @malloc(i32 1)
store i8* %3, i8** %2
%4 = load i8*, i8** %2
store volatile i8 97, i8* %4
%5 = load i8*, i8** %2
%6 = load volatile i8, i8* %5
%7 = sext i8 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call dereferenceable_or_null(1) i8* @malloc(i32 1)
store volatile i8 97, i8* %1
%2 = load volatile i8, i8* %1
%3 = sext i8 %2 to i32
ret i32 %3
}
/* Variables and functions */
int strlen(char *);
void hide_args(int argc, char **argv) {
  if (argc > 1) {
    char *arg_end;
    arg_end = argv[argc - 1] + strlen(argv[argc - 1]);
    *arg_end = ' ';
  }
}


x86 assembly (clang, -O0):
<hide_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    116b <hide_args+0x5b>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x20,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hide_args>:
cmp    $0x2,%edi
jl     112c <hide_args+0x1c>
push   %rbx
add    $0xffffffff,%edi
mov    (%rsi,%rdi,8),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x20,(%rbx,%rax,1)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @hide_args(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = add nsw i32 %0, -1
%6 = zext i32 %5 to i64
%7 = getelementptr inbounds i8*, i8** %1, i64 %6
%8 = load i8*, i8** %7
%9 = tail call i32 @strlen(i8* %8)
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
store i8 32, i8* %11
br label %12
12: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ list;

/* Variables and functions */
int listxattr(char *, char *, int);
int main(void) {
  char list[1024];
  return listxattr("/some/path/to/somewhere", list, sizeof(list));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x410(%rbp),%rsi
lea    0xed0(%rip),%rdi
mov    $0x400,%edx
call   1030 <listxattr@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x408,%rsp
lea    0xee2(%rip),%rdi
mov    %rsp,%rsi
mov    $0x400,%edx
call   1030 <listxattr@plt>
add    $0x408,%rsp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"/some/path/to/somewhere\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32 @listxattr(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %3, i32 1024)
ret i32 %4
}

LLVM IR (-O2):
@.str = [24 x i8] c"/some/path/to/somewhere\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = call i32 @listxattr(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %2, i32 1024)
ret i32 %3
}
void ff_hevc_put_hevc_qpel_h8_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_qpel_h8_12_sse4() {
ret void
}
void _start_hardware(void) {
  unsigned int reg =
      ((0x11000000) | (((0x0) & 0x00000003) << 16) | (((0) & 0x000000FF) << 2) |
       (((0x15) & 0x0000001F) << 10));
  ((*(volatile unsigned int *)(reg)) = 0x00000001);
}


x86 assembly (clang, -O0):
<_start_hardware>:
push   %rbp
mov    %rsp,%rbp
movl   $0x11005400,-0x4(%rbp)
mov    -0x4(%rbp),%eax
movl   $0x1,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_start_hardware>:
movl   $0x1,0x11005400
ret

LLVM IR (-O0):
define void @_start_hardware() {
%1 = alloca i32
store i32 285234176, i32* %1
%2 = load i32, i32* %1
%3 = zext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
store volatile i32 1, i32* %4
ret void
}

LLVM IR (-O2):
define void @_start_hardware() {
store volatile i32 1, i32* inttoptr (i64 285234176 to i32*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ KillAllSaverChildrenSigHandler(int);
int /*<<< orphan*/ raise(int);
void HandleSIGTERM(int signo) {
  KillAllSaverChildrenSigHandler(signo);
  raise(signo);
}


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

x86 assembly (clang, -O2):
<HandleSIGTERM>:
push   %rbx
mov    %edi,%ebx
call   1040 <KillAllSaverChildrenSigHandler@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <raise@plt>

LLVM IR (-O0):
define void @HandleSIGTERM(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @KillAllSaverChildrenSigHandler(i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @raise(i32 %5)
ret void
}

LLVM IR (-O2):
define void @HandleSIGTERM(i32 %0) {
%2 = tail call i32 @KillAllSaverChildrenSigHandler(i32 %0)
%3 = tail call i32 @raise(i32 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ regex_t;

/* Variables and functions */
int /*<<< orphan*/ regfree(int /*<<< orphan*/ *);
void destroyRegex(regex_t *regex) { regfree(regex); }


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

x86 assembly (clang, -O2):
<destroyRegex>:
jmp    1030 <regfree@plt>

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

LLVM IR (-O2):
define void @destroyRegex(i32* %0) {
%2 = tail call i32 @regfree(i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
void free_pointer(int *int_pointer) { free(int_pointer); }


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

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

LLVM IR (-O2):
define void @free_pointer(i32* nocapture %0) {
%2 = tail call i32 @free(i32* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ shout(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, int /*<<< orphan*/);
void socket_error(char *fun) {
  char buf[1024];
  snprintf(buf, sizeof(buf), "%s errno: %ld\n", fun, errno);
  shout(buf);
}


x86 assembly (clang, -O0):
<socket_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    0x2e9f(%rip),%rax
mov    (%rax),%r8d
mov    $0x400,%esi
lea    0xeb0(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x410(%rbp),%rdi
call   1040 <shout@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<socket_error>:
push   %rbx
sub    $0x400,%rsp
mov    %rdi,%rcx
mov    0x2eae(%rip),%rax
mov    (%rax),%r8d
lea    0xec4(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <shout@plt>
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%s errno: %ld\0A\00"
@errno = global i32 0
define void @socket_error(i8* %0) {
%2 = alloca i8*
%3 = alloca [1024 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = load i32, i32* @errno
%7 = call i32 @snprintf(i8* %4, i32 1024, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%9 = call i32 @shout(i8* %8)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s errno: %ld\0A\00"
@errno = global i32 0
define void @socket_error(i8* %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = load i32, i32* @errno
%5 = call i32 @snprintf(i8* %3, i32 1024, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %4)
%6 = call i32 @shout(i8* %3)
ret void
}
/* Variables and functions */
int board_flash_reboot_common();
int board_flash_reboot() { return board_flash_reboot_common(); }


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

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

LLVM IR (-O0):
define i32 @board_flash_reboot() {
%1 = call i32 (...) @board_flash_reboot_common()
ret i32 %1
}

LLVM IR (-O2):
define i32 @board_flash_reboot() {
%1 = tail call i32 (...) @board_flash_reboot_common()
ret i32 %1
}
int biggest_common_divisor(int num, int den) {
  int i;
  for (i = num; i > 0; i--) {
    if (num % i == 0 && den % i == 0)
      return i;
  }
  return -1;
}


x86 assembly (clang, -O0):
<biggest_common_divisor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    1158 <biggest_common_divisor+0x58>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    1145 <biggest_common_divisor+0x45>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cmp    $0x0,%edx
jne    1145 <biggest_common_divisor+0x45>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115f <biggest_common_divisor+0x5f>
jmp    114a <biggest_common_divisor+0x4a>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1110 <biggest_common_divisor+0x10>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<biggest_common_divisor>:
mov    $0xffffffff,%r8d
test   %edi,%edi
jle    112f <biggest_common_divisor+0x2f>
mov    %edi,%ecx
jmp    111a <biggest_common_divisor+0x1a>
xchg   %ax,%ax
lea    -0x1(%rcx),%eax
cmp    $0x1,%ecx
mov    %eax,%ecx
jle    112f <biggest_common_divisor+0x2f>
mov    %edi,%eax
cltd
idiv   %ecx
test   %edx,%edx
jne    1110 <biggest_common_divisor+0x10>
mov    %esi,%eax
cltd
idiv   %ecx
test   %edx,%edx
jne    1110 <biggest_common_divisor+0x10>
mov    %ecx,%eax
ret
mov    %r8d,%eax
ret

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

LLVM IR (-O2):
define i32 @biggest_common_divisor(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %14
4: ; preds = %2, %11
%5 = phi i32 [ %12, %11 ], [ %0, %2 ]
%6 = srem i32 %0, %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = srem i32 %1, %5
%10 = icmp eq i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %4, %8
%12 = add nsw i32 %5, -1
%13 = icmp sgt i32 %5, 1
br i1 %13, label %4, label %14
14: ; preds = %8, %11, %2
%15 = phi i32 [ -1, %2 ], [ -1, %11 ], [ %5, %8 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ while_upto20(int);
void call_while_upto20_10_constant() { while_upto20(10); }


x86 assembly (clang, -O0):
<call_while_upto20_10_constant>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
call   1030 <while_upto20@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_while_upto20_10_constant>:
mov    $0xa,%edi
jmp    1030 <while_upto20@plt>

LLVM IR (-O0):
define void @call_while_upto20_10_constant() {
%1 = call i32 @while_upto20(i32 10)
ret void
}

LLVM IR (-O2):
define void @call_while_upto20_10_constant() {
%1 = tail call i32 @while_upto20(i32 10)
ret void
}
int getBitR(int A, int k) { return ((A & (1 << k)) != 0); }


x86 assembly (clang, -O0):
<getBitR>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getBitR>:
mov    %esi,%ecx
mov    %edi,%eax
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @getBitR(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 = shl i32 1, %6
%8 = and i32 %5, %7
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @getBitR(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
%4 = and i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void *realloc(void *, size_t);
void *xrealloc(void *ptr, size_t size) {
  ptr = realloc(ptr, size);
  if (!ptr)
    abort();
  return ptr;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1153 <xrealloc+0x33>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %rax
call   1040 <realloc@plt>
test   %rax,%rax
je     112d <xrealloc+0xd>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i8* @realloc(i8* %5, i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %2
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ console_tx_hex16(unsigned short);
void print_emerg_hex16(unsigned short value) { console_tx_hex16(value); }


x86 assembly (clang, -O0):
<print_emerg_hex16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edi
call   1030 <console_tx_hex16@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_emerg_hex16>:
jmp    1030 <console_tx_hex16@plt>

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

LLVM IR (-O2):
define void @print_emerg_hex16(i16 zeroext %0) {
%2 = tail call i32 @console_tx_hex16(i16 zeroext %0)
ret void
}
int test_imm_5Fuint16_mem(unsigned short *val) {
  return ((*val) & (-0x5F << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_5Fuint16_mem>:
movzwl (%rdi),%eax
test   $0xffa1,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_5Fuint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -95
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ siginfo_t;
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int __rt_sigqueueinfo(int /*<<< orphan*/, int, int /*<<< orphan*/ *);
int sigqueueinfo(pid_t pid, int sig, siginfo_t *info) {
  return __rt_sigqueueinfo(pid, sig, info);
}


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

x86 assembly (clang, -O2):
<sigqueueinfo>:
jmp    1030 <__rt_sigqueueinfo@plt>

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

LLVM IR (-O2):
define i32 @sigqueueinfo(i32 %0, i32 %1, i32* %2) {
%4 = tail call i32 @__rt_sigqueueinfo(i32 %0, i32 %1, i32* %2)
ret i32 %4
}
/* Variables and functions */
void *thread_create(void *arg) { return NULL; }


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

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

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

LLVM IR (-O2):
define noalias i8* @thread_create(i8* nocapture readnone %0) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ cgpush();
int /*<<< orphan*/ gentext();
void genpush(void) {
  gentext();
  cgpush();
}


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

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

LLVM IR (-O0):
define void @genpush() {
%1 = call i32 (...) @gentext()
%2 = call i32 (...) @cgpush()
ret void
}

LLVM IR (-O2):
define void @genpush() {
%1 = tail call i32 (...) @gentext()
%2 = tail call i32 (...) @cgpush()
ret void
}
/* Type definitions */
struct udev {
  int dummy;
};

/* Variables and functions */
int log_get_max_level();
int udev_get_log_priority(struct udev *udev) { return log_get_max_level(); }


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

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

LLVM IR (-O0):
%struct.udev = type { i32 }
define i32 @udev_get_log_priority(%struct.udev* %0) {
%2 = alloca %struct.udev*
store %struct.udev* %0, %struct.udev** %2
%3 = call i32 (...) @log_get_max_level()
ret i32 %3
}

LLVM IR (-O2):
%struct.udev = type { i32 }
define i32 @udev_get_log_priority(%struct.udev* nocapture readnone %0) {
%2 = tail call i32 (...) @log_get_max_level()
ret i32 %2
}
int getsig(s)
char *s;
{
  register int n;
  if ((n = getn(s)) < 0 || n > 32) {
    err("trap: bad signal number");
    n = 0;
  }
  return (n);
}


x86 assembly (clang, -O0):
<getsig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <getn@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jl     114d <getsig+0x2d>
cmpl   $0x20,-0xc(%rbp)
jle    1162 <getsig+0x42>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <err@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getsig>:
push   %rax
xor    %eax,%eax
call   1030 <getn@plt>
cmp    $0x21,%eax
jb     113d <getsig+0x1d>
lea    0xecc(%rip),%rdi
xor    %eax,%eax
call   1040 <err@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"trap: bad signal number\00"
define i32 @getsig(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @getn to i32 (i8*, ...)*)(i8* %4)
store i32 %5, i32* %3
%6 = icmp slt i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 32
br i1 %9, label %10, label %12
10: ; preds = %7, %1
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @err to i32 (i8*, ...)*)(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %12
12: ; preds = %10, %7
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@.str = [24 x i8] c"trap: bad signal number\00"
define i32 @getsig(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @getn to i32 (i8*, ...)*)(i8* %0)
%3 = icmp ugt i32 %2, 32
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @err to i32 (i8*, ...)*)(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 0, %4 ], [ %2, %1 ]
ret i32 %7
}