xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ test(char *, char *);
void TEST_bit_not(void) {
  test("-1 -2", "main(){printf(\"%d %d\", ~0, ~1);}");
  test("-1 -2", "main(){int i=0; int j=1; printf(\"%d %d\", ~i, ~j);}");
}


x86 assembly (clang, -O0):
<TEST_bit_not>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee4(%rip),%rsi
call   1030 <test@plt>
lea    0xed2(%rip),%rdi
lea    0xef2(%rip),%rsi
call   1030 <test@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TEST_bit_not>:
push   %rbx
lea    0xee8(%rip),%rbx
lea    0xee7(%rip),%rsi
mov    %rbx,%rdi
call   1030 <test@plt>
lea    0xef9(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <test@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"-1 -2\00"
@.str.1 = [33 x i8] c"main(){printf(\22%d %d\22, ~0, ~1);}\00"
@.str.2 = [51 x i8] c"main(){int i=0; int j=1; printf(\22%d %d\22, ~i, ~j);}\00"
define void @TEST_bit_not() {
%1 = call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"-1 -2\00"
@.str.1 = [33 x i8] c"main(){printf(\22%d %d\22, ~0, ~1);}\00"
@.str.2 = [51 x i8] c"main(){int i=0; int j=1; printf(\22%d %d\22, ~i, ~j);}\00"
define void @TEST_bit_not() {
%1 = tail call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @test(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ c;

/* Variables and functions */
int read(int const, char *, int);
int get_start(const int fd) {
  char c;
  if (read(fd, &c, sizeof(c)) != sizeof(c) || c != ':')
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<get_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x9(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
cltq
cmp    $0x1,%rax
jne    1145 <get_start+0x35>
movsbl -0x9(%rbp),%eax
cmp    $0x3a,%eax
je     1151 <get_start+0x41>
movl   $0x1,-0x4(%rbp)
jmp    1158 <get_start+0x48>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_start>:
push   %rax
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
cmp    $0x1,%eax
setne  %al
cmpb   $0x3a,0x7(%rsp)
setne  %cl
or     %al,%cl
movzbl %cl,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @get_start(i32 %0) {
%2 = alloca i8
%3 = call i32 @read(i32 %0, i8* %2, i32 1)
%4 = icmp ne i32 %3, 1
%5 = load i8, i8* %2
%6 = icmp ne i8 %5, 58
%7 = select i1 %4, i1 true, i1 %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ show_all_devs(int, char *);
int /*<<< orphan*/ show_all_devs_tree(int, char *);
main() {
  show_all_devs(1, "");
  show_all_devs_tree(1, "");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
lea    0xed0(%rip),%rsi
call   1040 <show_all_devs@plt>
mov    $0x1,%edi
lea    0xebf(%rip),%rsi
call   1030 <show_all_devs_tree@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    $0x1,%edi
mov    %rbx,%rsi
call   1040 <show_all_devs@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
call   1030 <show_all_devs_tree@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @main() {
%1 = tail call i32 @show_all_devs(i32 1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @show_all_devs_tree(i32 1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int gethostname(char *, int);
int get_hostname(char *hostname, int hostname_len) {
  int status = gethostname(hostname, hostname_len);
  if (status == 0) {
    return 0;
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<get_hostname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <gethostname@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1144 <get_hostname+0x34>
movl   $0x0,-0x4(%rbp)
jmp    114b <get_hostname+0x3b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_hostname>:
push   %rax
call   1030 <gethostname@plt>
neg    %eax
sbb    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @get_hostname(i8* %0, i32 %1) {
%3 = tail call i32 @gethostname(i8* %0, i32 %1)
%4 = icmp ne i32 %3, 0
%5 = sext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void __attribute__((destructor)) fini(void) { putchar('2'); }


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

x86 assembly (clang, -O2):
<fini>:
mov    $0x32,%edi
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @fini, i8* null }]
define void @fini() {
%1 = tail call i32 @putchar(i8 signext 50)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void *threadFunc(void *pArg) {
  int *p = (int *)pArg;
  int myNum = *p;
  printf("Thread number %d\n", myNum);
  return 0;
}


x86 assembly (clang, -O0):
<threadFunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [18 x i8] c"Thread number %d\0A\00"
define i8* @threadFunc(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = bitcast i8* %5 to i32*
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = load i32, i32* %7
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i8* null
}

LLVM IR (-O2):
@.str = [18 x i8] c"Thread number %d\0A\00"
define noalias i8* @threadFunc(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i8* null
}
char *hash_plugin_detailed(void) {
  return ("mssql-2005 - Microsoft SQL Server 2005 plugin\n"
          "------------------------\n"
          "Use this module to crack MS-SQL 2005 pwdencrypt() hashes\n"
          "Input should be in form: \'user:hash\' or just \'hash\'\n"
          "Known software that uses this password hashing method:\n"
          "Microsoft SQL Server 2005\n"
          "\nAuthor: Milen Rangelov <gat3way@gat3way.eu>\n");
}


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

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

LLVM IR (-O0):
@.str = [307 x i8] c"mssql-2005 - Microsoft SQL Server 2005 plugin\0A------------------------\0AUse this module to crack MS-SQL 2005 pwdencrypt() hashes\0AInput should be in form: 'user:hash' or just 'hash'\0AKnown software that uses this password hashing method:\0AMicrosoft SQL Server 2005\0A\0AAuthor: Milen Rangelov <gat3way@gat3way.eu>\0A\00"
define i8* @hash_plugin_detailed() {
ret i8* getelementptr inbounds ([307 x i8], [307 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [307 x i8] c"mssql-2005 - Microsoft SQL Server 2005 plugin\0A------------------------\0AUse this module to crack MS-SQL 2005 pwdencrypt() hashes\0AInput should be in form: 'user:hash' or just 'hash'\0AKnown software that uses this password hashing method:\0AMicrosoft SQL Server 2005\0A\0AAuthor: Milen Rangelov <gat3way@gat3way.eu>\0A\00"
define i8* @hash_plugin_detailed() {
ret i8* getelementptr inbounds ([307 x i8], [307 x i8]* @.str, i64 0, i64 0)
}
void pci_no_msi(void) {}


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

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

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

LLVM IR (-O2):
define void @pci_no_msi() {
ret void
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int /*<<< orphan*/ uint64_t;

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


x86 assembly (clang, -O0):
<fiat_p256_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_p256_selectznz@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fiat_p256_selectznz>:
jmp    1030 <internal_fiat_p256_selectznz@plt>

LLVM IR (-O0):
define void @fiat_p256_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_p256_selectznz(i64 %10, i64 %11, i64 %13, i64 %15)
ret void
}

LLVM IR (-O2):
define void @fiat_p256_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_p256_selectznz(i64 %5, i64 %1, i64 %6, i64 %7)
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ send_event;
};
typedef TYPE_1__ XMappingEvent;

/* Variables and functions */
int get_XMappingEvent_send_event(void *_p) {
  return (int)((XMappingEvent *)_p)->send_event;
}


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

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

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

LLVM IR (-O2):
define i32 @get_XMappingEvent_send_event(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ AddEvent(unsigned long, short);
int ArgNum();
void Act_When(void) {
  int time = ArgNum();
  int table = ArgNum();
  AddEvent((unsigned long)time, (short)table);
}


x86 assembly (clang, -O0):
<Act_When>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <ArgNum@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <ArgNum@plt>
mov    %eax,-0x8(%rbp)
movslq -0x4(%rbp),%rdi
mov    -0x8(%rbp),%eax
movswl %ax,%esi
call   1040 <AddEvent@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Act_When>:
push   %rbx
xor    %eax,%eax
call   1030 <ArgNum@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <ArgNum@plt>
movslq %ebx,%rdi
movswl %ax,%esi
pop    %rbx
jmp    1040 <AddEvent@plt>

LLVM IR (-O0):
define void @Act_When() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @ArgNum()
store i32 %3, i32* %1
%4 = call i32 (...) @ArgNum()
store i32 %4, i32* %2
%5 = load i32, i32* %1
%6 = sext i32 %5 to i64
%7 = load i32, i32* %2
%8 = trunc i32 %7 to i16
%9 = call i32 @AddEvent(i64 %6, i16 signext %8)
ret void
}

LLVM IR (-O2):
define void @Act_When() {
%1 = tail call i32 (...) @ArgNum()
%2 = tail call i32 (...) @ArgNum()
%3 = sext i32 %1 to i64
%4 = trunc i32 %2 to i16
%5 = tail call i32 @AddEvent(i64 %3, i16 signext %4)
ret void
}
/* Variables and functions */
char *malloc(int);
int rand();
char *realloc(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
char *fn15() {
  char *result;
  result = malloc(20 + rand() % 20);
  result = realloc(result, 30 + rand() % 20);
  strcpy((char *)result, "fn15");
  return result;
}


x86 assembly (clang, -O0):
<fn15>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x10(%rbp),%rdi
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1e,%esi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn15>:
push   %rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1e,%esi
mov    %rbx,%rdi
call   1050 <realloc@plt>
mov    %rax,%rbx
lea    0xe4f(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"fn15\00"
define i8* @fn15() {
%1 = alloca i8*
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 20
%4 = add nsw i32 20, %3
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 20
%9 = add nsw i32 30, %8
%10 = call i8* @realloc(i8* %6, i32 %9)
store i8* %10, i8** %1
%11 = load i8*, i8** %1
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %1
ret i8* %13
}

LLVM IR (-O2):
@.str = [5 x i8] c"fn15\00"
define i8* @fn15() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 20
%3 = add nsw i32 %2, 20
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 20
%7 = add nsw i32 %6, 30
%8 = tail call i8* @realloc(i8* %4, i32 %7)
%9 = tail call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
fatal(char *string) {
  printf("%s\n", string);
  exit(1);
}


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

x86 assembly (clang, -O2):
<fatal>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @fatal(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ PlayLevelSound(int, int, int);
void RunRobotWheel(int x, int y) { PlayLevelSound(x, y, 76); }


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

x86 assembly (clang, -O2):
<RunRobotWheel>:
mov    $0x4c,%edx
jmp    1030 <PlayLevelSound@plt>

LLVM IR (-O0):
define void @RunRobotWheel(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 = call i32 @PlayLevelSound(i32 %5, i32 %6, i32 76)
ret void
}

LLVM IR (-O2):
define void @RunRobotWheel(i32 %0, i32 %1) {
%3 = tail call i32 @PlayLevelSound(i32 %0, i32 %1, i32 76)
ret void
}
int letras_iguales(char letra1, char letra2) {
  if (letra1 == letra2) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<letras_iguales>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
movsbl -0x5(%rbp),%eax
movsbl -0x6(%rbp),%ecx
cmp    %ecx,%eax
jne    112c <letras_iguales+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    1133 <letras_iguales+0x33>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<letras_iguales>:
xor    %eax,%eax
cmp    %sil,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @letras_iguales(i8 signext %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
store i8 %0, i8* %4
store i8 %1, i8* %5
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
%8 = load i8, i8* %5
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %7, %9
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 1, i32* %3
br label %13
12: ; preds = %2
store i32 0, i32* %3
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @letras_iguales(i8 signext %0, i8 signext %1) {
%3 = icmp eq i8 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
void clipper_note_free(void *data) {}


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

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

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

LLVM IR (-O2):
define void @clipper_note_free(i8* nocapture %0) {
ret void
}
/* Variables and functions */
double exp(double);
double sigmoid(double x) {
  double expo, ret;
  expo = exp((double)-x);
  ret = 1 / (1 + expo);
  return ret;
}


x86 assembly (clang, -O0):
<sigmoid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  0xeb5(%rip),%xmm1
addsd  -0x10(%rbp),%xmm1
movsd  0xea8(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigmoid>:
push   %rax
xorpd  0xee7(%rip),%xmm0
call   1030 <exp@plt>
movsd  0xeea(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @sigmoid(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
%6 = fneg double %5
%7 = call double @exp(double %6)
store double %7, double* %3
%8 = load double, double* %3
%9 = fadd double 1.000000e+00, %8
%10 = fdiv double 1.000000e+00, %9
store double %10, double* %4
%11 = load double, double* %4
ret double %11
}

LLVM IR (-O2):
define double @sigmoid(double %0) {
%2 = fneg double %0
%3 = tail call double @exp(double %2)
%4 = fadd double %3, 1.000000e+00
%5 = fdiv double 1.000000e+00, %4
ret double %5
}
unsigned int get_sp(void) { __asm__("movl %esp, %eax"); }


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

x86 assembly (clang, -O2):
<get_sp>:
mov    %esp,%eax
ret

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

LLVM IR (-O2):
define i32 @get_sp() {
tail call void asm sideeffect "movl %esp, %eax", "~{dirflag},~{fpsr},~{flags}"()
ret i32 undef
}
/* Type definitions */
struct tree {
  int dummy;
};
struct node {
  int dummy;
};

/* Variables and functions */
struct node *tree_RB_MINMAX(struct tree *, int);
__attribute__((unused)) struct node *tree_min_node(struct tree *t) {
  return tree_RB_MINMAX(t, -1);
}


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

x86 assembly (clang, -O2):
<tree_min_node>:
mov    $0xffffffff,%esi
jmp    1030 <tree_RB_MINMAX@plt>

LLVM IR (-O0):
%struct.node = type { i32 }
%struct.tree = type { i32 }
define %struct.node* @tree_min_node(%struct.tree* %0) {
%2 = alloca %struct.tree*
store %struct.tree* %0, %struct.tree** %2
%3 = load %struct.tree*, %struct.tree** %2
%4 = call %struct.node* @tree_RB_MINMAX(%struct.tree* %3, i32 -1)
ret %struct.node* %4
}

LLVM IR (-O2):
%struct.node = type { i32 }
%struct.tree = type { i32 }
define %struct.node* @tree_min_node(%struct.tree* %0) {
%2 = tail call %struct.node* @tree_RB_MINMAX(%struct.tree* %0, i32 -1)
ret %struct.node* %2
}
int csub(int arg) { return (2 * arg); }


x86 assembly (clang, -O0):
<csub>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<csub>:
lea    (%rdi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @csub(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}
double CLAMP(double a, double rlo, double rhi) {
  return a < rlo ? rlo : (a > rhi ? rhi : a);
}


x86 assembly (clang, -O0):
<CLAMP>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1136 <CLAMP+0x36>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1169 <CLAMP+0x69>
movsd  -0x8(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1155 <CLAMP+0x55>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    115f <CLAMP+0x5f>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<CLAMP>:
minsd  %xmm0,%xmm2
cmpltsd %xmm1,%xmm0
movapd %xmm0,%xmm3
andnpd %xmm2,%xmm3
andpd  %xmm1,%xmm0
orpd   %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @CLAMP(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fcmp olt double %7, %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = load double, double* %5
br label %22
12: ; preds = %3
%13 = load double, double* %4
%14 = load double, double* %6
%15 = fcmp ogt double %13, %14
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = load double, double* %6
br label %20
18: ; preds = %12
%19 = load double, double* %4
br label %20
20: ; preds = %18, %16
%21 = phi double [ %17, %16 ], [ %19, %18 ]
br label %22
22: ; preds = %20, %10
%23 = phi double [ %11, %10 ], [ %21, %20 ]
ret double %23
}

LLVM IR (-O2):
define double @CLAMP(double %0, double %1, double %2) {
%4 = fcmp olt double %0, %1
%5 = fcmp ogt double %0, %2
%6 = select i1 %5, double %2, double %0
%7 = select i1 %4, double %1, double %6
ret double %7
}
/* Variables and functions */
int h(int, int);
int main() {
  int z = h(4, 10);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
mov    $0xa,%esi
call   1030 <h@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @h(i32 4, i32 10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ b();
int /*<<< orphan*/ c();
int /*<<< orphan*/ d();
int main() {
  c();
  b();
  d();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <c@plt>
mov    $0x0,%al
call   1040 <b@plt>
mov    $0x0,%al
call   1030 <d@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @c()
%2 = call i32 (...) @b()
%3 = call i32 (...) @d()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @c()
%2 = tail call i32 (...) @b()
%3 = tail call i32 (...) @d()
ret i32 0
}
/* Variables and functions */
float sinhf(float);
void __hv_sinh_f(float bIn, float *bOut) { *bOut = sinhf(bIn); }


x86 assembly (clang, -O0):
<__hv_sinh_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sinhf@plt>
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__hv_sinh_f>:
push   %rbx
mov    %rdi,%rbx
call   1030 <sinhf@plt>
movss  %xmm0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @__hv_sinh_f(float %0, float* %1) {
%3 = alloca float
%4 = alloca float*
store float %0, float* %3
store float* %1, float** %4
%5 = load float, float* %3
%6 = call float @sinhf(float %5)
%7 = load float*, float** %4
store float %6, float* %7
ret void
}

LLVM IR (-O2):
define void @__hv_sinh_f(float %0, float* nocapture writeonly %1) {
%3 = tail call float @sinhf(float %0)
store float %3, float* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ work(int, int /*<<< orphan*/);
void wrong3(int n) {
#pragma omp parallel default(shared)
  {
    int i;
#pragma omp for
    for (i = 0; i < n; i++) {
#pragma omp single
      work(i, 0);
    }
  }
}


x86 assembly (clang, -O0):
<wrong3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1146 <wrong3+0x36>
mov    -0x8(%rbp),%edi
xor    %esi,%esi
call   1030 <work@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <wrong3+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wrong3>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
jle    1130 <wrong3+0x20>
mov    %edi,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
xor    %esi,%esi
call   1030 <work@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1120 <wrong3+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @wrong3(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 @work(i32 %4, i32 0)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ convertToUppercase(char *);
int /*<<< orphan*/ printf(char *, char *);
void fig07_10() {
  char string[] = "cHaRaCters and $32.98";
  printf("The string before conversion is: %s", string);
  convertToUppercase(string);
  printf("\nThe string after conversion is: %s\n", string);
}


x86 assembly (clang, -O0):
<fig07_10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xec6(%rip),%ax
mov    %ax,-0xc(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <convertToUppercase@plt>
lea    -0x20(%rbp),%rsi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fig07_10>:
push   %rbx
sub    $0x20,%rsp
movaps 0xed4(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x38392e32332420,%rax
mov    %rax,0xe(%rsp)
lea    0xed0(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <convertToUppercase@plt>
lea    0xeda(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.fig07_10.string = [22 x i8] c"cHaRaCters and $32.98\00"
@.str = [36 x i8] c"The string before conversion is: %s\00"
@.str.1 = [37 x i8] c"\0AThe string after conversion is: %s\0A\00"
define void @fig07_10() {
%1 = alloca [22 x i8]
%2 = bitcast [22 x i8]* %1 to i8*
%3 = getelementptr inbounds [22 x i8], [22 x i8]* %1, i64 0, i64 0
%4 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [22 x i8], [22 x i8]* %1, i64 0, i64 0
%6 = call i32 @convertToUppercase(i8* %5)
%7 = getelementptr inbounds [22 x i8], [22 x i8]* %1, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %7)
ret void
}

LLVM IR (-O2):
@__const.fig07_10.string = [22 x i8] c"cHaRaCters and $32.98\00"
@.str = [36 x i8] c"The string before conversion is: %s\00"
@.str.1 = [37 x i8] c"\0AThe string after conversion is: %s\0A\00"
define void @fig07_10() {
%1 = alloca [22 x i8]
%2 = getelementptr inbounds [22 x i8], [22 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @convertToUppercase(i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CompileValue(int);
void DoValue(void) { CompileValue(89); }


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

x86 assembly (clang, -O2):
<DoValue>:
mov    $0x59,%edi
jmp    1030 <CompileValue@plt>

LLVM IR (-O0):
define void @DoValue() {
%1 = call i32 @CompileValue(i32 89)
ret void
}

LLVM IR (-O2):
define void @DoValue() {
%1 = tail call i32 @CompileValue(i32 89)
ret void
}
int test_imm_D6uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0xD6 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_D6uint64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $0x10,%rdx
and    $0xd6,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_D6uint64_midword_reg>:
test   $0xd60000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_D6uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 14024704
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void dpu_help() {
  printf("\td\tdump memory\n"
         "\tg\tgo - run the entire program\n"
         "\tl\tload a file into memory\n"
         "\tm\tmemory modify\n"
         "\tq\tquit\n"
         "\tr\tdisplay registers\n"
         "\tt\ttrace - execute one instruction\n"
         "\tw\twrite file\n"
         "\tz\treset all registers to zero\n"
         "\t?, h\tdisplay list of commands\n");
}


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

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

LLVM IR (-O0):
@.str = [231 x i8] c"\09d\09dump memory\0A\09g\09go - run the entire program\0A\09l\09load a file into memory\0A\09m\09memory modify\0A\09q\09quit\0A\09r\09display registers\0A\09t\09trace - execute one instruction\0A\09w\09write file\0A\09z\09reset all registers to zero\0A\09?, h\09display list of commands\0A\00"
define void @dpu_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([231 x i8], [231 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [230 x i8] c"\09d\09dump memory\0A\09g\09go - run the entire program\0A\09l\09load a file into memory\0A\09m\09memory modify\0A\09q\09quit\0A\09r\09display registers\0A\09t\09trace - execute one instruction\0A\09w\09write file\0A\09z\09reset all registers to zero\0A\09?, h\09display list of commands\00"
define void @dpu_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([230 x i8], [230 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
void *dlsym(void *, char const *);
void *_dgles_platform_sym(void *handle, const char *name) {
  return dlsym(handle, name);
}


x86 assembly (clang, -O0):
<_dgles_platform_sym>:
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   1030 <dlsym@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_dgles_platform_sym>:
jmp    1030 <dlsym@plt>

LLVM IR (-O0):
define i8* @_dgles_platform_sym(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 i8* @dlsym(i8* %5, i8* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @_dgles_platform_sym(i8* %0, i8* %1) {
%3 = tail call i8* @dlsym(i8* %0, i8* %1)
ret i8* %3
}
int test_imm_B4uint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0xB4 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_B4uint64_lowword_mem>:
testb  $0xb4,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_B4uint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 180
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int foo(int, char *);
int main() {
  if (foo(56, "abc") != 26)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x38,%edi
lea    0xeb5(%rip),%rsi
call   1040 <foo@plt>
cmp    $0x1a,%eax
je     1160 <main+0x30>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rsi
mov    $0x38,%edi
call   1040 <foo@plt>
cmp    $0x1a,%eax
jne    114e <main+0x1e>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"abc\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @foo(i32 56, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = icmp ne i32 %2, 26
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [4 x i8] c"abc\00"
define i32 @main() {
%1 = tail call i32 @foo(i32 56, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 26
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void send_line(const char *str, void *arg) {
  fputs(str, stdout);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<send_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea5(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_line>:
push   %rbx
mov    0x2eb8(%rip),%rbx
mov    (%rbx),%esi
call   1030 <fputs@plt>
mov    (%rbx),%edi
pop    %rbx
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@stdout = global i32 0
define void @send_line(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 i32, i32* @stdout
%7 = call i32 @fputs(i8* %5, i32 %6)
%8 = load i32, i32* @stdout
%9 = call i32 @fflush(i32 %8)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @send_line(i8* %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @fputs(i8* %0, i32 %3)
%5 = load i32, i32* @stdout
%6 = tail call i32 @fflush(i32 %5)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ u_int;

/* Variables and functions */
int bindthread2core(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ pthread_self();
int bind2core(u_int core_id) {
  return (bindthread2core(pthread_self(), core_id));
}


x86 assembly (clang, -O0):
<bind2core>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    %eax,%edi
mov    -0x4(%rbp),%esi
call   1030 <bindthread2core@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bind2core>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <pthread_self@plt>
mov    %eax,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <bindthread2core@plt>

LLVM IR (-O0):
define i32 @bind2core(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @pthread_self()
%4 = load i32, i32* %2
%5 = call i32 @bindthread2core(i32 %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @bind2core(i32 %0) {
%2 = tail call i32 (...) @pthread_self()
%3 = tail call i32 @bindthread2core(i32 %2, i32 %0)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int skipuntil(FILE *f, int s) {
  int c;
  while (!feof(f)) {
    c = fgetc(f);
    if (c == s) {
      break;
    }
  }
  return c;
}


x86 assembly (clang, -O0):
<skipuntil>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    114d <skipuntil+0x2d>
jmp    116f <skipuntil+0x4f>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    116a <skipuntil+0x4a>
jmp    116f <skipuntil+0x4f>
jmp    112f <skipuntil+0xf>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipuntil>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
call   1040 <feof@plt>
test   %eax,%eax
jne    1160 <skipuntil+0x40>
jmp    114e <skipuntil+0x2e>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <feof@plt>
test   %eax,%eax
jne    115d <skipuntil+0x3d>
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    %r14d,%eax
jne    1140 <skipuntil+0x20>
jmp    1160 <skipuntil+0x40>
mov    %ebp,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @skipuntil(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
br label %6
6: ; preds = %18, %2
%7 = load i32*, i32** %3
%8 = call i32 @feof(i32* %7)
%9 = icmp ne i32 %8, 0
%10 = xor i1 %9, true
br i1 %10, label %11, label %19
11: ; preds = %6
%12 = load i32*, i32** %3
%13 = call i32 @fgetc(i32* %12)
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = load i32, i32* %4
%16 = icmp eq i32 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %11
br label %19
18: ; preds = %11
br label %6
19: ; preds = %17, %6
%20 = load i32, i32* %5
ret i32 %20
}

LLVM IR (-O2):
define i32 @skipuntil(i32* nocapture %0, i32 %1) {
%3 = tail call i32 @feof(i32* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %11
5: ; preds = %8
%6 = tail call i32 @feof(i32* %0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2, %5
%9 = tail call i32 @fgetc(i32* %0)
%10 = icmp eq i32 %9, %1
br i1 %10, label %11, label %5
11: ; preds = %5, %8, %2
%12 = phi i32 [ undef, %2 ], [ %9, %5 ], [ %1, %8 ]
ret i32 %12
}
/* Variables and functions */
int fix_size(size_t size) {
  while ((size & 0x0F) != 0)
    size++;
  return size;
}


x86 assembly (clang, -O0):
<fix_size>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xf,%rax
cmp    $0x0,%rax
je     112b <fix_size+0x2b>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <fix_size+0x8>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fix_size>:
mov    %edi,%eax
neg    %eax
and    $0xf,%eax
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @fix_size(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
br label %3
3: ; preds = %7, %1
%4 = load i64, i64* %2
%5 = and i64 %4, 15
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = load i64, i64* %2
%9 = add i64 %8, 1
store i64 %9, i64* %2
br label %3
10: ; preds = %3
%11 = load i64, i64* %2
%12 = trunc i64 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @fix_size(i64 %0) {
%2 = sub i64 0, %0
%3 = and i64 %2, 15
%4 = add i64 %3, %0
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Type definitions */
struct fs_node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, unsigned int);
unsigned int zero_read(struct fs_node *node, unsigned int offset,
                       unsigned int size, char *buffer) {
  (void)node;
  (void)offset;
  memset(buffer + offset, 0, size);
  return size;
}


x86 assembly (clang, -O0):
<zero_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%eax
add    %rax,%rdi
mov    -0x10(%rbp),%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zero_read>:
push   %rbx
mov    %edx,%ebx
mov    %esi,%edi
add    %rcx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.fs_node = type { i32 }
define i32 @zero_read(%struct.fs_node* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca %struct.fs_node*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store %struct.fs_node* %0, %struct.fs_node** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = load %struct.fs_node*, %struct.fs_node** %5
%10 = load i32, i32* %6
%11 = load i8*, i8** %8
%12 = load i32, i32* %6
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i32, i32* %7
%16 = call i32 @memset(i8* %14, i32 0, i32 %15)
%17 = load i32, i32* %7
ret i32 %17
}

LLVM IR (-O2):
%struct.fs_node = type { i32 }
define i32 @zero_read(%struct.fs_node* nocapture readnone %0, i32 %1, i32 returned %2, i8* %3) {
%5 = zext i32 %1 to i64
%6 = getelementptr inbounds i8, i8* %3, i64 %5
%7 = tail call i32 @memset(i8* %6, i32 0, i32 %2)
ret i32 %2
}
/* Variables and functions */
int posix_memalign(void **, size_t, size_t);
void *aligned_alloc(size_t alignment, size_t size) {
  void *ptr;
  int n = posix_memalign(&ptr, alignment, size);
  return n == 0 ? ptr : NULL;
}


x86 assembly (clang, -O0):
<aligned_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rdi
call   1030 <posix_memalign@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    114b <aligned_alloc+0x3b>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    1156 <aligned_alloc+0x46>
xor    %eax,%eax
mov    %rax,-0x28(%rbp)
jmp    1156 <aligned_alloc+0x46>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aligned_alloc>:
push   %rax
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    %rsp,%rdi
call   1030 <posix_memalign@plt>
test   %eax,%eax
jne    1129 <aligned_alloc+0x19>
mov    (%rsp),%rax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @aligned_alloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i32
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %3
%8 = load i64, i64* %4
%9 = call i32 @posix_memalign(i8** %5, i64 %7, i64 %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load i8*, i8** %5
br label %15
14: ; preds = %2
br label %15
15: ; preds = %14, %12
%16 = phi i8* [ %13, %12 ], [ null, %14 ]
ret i8* %16
}

LLVM IR (-O2):
define i8* @aligned_alloc(i64 %0, i64 %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call i32 @posix_memalign(i8** %3, i64 %0, i64 %1)
%6 = icmp eq i32 %5, 0
%7 = load i8*, i8** %3
%8 = select i1 %6, i8* %7, i8* null
ret i8* %8
}