xunge/DecIR huggingface dataset:
int bitcount(unsigned x) {
  int b;
  for (b = 0; x != 0; x &= x - 1)
    b++;
  return b;
}


x86 assembly (clang, -O0):
<bitcount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1132 <bitcount+0x32>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    110e <bitcount+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitcount>:
xor    %eax,%eax
test   %edi,%edi
je     111c <bitcount+0x1c>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%eax
lea    -0x1(%rdi),%ecx
and    %edi,%ecx
mov    %ecx,%edi
jne    1110 <bitcount+0x10>
ret

LLVM IR (-O0):
define i32 @bitcount(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* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
store i32 %9, i32* %3
br label %10
10: ; preds = %7
%11 = load i32, i32* %2
%12 = sub i32 %11, 1
%13 = load i32, i32* %2
%14 = and i32 %13, %12
store i32 %14, i32* %2
br label %4
15: ; preds = %4
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @bitcount(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = add nuw nsw i32 %4, 1
%7 = add i32 %5, -1
%8 = and i32 %7, %5
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %11
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ internal_fiat_p448_selectznz(uintptr_t, uintptr_t, uintptr_t,
                                                uintptr_t);
void fiat_p448_selectznz(uint64_t out1[8], uint8_t arg1, const uint64_t arg2[8],
                         const uint64_t arg3[8]) {
  internal_fiat_p448_selectznz((uintptr_t)out1, (uintptr_t)arg1,
                               (uintptr_t)arg2, (uintptr_t)arg3);
}


x86 assembly (clang, -O0):
<fiat_p448_selectznz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <internal_fiat_p448_selectznz@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fiat_p448_selectznz>:
jmp    1030 <internal_fiat_p448_selectznz@plt>

LLVM IR (-O0):
define void @fiat_p448_selectznz(i32* %0, i64 %1, i32* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i32*
%8 = alloca i32*
store i32* %0, i32** %5
store i64 %1, i64* %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load i32*, i32** %5
%10 = ptrtoint i32* %9 to i64
%11 = load i64, i64* %6
%12 = load i32*, i32** %7
%13 = ptrtoint i32* %12 to i64
%14 = load i32*, i32** %8
%15 = ptrtoint i32* %14 to i64
%16 = call i32 @internal_fiat_p448_selectznz(i64 %10, i64 %11, i64 %13, i64 %15)
ret void
}

LLVM IR (-O2):
define void @fiat_p448_selectznz(i32* %0, i64 %1, i32* %2, i32* %3) {
%5 = ptrtoint i32* %0 to i64
%6 = ptrtoint i32* %2 to i64
%7 = ptrtoint i32* %3 to i64
%8 = tail call i32 @internal_fiat_p448_selectznz(i64 %5, i64 %1, i64 %6, i64 %7)
ret void
}
int rockchip_gpio_pullup(unsigned int pin, unsigned int pull) { return 0; }


x86 assembly (clang, -O0):
<rockchip_gpio_pullup>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @rockchip_gpio_pullup(i32 %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void printopts(void) {
  fprintf(stderr, "usage: mkfs [options] device isize fsize\n");
  exit(-1);
}


x86 assembly (clang, -O0):
<printopts>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<printopts>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [42 x i8] c"usage: mkfs [options] device isize fsize\0A\00"
define void @printopts() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [42 x i8] c"usage: mkfs [options] device isize fsize\0A\00"
define void @printopts() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
int left(int);
int isLeaf(int i, int m) { return (left(i) > m); }


x86 assembly (clang, -O0):
<isLeaf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <left@plt>
cmp    -0x8(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isLeaf>:
push   %rbx
mov    %esi,%ebx
call   1030 <left@plt>
xor    %ecx,%ecx
cmp    %ebx,%eax
setg   %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @isLeaf(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 = call i32 @left(i32 %5)
%7 = load i32, i32* %4
%8 = icmp sgt i32 %6, %7
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @isLeaf(i32 %0, i32 %1) {
%3 = tail call i32 @left(i32 %0)
%4 = icmp sgt i32 %3, %1
%5 = zext i1 %4 to i32
ret i32 %5
}
__attribute__((weak)) int test() { return 0; }


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

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

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

LLVM IR (-O2):
define weak i32 @test() {
ret i32 0
}
/* Variables and functions */
int uriUriStringToFilenameA(char const *, char *, int /*<<< orphan*/);
int uriUriStringToWindowsFilenameA(const char *uriString, char *filename) {
  return uriUriStringToFilenameA(uriString, filename, 0);
}


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

x86 assembly (clang, -O2):
<uriUriStringToWindowsFilenameA>:
xor    %edx,%edx
jmp    1030 <uriUriStringToFilenameA@plt>

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

LLVM IR (-O2):
define i32 @uriUriStringToWindowsFilenameA(i8* %0, i8* %1) {
%3 = tail call i32 @uriUriStringToFilenameA(i8* %0, i8* %1, i32 0)
ret i32 %3
}
void readZipEntry(const char *zippath, const char *entrypath) {}


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

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

LLVM IR (-O0):
define void @readZipEntry(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret void
}

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

/* Variables and functions */
int /*<<< orphan*/ EIO;
int /*<<< orphan*/ errno;
int mmc_fstat(int file __attribute__((unused)),
              struct stat *st __attribute__((unused))) {
  errno = EIO;
  return -1;
}


x86 assembly (clang, -O0):
<mmc_fstat>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ece(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebd(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mmc_fstat>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@EIO = global i32 0
@errno = global i32 0
define i32 @mmc_fstat(i32 %0, %struct.stat* %1) {
%3 = alloca i32
%4 = alloca %struct.stat*
store i32 %0, i32* %3
store %struct.stat* %1, %struct.stat** %4
%5 = load i32, i32* @EIO
store i32 %5, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@EIO = global i32 0
@errno = global i32 0
define i32 @mmc_fstat(i32 %0, %struct.stat* nocapture readnone %1) {
%3 = load i32, i32* @EIO
store i32 %3, i32* @errno
ret i32 -1
}
/* Variables and functions */
int cmp_lt_size_t(const void *p, const void *q) {
  const size_t a = *(const size_t *)p;
  const size_t b = *(const size_t *)q;
  do {
    if (a > b)
      return +1;
    if (b > a)
      return -1;
    return 0;
  } while (0);
}


x86 assembly (clang, -O0):
<cmp_lt_size_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jbe    113c <cmp_lt_size_t+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    115d <cmp_lt_size_t+0x5d>
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jbe    1156 <cmp_lt_size_t+0x56>
movl   $0xffffffff,-0x4(%rbp)
jmp    115d <cmp_lt_size_t+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_lt_size_t>:
mov    (%rdi),%rax
mov    (%rsi),%rcx
cmp    %rcx,%rax
sbb    %edx,%edx
cmp    %rcx,%rax
mov    $0x1,%eax
cmovbe %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @cmp_lt_size_t(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = bitcast i8* %1 to i64*
%6 = load i64, i64* %5
%7 = icmp ugt i64 %4, %6
%8 = icmp ugt i64 %6, %4
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
void path_026_expected_9(int a, int b, int c) {
  switch (a) {
  case 0:
    return;
  case 1:
    return;
  case 2:
    return;
  case 3:
    return;
  case 4:
    return;
  default:
    break;
  }
  if (b) {
  } else {
  }
  if (c) {
  } else {
  }
}


x86 assembly (clang, -O0):
<path_026_expected_9>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x4,%rax
ja     114b <path_026_expected_9+0x4b>
mov    -0x18(%rbp),%rax
lea    0xed7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1178 <path_026_expected_9+0x78>
jmp    1178 <path_026_expected_9+0x78>
jmp    1178 <path_026_expected_9+0x78>
jmp    1178 <path_026_expected_9+0x78>
jmp    1178 <path_026_expected_9+0x78>
jmp    1150 <path_026_expected_9+0x50>
cmpl   $0x0,-0x8(%rbp)
je     115f <path_026_expected_9+0x5f>
jmp    1164 <path_026_expected_9+0x64>
jmp    1164 <path_026_expected_9+0x64>
cmpl   $0x0,-0xc(%rbp)
je     1173 <path_026_expected_9+0x73>
jmp    1178 <path_026_expected_9+0x78>
jmp    1178 <path_026_expected_9+0x78>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @path_026_expected_9(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
switch i32 %7, label %13 [
i32 0, label %8
i32 1, label %9
i32 2, label %10
i32 3, label %11
i32 4, label %12
]
8: ; preds = %3
br label %24
9: ; preds = %3
br label %24
10: ; preds = %3
br label %24
11: ; preds = %3
br label %24
12: ; preds = %3
br label %24
13: ; preds = %3
br label %14
14: ; preds = %13
%15 = load i32, i32* %5
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %14
br label %19
18: ; preds = %14
br label %19
19: ; preds = %18, %17
%20 = load i32, i32* %6
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %19
br label %24
23: ; preds = %19
br label %24
24: ; preds = %8, %9, %10, %11, %12, %23, %22
ret void
}

LLVM IR (-O2):
define void @path_026_expected_9(i32 %0, i32 %1, i32 %2) {
ret void
}
/* Variables and functions */
unsigned long strtoul(char const *, char **, int);
int stclh_u(const char *string, unsigned long *pul) {
  char *pc;
  *pul = strtoul(string, &pc, 16);
  return pc - string;
}


x86 assembly (clang, -O0):
<stclh_u>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x10,%edx
call   1030 <strtoul@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stclh_u>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%rsi
mov    $0x10,%edx
call   1030 <strtoul@plt>
mov    %rax,(%r14)
mov    (%rsp),%eax
sub    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @stclh_u(i8* %0, i64* %1) {
%3 = alloca i8*
%4 = alloca i64*
%5 = alloca i8*
store i8* %0, i8** %3
store i64* %1, i64** %4
%6 = load i8*, i8** %3
%7 = call i64 @strtoul(i8* %6, i8** %5, i32 16)
%8 = load i64*, i64** %4
store i64 %7, i64* %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %3
%11 = ptrtoint i8* %9 to i64
%12 = ptrtoint i8* %10 to i64
%13 = sub i64 %11, %12
%14 = trunc i64 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @stclh_u(i8* %0, i64* nocapture writeonly %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call i64 @strtoul(i8* %0, i8** %3, i32 16)
store i64 %5, i64* %1
%6 = load i8*, i8** %3
%7 = ptrtoint i8* %6 to i64
%8 = ptrtoint i8* %0 to i64
%9 = sub i64 %7, %8
%10 = trunc i64 %9 to i32
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void roomba_delay(int millisecs) { usleep(millisecs * 1000); }


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

x86 assembly (clang, -O2):
<roomba_delay>:
imul   $0x3e8,%edi,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @roomba_delay(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 1000
%5 = call i32 @usleep(i32 %4)
ret void
}

LLVM IR (-O2):
define void @roomba_delay(i32 %0) {
%2 = mul nsw i32 %0, 1000
%3 = tail call i32 @usleep(i32 %2)
ret void
}
initchars() {}


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

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

LLVM IR (-O0):
define i32 @initchars() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @initchars() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ outb(unsigned int, int);
void setval(int what, unsigned val) {
  outb(what, 0x70);
  outb(val, 0x71);
}


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

x86 assembly (clang, -O2):
<setval>:
push   %rbx
mov    %esi,%ebx
mov    $0x70,%esi
call   1030 <outb@plt>
mov    %ebx,%edi
mov    $0x71,%esi
pop    %rbx
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @setval(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 = call i32 @outb(i32 %5, i32 112)
%7 = load i32, i32* %4
%8 = call i32 @outb(i32 %7, i32 113)
ret void
}

LLVM IR (-O2):
define void @setval(i32 %0, i32 %1) {
%3 = tail call i32 @outb(i32 %0, i32 112)
%4 = tail call i32 @outb(i32 %1, i32 113)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_greetings();
int /*<<< orphan*/ sleep(int);
int main() {
  while (1) {
    print_greetings();
    sleep(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <print_greetings@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
jmp    112f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <print_greetings@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0, %2
%3 = call i32 (...) @print_greetings()
%4 = call i32 @sleep(i32 1)
br label %2
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 (...) @print_greetings()
%3 = tail call i32 @sleep(i32 1)
br label %1
}
/* Variables and functions */
void *malloc(int);
void zero(void) { void *ptr = malloc(1024); }


x86 assembly (clang, -O0):
<zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x400,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @zero() {
%1 = alloca i8*
%2 = call i8* @malloc(i32 1024)
store i8* %2, i8** %1
ret void
}

LLVM IR (-O2):
define void @zero() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug_info(char *, int);
void *func(void *arg) {
  debug_info("I am a job......... %d", (int)arg);
  int i, b = 2;
  for (i = 0; i < 99999999; ++i) {
    b *= b;
  }
  debug_info("Job Done......... %d", (int)arg);
  return NULL;
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%esi
lea    0xed7(%rip),%rdi
call   1030 <debug_info@plt>
movl   $0x2,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x5f5e0ff,-0xc(%rbp)
jge    1161 <func+0x51>
mov    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113c <func+0x2c>
mov    -0x8(%rbp),%rax
mov    %eax,%esi
lea    0xea9(%rip),%rdi
call   1030 <debug_info@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [23 x i8] c"I am a job......... %d\00"
@.str.1 = [21 x i8] c"Job Done......... %d\00"
define i8* @func(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = ptrtoint i8* %5 to i32
%7 = call i32 @debug_info(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %6)
store i32 2, i32* %4
store i32 0, i32* %3
br label %8
8: ; preds = %15, %1
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 99999999
br i1 %10, label %11, label %18
11: ; preds = %8
%12 = load i32, i32* %4
%13 = load i32, i32* %4
%14 = mul nsw i32 %13, %12
store i32 %14, i32* %4
br label %15
15: ; preds = %11
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %8
18: ; preds = %8
%19 = load i8*, i8** %2
%20 = ptrtoint i8* %19 to i32
%21 = call i32 @debug_info(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %20)
ret i8* null
}

LLVM IR (-O2):
@.str = [23 x i8] c"I am a job......... %d\00"
@.str.1 = [21 x i8] c"Job Done......... %d\00"
define noalias i8* @func(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = tail call i32 @debug_info(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @debug_info(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret i8* null
}
int smack_label_ip_in_fd(int fd, const char *label) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @smack_label_ip_in_fd(i32 %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Type definitions */
typedef double clock_t;

/* Variables and functions */
double CLOCKS_PER_SEC;
double clock();
int /*<<< orphan*/ int_bubble_sort_2(int *, int);
double messe_int_bubble_sort_2(int array[], int laenge) {
  clock_t start = clock();
  int_bubble_sort_2(array, laenge);
  clock_t stop = clock();
  return (stop - start) / (1.0 * CLOCKS_PER_SEC);
}


x86 assembly (clang, -O0):
<messe_int_bubble_sort_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <int_bubble_sort_2@plt>
mov    $0x0,%al
call   1030 <clock@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  0xe9b(%rip),%xmm1
mov    0x2e7c(%rip),%rax
mulsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<messe_int_bubble_sort_2>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <clock@plt>
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <int_bubble_sort_2@plt>
xor    %eax,%eax
call   1030 <clock@plt>
subsd  (%rsp),%xmm0
mov    0x2e97(%rip),%rax
divsd  (%rax),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@CLOCKS_PER_SEC = global double 0.000000e+00
define double @messe_int_bubble_sort_2(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca double
%6 = alloca double
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = call double (...) @clock()
store double %7, double* %5
%8 = load i32*, i32** %3
%9 = load i32, i32* %4
%10 = call i32 @int_bubble_sort_2(i32* %8, i32 %9)
%11 = call double (...) @clock()
store double %11, double* %6
%12 = load double, double* %6
%13 = load double, double* %5
%14 = fsub double %12, %13
%15 = load double, double* @CLOCKS_PER_SEC
%16 = fmul double 1.000000e+00, %15
%17 = fdiv double %14, %16
ret double %17
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global double 0.000000e+00
define double @messe_int_bubble_sort_2(i32* %0, i32 %1) {
%3 = tail call double (...) @clock()
%4 = tail call i32 @int_bubble_sort_2(i32* %0, i32 %1)
%5 = tail call double (...) @clock()
%6 = fsub double %5, %3
%7 = load double, double* @CLOCKS_PER_SEC
%8 = fdiv double %6, %7
ret double %8
}
int test_04(char *x, unsigned char y) { return *x & y ? -40 : 60; }


x86 assembly (clang, -O0):
<test_04>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
movzbl -0x9(%rbp),%eax
and    %eax,%edx
mov    $0x3c,%eax
mov    $0xffffffd8,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_04>:
test   %sil,(%rdi)
mov    $0x3c,%ecx
mov    $0xffffffd8,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_04(i8* %0, i8 zeroext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = load i8, i8* %4
%9 = zext i8 %8 to i32
%10 = and i32 %7, %9
%11 = icmp ne i32 %10, 0
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 -40, i32 60
ret i32 %13
}

LLVM IR (-O2):
define i32 @test_04(i8* nocapture %0, i8 zeroext %1) {
%3 = load i8, i8* %0
%4 = and i8 %3, %1
%5 = icmp eq i8 %4, 0
%6 = select i1 %5, i32 60, i32 -40
ret i32 %6
}
int *ecma_getfirstdays(int isleap) {
  static int sdays[2][12 + 1] = {
      {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365},
      {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366}};
  return sdays[isleap];
}


x86 assembly (clang, -O0):
<ecma_getfirstdays>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rcx
lea    0x2f1e(%rip),%rax
imul   $0x34,%rcx,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ecma_getfirstdays>:
movslq %edi,%rax
imul   $0x34,%rax,%rcx
lea    0x2f22(%rip),%rax
add    %rcx,%rax
ret

LLVM IR (-O0):
@ecma_getfirstdays.sdays = internal global [2 x [13 x i32]] [[13 x i32] [i32 0, i32 31, i32 59, i32 90, i32 120, i32 151, i32 181, i32 212, i32 243, i32 273, i32 304, i32 334, i32 365], [13 x i32] [i32 0, i32 31, i32 60, i32 91, i32 121, i32 152, i32 182, i32 213, i32 244, i32 274, i32 305, i32 335, i32 366]]
define i32* @ecma_getfirstdays(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds [2 x [13 x i32]], [2 x [13 x i32]]* @ecma_getfirstdays.sdays, i64 0, i64 %4
%6 = getelementptr inbounds [13 x i32], [13 x i32]* %5, i64 0, i64 0
ret i32* %6
}

LLVM IR (-O2):
@ecma_getfirstdays.sdays = internal global [2 x [13 x i32]] [[13 x i32] [i32 0, i32 31, i32 59, i32 90, i32 120, i32 151, i32 181, i32 212, i32 243, i32 273, i32 304, i32 334, i32 365], [13 x i32] [i32 0, i32 31, i32 60, i32 91, i32 121, i32 152, i32 182, i32 213, i32 244, i32 274, i32 305, i32 335, i32 366]]
define i32* @ecma_getfirstdays(i32 %0) {
%2 = sext i32 %0 to i64
%3 = getelementptr inbounds [2 x [13 x i32]], [2 x [13 x i32]]* @ecma_getfirstdays.sdays, i64 0, i64 %2, i64 0
ret i32* %3
}
/* Type definitions */
struct perf_event_attr {
  int dummy;
};
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int syscall(int, struct perf_event_attr *, int /*<<< orphan*/, int, int,
            unsigned long);
int compat_sys_perf_event_open(struct perf_event_attr *attr, pid_t pid, int cpu,
                               int group_fd, unsigned long flags) {
  return syscall(298, attr, pid, cpu, group_fd, flags);
}


x86 assembly (clang, -O0):
<compat_sys_perf_event_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x20(%rbp),%r9
mov    $0x12a,%edi
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compat_sys_perf_event_open>:
mov    %r8,%r9
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%edx
mov    %rdi,%rsi
mov    $0x12a,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.perf_event_attr = type { i32 }
define i32 @compat_sys_perf_event_open(%struct.perf_event_attr* %0, i32 %1, i32 %2, i32 %3, i64 %4) {
%6 = alloca %struct.perf_event_attr*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i64
store %struct.perf_event_attr* %0, %struct.perf_event_attr** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i64 %4, i64* %10
%11 = load %struct.perf_event_attr*, %struct.perf_event_attr** %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = load i64, i64* %10
%16 = call i32 @syscall(i32 298, %struct.perf_event_attr* %11, i32 %12, i32 %13, i32 %14, i64 %15)
ret i32 %16
}

LLVM IR (-O2):
%struct.perf_event_attr = type { i32 }
define i32 @compat_sys_perf_event_open(%struct.perf_event_attr* %0, i32 %1, i32 %2, i32 %3, i64 %4) {
%6 = tail call i32 @syscall(i32 298, %struct.perf_event_attr* %0, i32 %1, i32 %2, i32 %3, i64 %4)
ret i32 %6
}
/* Type definitions */
struct timeval {
  double tv_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
double tv_to_double(struct timeval *tv) {
  return tv->tv_sec + (double)tv->tv_usec / 1000000;
}


x86 assembly (clang, -O0):
<tv_to_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
cvtsi2sdq 0x8(%rax),%xmm1
movsd  0xede(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<tv_to_double>:
cvtsi2sdq 0x8(%rdi),%xmm0
divsd  0xef2(%rip),%xmm0
addsd  (%rdi),%xmm0
ret

LLVM IR (-O0):
%struct.timeval = type { double, i64 }
define double @tv_to_double(%struct.timeval* %0) {
%2 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %2
%3 = load %struct.timeval*, %struct.timeval** %2
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%5 = load double, double* %4
%6 = load %struct.timeval*, %struct.timeval** %2
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = fdiv double %9, 1.000000e+06
%11 = fadd double %5, %10
ret double %11
}

LLVM IR (-O2):
%struct.timeval = type { double, i64 }
define double @tv_to_double(%struct.timeval* nocapture %0) {
%2 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%3 = load double, double* %2
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = fdiv double %6, 1.000000e+06
%8 = fadd double %3, %7
ret double %8
}
double mem_size(void) { return 0.0; }


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

x86 assembly (clang, -O2):
<mem_size>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @mem_size() {
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @mem_size() {
ret double 0.000000e+00
}
void ckAsmHlt(void) { __asm__ __volatile__("hlt"); }


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

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

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

LLVM IR (-O2):
define void @ckAsmHlt() {
tail call void asm sideeffect "hlt", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
void blink_blue(int duration) {
  int i;
  *((volatile long *)0xc0220084) = 0x46;
  for (i = 0; i < duration; i++) {
    asm volatile("nop\n");
  }
  *((volatile long *)0xc0220084) = 0x44;
  for (i = 0; i < duration; i++) {
    asm volatile("nop\n");
  }
}


x86 assembly (clang, -O0):
<blink_blue>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0xc0220084,%eax
movq   $0x46,(%rax)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1135 <blink_blue+0x35>
nop
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111a <blink_blue+0x1a>
mov    $0xc0220084,%eax
movq   $0x44,(%rax)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1163 <blink_blue+0x63>
nop
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1148 <blink_blue+0x48>
pop    %rbp
ret

x86 assembly (clang, -O2):
<blink_blue>:
mov    $0xc0220084,%eax
movq   $0x46,(%rax)
test   %edi,%edi
jle    1147 <blink_blue+0x47>
mov    %edi,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
nop
add    $0xffffffff,%ecx
jne    1120 <blink_blue+0x20>
movq   $0x44,(%rax)
test   %edi,%edi
jle    1146 <blink_blue+0x46>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
nop
add    $0xffffffff,%edi
jne    1140 <blink_blue+0x40>
ret
movq   $0x44,(%rax)
ret

LLVM IR (-O0):
define void @blink_blue(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store volatile i64 70, i64* inttoptr (i64 3223453828 to i64*)
store i32 0, i32* %3
br label %4
4: ; preds = %9, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %12
8: ; preds = %4
br label %9
9: ; preds = %8
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
br label %4
12: ; preds = %4
store volatile i64 68, i64* inttoptr (i64 3223453828 to i64*)
store i32 0, i32* %3
br label %13
13: ; preds = %18, %12
%14 = load i32, i32* %3
%15 = load i32, i32* %2
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %21
17: ; preds = %13
br label %18
18: ; preds = %17
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %13
21: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @blink_blue(i32 %0) {
store volatile i64 70, i64* inttoptr (i64 3223453828 to i64*)
%2 = icmp sgt i32 %0, 0
br i1 %2, label %4, label %3
3: ; preds = %1
store volatile i64 68, i64* inttoptr (i64 3223453828 to i64*)
br label %13
4: ; preds = %1, %4
%5 = phi i32 [ %6, %4 ], [ 0, %1 ]
tail call void asm sideeffect "nop\0A", "~{dirflag},~{fpsr},~{flags}"()
%6 = add nuw nsw i32 %5, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %4
8: ; preds = %4
store volatile i64 68, i64* inttoptr (i64 3223453828 to i64*)
br i1 %2, label %9, label %13
9: ; preds = %8, %9
%10 = phi i32 [ %11, %9 ], [ 0, %8 ]
tail call void asm sideeffect "nop\0A", "~{dirflag},~{fpsr},~{flags}"()
%11 = add nuw nsw i32 %10, 1
%12 = icmp eq i32 %11, %0
br i1 %12, label %13, label %9
13: ; preds = %9, %3, %8
ret void
}
/* Variables and functions */
int RAND_MAX;
int rand();
short rand_sign() { return rand() < (RAND_MAX >> 1) ? 1 : -1; }


x86 assembly (clang, -O0):
<rand_sign>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,%edx
mov    0x2ec4(%rip),%rax
mov    (%rax),%esi
sar    $0x1,%esi
mov    $0xffffffff,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmovl  %ecx,%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_sign>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
mov    0x2ec9(%rip),%rcx
mov    (%rcx),%ecx
sar    %ecx
xor    %edx,%edx
cmp    %ecx,%eax
setl   %dl
lea    (%rdx,%rdx,1),%eax
add    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@RAND_MAX = global i32 0
define signext i16 @rand_sign() {
%1 = call i32 (...) @rand()
%2 = load i32, i32* @RAND_MAX
%3 = ashr i32 %2, 1
%4 = icmp slt i32 %1, %3
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 1, i32 -1
%7 = trunc i32 %6 to i16
ret i16 %7
}

LLVM IR (-O2):
@RAND_MAX = global i32 0
define signext i16 @rand_sign() {
%1 = tail call i32 (...) @rand()
%2 = load i32, i32* @RAND_MAX
%3 = ashr i32 %2, 1
%4 = icmp slt i32 %1, %3
%5 = select i1 %4, i16 1, i16 -1
ret i16 %5
}
int isprint(int c) {
  if (c >= 0x20 && c != 0x7f)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<isprint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jl     1127 <isprint+0x27>
cmpl   $0x7f,-0x8(%rbp)
je     1127 <isprint+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <isprint+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isprint>:
cmp    $0x20,%edi
setge  %al
cmp    $0x7f,%edi
setne  %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @isprint(i32 %0) {
%2 = icmp sgt i32 %0, 31
%3 = icmp ne i32 %0, 127
%4 = and i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void ui_error(const char *msg) { fprintf(stderr, "%s\n", msg); }


x86 assembly (clang, -O0):
<ui_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ui_error>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @ui_error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ MON_10;
char *nl_langinfo(int /*<<< orphan*/);
char *langinfo_mon_10() { return nl_langinfo(MON_10); }


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

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

LLVM IR (-O0):
@MON_10 = global i32 0
define i8* @langinfo_mon_10() {
%1 = load i32, i32* @MON_10
%2 = call i8* @nl_langinfo(i32 %1)
ret i8* %2
}

LLVM IR (-O2):
@MON_10 = global i32 0
define i8* @langinfo_mon_10() {
%1 = load i32, i32* @MON_10
%2 = tail call i8* @nl_langinfo(i32 %1)
ret i8* %2
}
/* Type definitions */
struct timespec {
  int dummy;
};
typedef int /*<<< orphan*/ mqd_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int __mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len,
                   unsigned int msg_prio, const struct timespec *abs_timeout) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<__mq_timedsend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    0x2eb7(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__mq_timedsend>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@ENOSYS = global i32 0
define i32 @__mq_timedsend(i32 %0, i8* %1, i64 %2, i32 %3, %struct.timespec* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
%10 = alloca %struct.timespec*
store i32 %0, i32* %6
store i8* %1, i8** %7
store i64 %2, i64* %8
store i32 %3, i32* %9
store %struct.timespec* %4, %struct.timespec** %10
%11 = load i32, i32* @ENOSYS
%12 = call i32 @__set_errno(i32 %11)
ret i32 -1
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@ENOSYS = global i32 0
define i32 @__mq_timedsend(i32 %0, i8* nocapture readnone %1, i64 %2, i32 %3, %struct.timespec* nocapture readnone %4) {
%6 = load i32, i32* @ENOSYS
%7 = tail call i32 @__set_errno(i32 %6)
ret i32 -1
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
scalar_t__ time_cmp(struct timespec *, struct timespec const *);
int deadline_miss(const struct timespec *dl) {
  struct timespec now;
  clock_gettime(CLOCK_MONOTONIC, &now);
  return (time_cmp(&now, dl) > 0);
}


x86 assembly (clang, -O0):
<deadline_miss>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdi
call   1040 <time_cmp@plt>
cmp    $0x0,%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deadline_miss>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%r14
mov    %r14,%rsi
call   1030 <clock_gettime@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <time_cmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
setg   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_MONOTONIC = global i32 0
define i32 @deadline_miss(%struct.timespec* %0) {
%2 = alloca %struct.timespec*
%3 = alloca %struct.timespec
store %struct.timespec* %0, %struct.timespec** %2
%4 = load i32, i32* @CLOCK_MONOTONIC
%5 = call i32 @clock_gettime(i32 %4, %struct.timespec* %3)
%6 = load %struct.timespec*, %struct.timespec** %2
%7 = call i64 @time_cmp(%struct.timespec* %3, %struct.timespec* %6)
%8 = icmp sgt i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_MONOTONIC = global i32 0
define i32 @deadline_miss(%struct.timespec* %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
%4 = load i32, i32* @CLOCK_MONOTONIC
%5 = call i32 @clock_gettime(i32 %4, %struct.timespec* %2)
%6 = call i64 @time_cmp(%struct.timespec* %2, %struct.timespec* %0)
%7 = icmp sgt i64 %6, 0
%8 = zext i1 %7 to i32
ret i32 %8
}
void *foo(int i, int *p) {
lab:
  if (p)
    *p = i;
  goto *p;
  return &&lab;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     111f <foo+0x1f>
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
jmp    *%rax

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i8* @foo(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
br label %5
5: ; preds = %2
%6 = load i32*, i32** %4
%7 = icmp ne i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* %3
%10 = load i32*, i32** %4
store i32 %9, i32* %10
br label %11
11: ; preds = %8, %5
%12 = load i32*, i32** %4
%13 = bitcast i32* %12 to i8*
br label %14
14: ; preds = %11
%15 = phi i8* [ %13, %11 ]
indirectbr i8* %15, []
}

LLVM IR (-O2):
/* Variables and functions */
int /*<<< orphan*/ CRYPTO_malloc_init();
int /*<<< orphan*/ ENGINE_load_builtin_engines();
int /*<<< orphan*/ OpenSSL_add_all_algorithms();
int /*<<< orphan*/ SIGPIPE;
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ SSL_library_init();
int /*<<< orphan*/ SSL_load_error_strings();
int /*<<< orphan*/ setup_ui_method();
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
void openssl_startup(void) {
  signal(SIGPIPE, SIG_IGN);
  CRYPTO_malloc_init();
  OpenSSL_add_all_algorithms();
  SSL_library_init();
  SSL_load_error_strings();
  ENGINE_load_builtin_engines();
  setup_ui_method();
}


x86 assembly (clang, -O0):
<openssl_startup>:
push   %rbp
mov    %rsp,%rbp
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
mov    0x2e64(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    $0x0,%al
call   1080 <CRYPTO_malloc_init@plt>
mov    $0x0,%al
call   1050 <OpenSSL_add_all_algorithms@plt>
mov    $0x0,%al
call   1030 <SSL_library_init@plt>
mov    $0x0,%al
call   1060 <SSL_load_error_strings@plt>
mov    $0x0,%al
call   1070 <ENGINE_load_builtin_engines@plt>
mov    $0x0,%al
call   1090 <setup_ui_method@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<openssl_startup>:
push   %rax
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
mov    0x2e67(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
xor    %eax,%eax
call   1080 <CRYPTO_malloc_init@plt>
xor    %eax,%eax
call   1050 <OpenSSL_add_all_algorithms@plt>
xor    %eax,%eax
call   1030 <SSL_library_init@plt>
xor    %eax,%eax
call   1060 <SSL_load_error_strings@plt>
xor    %eax,%eax
call   1070 <ENGINE_load_builtin_engines@plt>
xor    %eax,%eax
pop    %rcx
jmp    1090 <setup_ui_method@plt>

LLVM IR (-O0):
@SIGPIPE = global i32 0
@SIG_IGN = global i32 0
define void @openssl_startup() {
%1 = load i32, i32* @SIGPIPE
%2 = load i32, i32* @SIG_IGN
%3 = call i32 @signal(i32 %1, i32 %2)
%4 = call i32 (...) @CRYPTO_malloc_init()
%5 = call i32 (...) @OpenSSL_add_all_algorithms()
%6 = call i32 (...) @SSL_library_init()
%7 = call i32 (...) @SSL_load_error_strings()
%8 = call i32 (...) @ENGINE_load_builtin_engines()
%9 = call i32 (...) @setup_ui_method()
ret void
}

LLVM IR (-O2):
@SIGPIPE = global i32 0
@SIG_IGN = global i32 0
define void @openssl_startup() {
%1 = load i32, i32* @SIGPIPE
%2 = load i32, i32* @SIG_IGN
%3 = tail call i32 @signal(i32 %1, i32 %2)
%4 = tail call i32 (...) @CRYPTO_malloc_init()
%5 = tail call i32 (...) @OpenSSL_add_all_algorithms()
%6 = tail call i32 (...) @SSL_library_init()
%7 = tail call i32 (...) @SSL_load_error_strings()
%8 = tail call i32 (...) @ENGINE_load_builtin_engines()
%9 = tail call i32 (...) @setup_ui_method()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ atomic_int;

/* Variables and functions */
int atomic_fetch_or(int /*<<< orphan*/ *, int);
int fi3e(atomic_int *i) { return atomic_fetch_or(i, 1); }


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

x86 assembly (clang, -O2):
<fi3e>:
mov    $0x1,%esi
jmp    1030 <atomic_fetch_or@plt>

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

LLVM IR (-O2):
define i32 @fi3e(i32* %0) {
%2 = tail call i32 @atomic_fetch_or(i32* %0, i32 1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void sighandler(int sig) {
  fprintf(stderr, "child exited\n");
  exit(0);
}


x86 assembly (clang, -O0):
<sighandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<sighandler>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [14 x i8] c"child exited\0A\00"
define void @sighandler(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 0)
unreachable
}