xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ getch();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ showMenu();
int /*<<< orphan*/ system(char *);
void doDelete() {
  system("cls");
  printf("--- Deletion ---\n");
  printf("\n\n\nPress any key to continue...\n");
  getch();
  showMenu();
}


x86 assembly (clang, -O0):
<doDelete>:
push   %rbp
mov    %rsp,%rbp
lea    0xeb5(%rip),%rdi
call   1030 <system@plt>
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getch@plt>
mov    $0x0,%al
call   1050 <showMenu@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<doDelete>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1040 <system@plt>
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <getch@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <showMenu@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"cls\00"
@.str.1 = [18 x i8] c"--- Deletion ---\0A\00"
@.str.2 = [33 x i8] c"\0A\0A\0APress any key to continue...\0A\00"
define void @doDelete() {
%1 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 (...) @getch()
%5 = call i32 (...) @showMenu()
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
@str = [17 x i8] c"--- Deletion ---\00"
@str.3 = [32 x i8] c"\0A\0A\0APress any key to continue...\00"
define void @doDelete() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.3, i64 0, i64 0))
%4 = tail call i32 (...) @getch()
%5 = tail call i32 (...) @showMenu()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
uint8_t rtp2435q_get_precision(uint8_t *header) { return header[1]; }


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

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

LLVM IR (-O0):
define i32 @rtp2435q_get_precision(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 1
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @rtp2435q_get_precision(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = load i32, i32* %2
ret i32 %3
}
short prog_q168abs(short A) {
  short S;
  if (A < 0)
    S = -A;
  else
    S = A;
  return S;
}


x86 assembly (clang, -O0):
<prog_q168abs>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
cmp    $0x0,%eax
jge    1129 <prog_q168abs+0x29>
movswl -0x2(%rbp),%ecx
xor    %eax,%eax
sub    %ecx,%eax
mov    %ax,-0x4(%rbp)
jmp    1131 <prog_q168abs+0x31>
mov    -0x2(%rbp),%ax
mov    %ax,-0x4(%rbp)
movswl -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<prog_q168abs>:
mov    %edi,%eax
neg    %ax
cmovs  %di,%ax
ret

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

LLVM IR (-O2):
define signext i16 @prog_q168abs(i16 signext %0) {
%2 = tail call i16 @llvm.abs.i16(i16 %0, i1 false)
ret i16 %2
}
/* Variables and functions */
int /*<<< orphan*/ assert(char *);
char *malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, void *);
char *cl_object_printer(void *self) {
  char *buffer = malloc(sizeof(char) * 19);
  assert(buffer);
  sprintf(buffer, "%p", self);
  return buffer;
}


x86 assembly (clang, -O0):
<cl_object_printer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x13,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe9e(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cl_object_printer>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x13,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <assert@plt>
lea    0xead(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1050 <sprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%p\00"
define i8* @cl_object_printer(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = call i8* @malloc(i32 19)
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @assert(i8* %5)
%7 = load i8*, i8** %3
%8 = load i8*, i8** %2
%9 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
@.str = [3 x i8] c"%p\00"
define i8* @cl_object_printer(i8* %0) {
%2 = tail call dereferenceable_or_null(19) i8* @malloc(i32 19)
%3 = tail call i32 @assert(i8* %2)
%4 = tail call i32 @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ i16_test();
int /*<<< orphan*/ i32_test();
int /*<<< orphan*/ i64_test();
int /*<<< orphan*/ i8_test();
int /*<<< orphan*/ u16_test();
int /*<<< orphan*/ u32_test();
int /*<<< orphan*/ u64_test();
int /*<<< orphan*/ u8_test();
int test(void) {
  u8_test();
  i8_test();
  u16_test();
  i16_test();
  u32_test();
  i32_test();
  u64_test();
  i64_test();
  return 0;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <u8_test@plt>
mov    $0x0,%al
call   1030 <i8_test@plt>
mov    $0x0,%al
call   1090 <u16_test@plt>
mov    $0x0,%al
call   1080 <i16_test@plt>
mov    $0x0,%al
call   1060 <u32_test@plt>
mov    $0x0,%al
call   1040 <i32_test@plt>
mov    $0x0,%al
call   10a0 <u64_test@plt>
mov    $0x0,%al
call   1070 <i64_test@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
xor    %eax,%eax
call   1050 <u8_test@plt>
xor    %eax,%eax
call   1030 <i8_test@plt>
xor    %eax,%eax
call   1090 <u16_test@plt>
xor    %eax,%eax
call   1080 <i16_test@plt>
xor    %eax,%eax
call   1060 <u32_test@plt>
xor    %eax,%eax
call   1040 <i32_test@plt>
xor    %eax,%eax
call   10a0 <u64_test@plt>
xor    %eax,%eax
call   1070 <i64_test@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @test() {
%1 = call i32 (...) @u8_test()
%2 = call i32 (...) @i8_test()
%3 = call i32 (...) @u16_test()
%4 = call i32 (...) @i16_test()
%5 = call i32 (...) @u32_test()
%6 = call i32 (...) @i32_test()
%7 = call i32 (...) @u64_test()
%8 = call i32 (...) @i64_test()
ret i32 0
}

LLVM IR (-O2):
define i32 @test() {
%1 = tail call i32 (...) @u8_test()
%2 = tail call i32 (...) @i8_test()
%3 = tail call i32 (...) @u16_test()
%4 = tail call i32 (...) @i16_test()
%5 = tail call i32 (...) @u32_test()
%6 = tail call i32 (...) @i32_test()
%7 = tail call i32 (...) @u64_test()
%8 = tail call i32 (...) @i64_test()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ init_rtl_433_for_rtlwx_without_rtlfm();
int /*<<< orphan*/ stderr;
void *rtl_433fm_thread(void *param) {
  init_rtl_433_for_rtlwx_without_rtlfm();
  fprintf(stderr, "RTL 433 FM Thread exited unexpectedly\n");
  return NULL;
}


x86 assembly (clang, -O0):
<rtl_433fm_thread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <init_rtl_433_for_rtlwx_without_rtlfm@plt>
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
lea    0xebd(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtl_433fm_thread>:
push   %rax
xor    %eax,%eax
call   1030 <init_rtl_433_for_rtlwx_without_rtlfm@plt>
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
lea    0xec8(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [39 x i8] c"RTL 433 FM Thread exited unexpectedly\0A\00"
define i8* @rtl_433fm_thread(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @init_rtl_433_for_rtlwx_without_rtlfm()
%4 = load i32, i32* @stderr
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
ret i8* null
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [39 x i8] c"RTL 433 FM Thread exited unexpectedly\0A\00"
define noalias i8* @rtl_433fm_thread(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @init_rtl_433_for_rtlwx_without_rtlfm()
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
ret i8* null
}
int set_on_off_bit(int reg, int bit, int on_off) {
  if (on_off) {
    return reg |= (1 << bit);
  } else {
    return reg &= ~(1 << bit);
  }
}


x86 assembly (clang, -O0):
<set_on_off_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     112f <set_on_off_bit+0x2f>
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    %eax,-0x4(%rbp)
jmp    1145 <set_on_off_bit+0x45>
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_on_off_bit>:
mov    %edi,%eax
bts    %esi,%eax
btr    %esi,%edi
test   %edx,%edx
cmove  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @set_on_off_bit(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
%5 = shl nuw i32 1, %1
%6 = or i32 %5, %0
%7 = xor i32 %5, -1
%8 = and i32 %7, %0
%9 = select i1 %4, i32 %8, i32 %6
ret i32 %9
}
/* Type definitions */
struct yaffs_dev {
  int dummy;
};

/* Variables and functions */
int yaffs_sync_common(struct yaffs_dev *, int /*<<< orphan*/, int);
int yaffs_sync_reldev(struct yaffs_dev *dev) {
  return yaffs_sync_common(dev, (0), 1);
}


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

x86 assembly (clang, -O2):
<yaffs_sync_reldev>:
xor    %esi,%esi
mov    $0x1,%edx
jmp    1030 <yaffs_sync_common@plt>

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

LLVM IR (-O2):
%struct.yaffs_dev = type { i32 }
define i32 @yaffs_sync_reldev(%struct.yaffs_dev* %0) {
%2 = tail call i32 @yaffs_sync_common(%struct.yaffs_dev* %0, i32 0, i32 1)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char fgetc(int /*<<< orphan*/ *);
char read_char(FILE *fp) { return fgetc(fp); }


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

x86 assembly (clang, -O2):
<read_char>:
jmp    1030 <fgetc@plt>

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

LLVM IR (-O2):
define signext i8 @read_char(i32* nocapture %0) {
%2 = tail call signext i8 @fgetc(i32* %0)
ret i8 %2
}
lib_a_init(void) { printf("%s\n", __FUNCTION__); }


x86 assembly (clang, -O0):
<lib_a_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    0xede(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@__FUNCTION__.lib_a_init = [11 x i8] c"lib_a_init\00"
define i32 @lib_a_init() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @__FUNCTION__.lib_a_init, i64 0, i64 0))
ret i32 undef
}
char *flag(int b) { return b ? "+" : " "; }


x86 assembly (clang, -O0):
<flag>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xef1(%rip),%rax
lea    0xee8(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<flag>:
test   %edi,%edi
lea    0xef9(%rip),%rcx
lea    0xef0(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [2 x i8] c"+\00"
@.str.1 = [2 x i8] c" \00"
define i8* @flag(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
ret i8* %6
}

LLVM IR (-O2):
@.str = [2 x i8] c"+\00"
@.str.1 = [2 x i8] c" \00"
define i8* @flag(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ reverse(char *, int /*<<< orphan*/, scalar_t__);
scalar_t__ strlen(char *);
int main(void) {
  char s[] = "Daniel";
  reverse(s, 0, strlen(s) - 1);
  printf("---> %s\n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xebb(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xeb5(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xead(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0xb(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0xb(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %rax,%rdx
sub    $0x1,%rdx
xor    %esi,%esi
call   1030 <reverse@plt>
lea    -0xb(%rbp),%rsi
lea    0xe7d(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x6c6569,0xb(%rsp)
movl   $0x696e6144,0x8(%rsp)
69
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    -0x1(%rax),%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <reverse@plt>
lea    0xea0(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.s = [7 x i8] c"Daniel\00"
@.str = [9 x i8] c"---> %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8]
store i32 0, i32* %1
%3 = bitcast [7 x i8]* %2 to i8*
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%6 = call i64 @strlen(i8* %5)
%7 = sub nsw i64 %6, 1
%8 = call i32 @reverse(i8* %4, i32 0, i64 %7)
%9 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [7 x i8] c"Daniel\00"
@.str = [9 x i8] c"---> %s\0A\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%3 = call i64 @strlen(i8* %2)
%4 = add nsw i64 %3, -1
%5 = call i32 @reverse(i8* %2, i32 0, i64 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void fat_tests() { printf("\n\tstarting tests !!!\n"); }


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

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

LLVM IR (-O0):
@.str = [22 x i8] c"\0A\09starting tests !!!\0A\00"
define void @fat_tests() {
%1 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [21 x i8] c"\0A\09starting tests !!!\00"
define void @fat_tests() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
uintptr_t getpagesize();
void *malloc(size_t);
uintptr_t sbrk(uintptr_t);
void *valloc(size_t size) {
  uintptr_t base = sbrk(0);
  sbrk(base % getpagesize());
  return malloc(size);
}


x86 assembly (clang, -O0):
<valloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1030 <sbrk@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1050 <getpagesize@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
xor    %edx,%edx
div    %rcx
mov    %rdx,%rdi
call   1030 <sbrk@plt>
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<valloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %edi,%edi
call   1030 <sbrk@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <getpagesize@plt>
mov    %rax,%rcx
mov    %rbx,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     1164 <valloc+0x34>
mov    %rbx,%rax
xor    %edx,%edx
div    %rcx
mov    %rdx,%rdi
jmp    116c <valloc+0x3c>
mov    %ebx,%eax
xor    %edx,%edx
div    %ecx
mov    %edx,%edi
call   1030 <sbrk@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <malloc@plt>

LLVM IR (-O0):
define i8* @valloc(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = call i64 @sbrk(i64 0)
store i64 %4, i64* %3
%5 = load i64, i64* %3
%6 = call i64 (...) @getpagesize()
%7 = urem i64 %5, %6
%8 = call i64 @sbrk(i64 %7)
%9 = load i64, i64* %2
%10 = call i8* @malloc(i64 %9)
ret i8* %10
}

LLVM IR (-O2):
define noalias i8* @valloc(i64 %0) {
%2 = tail call i64 @sbrk(i64 0)
%3 = tail call i64 (...) @getpagesize()
%4 = urem i64 %2, %3
%5 = tail call i64 @sbrk(i64 %4)
%6 = tail call i8* @malloc(i64 %0)
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ ENOENT;
int /*<<< orphan*/ errno;
int unlink(const char *name) {
  errno = ENOENT;
  return -1;
}


x86 assembly (clang, -O0):
<unlink>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ec1(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec8(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unlink>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
@ENOENT = global i32 0
@errno = global i32 0
define i32 @unlink(i8* nocapture readnone %0) {
%2 = load i32, i32* @ENOENT
store i32 %2, i32* @errno
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int LITTLE_ENDIAN;
int /*<<< orphan*/ ntohl(int /*<<< orphan*/);
uint32_t endian_to_host_32(int endian, uint32_t val) {
  if (endian != LITTLE_ENDIAN)
    return ntohl(val);
  return val;
}


x86 assembly (clang, -O0):
<endian_to_host_32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2ec0(%rip),%rcx
cmp    (%rcx),%eax
je     1140 <endian_to_host_32+0x30>
mov    -0xc(%rbp),%edi
call   1030 <ntohl@plt>
mov    %eax,-0x4(%rbp)
jmp    1146 <endian_to_host_32+0x36>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<endian_to_host_32>:
mov    0x2ed1(%rip),%rax
cmp    %edi,(%rax)
jne    111e <endian_to_host_32+0xe>
mov    %esi,%eax
ret
mov    %esi,%edi
jmp    1030 <ntohl@plt>

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

LLVM IR (-O2):
@LITTLE_ENDIAN = global i32 0
define i32 @endian_to_host_32(i32 %0, i32 %1) {
%3 = load i32, i32* @LITTLE_ENDIAN
%4 = icmp eq i32 %3, %0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @ntohl(i32 %1)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ %6, %5 ], [ %1, %2 ]
ret i32 %8
}
/* Variables and functions */
void *def_disabled_make() { return NULL; }


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

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

LLVM IR (-O0):
define i8* @def_disabled_make() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @def_disabled_make() {
ret i8* null
}
/* Variables and functions */
int fabs(double);
double fx(double x) { return (10 * fabs(x)); }


x86 assembly (clang, -O0):
<fx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
imul   $0xa,%eax,%eax
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fx>:
push   %rax
call   1030 <fabs@plt>
add    %eax,%eax
lea    (%rax,%rax,4),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @fx(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @fabs(double %3)
%5 = mul nsw i32 10, %4
%6 = sitofp i32 %5 to double
ret double %6
}

LLVM IR (-O2):
define double @fx(double %0) {
%2 = tail call i32 @fabs(double %0)
%3 = mul nsw i32 %2, 10
%4 = sitofp i32 %3 to double
ret double %4
}
void RTThreadGetReallySleeping(void) {}


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

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

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

LLVM IR (-O2):
define void @RTThreadGetReallySleeping() {
ret void
}
/* Variables and functions */
int strlen(char *);
void removeStringTrailingNewline(char *str) {
  if (str == NULL)
    return;
  int length = strlen(str);
  if (str[length - 1] == '\n')
    str[length - 1] = '\0';
}


x86 assembly (clang, -O0):
<removeStringTrailingNewline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <removeStringTrailingNewline+0x1c>
jmp    1163 <removeStringTrailingNewline+0x53>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    1163 <removeStringTrailingNewline+0x53>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<removeStringTrailingNewline>:
push   %rbx
test   %rdi,%rdi
je     112c <removeStringTrailingNewline+0x1c>
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    112c <removeStringTrailingNewline+0x1c>
movb   $0x0,-0x1(%rbx,%rax,1)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @removeStringTrailingNewline(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = add nsw i32 %4, -1
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 10
br i1 %9, label %10, label %11
10: ; preds = %3
store i8 0, i8* %7
br label %11
11: ; preds = %3, %10, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug(int, char *, unsigned int);
int /*<<< orphan*/ sscanf(char *, char *, unsigned int *);
int confSaveUnsigned(char *value, short handling, void *result) {
  unsigned *dest = (unsigned *)result;
  sscanf(value, "%u", dest);
  debug(3, "set unsigned: %u", *dest);
  return 0;
}


x86 assembly (clang, -O0):
<confSaveUnsigned>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1040 <sscanf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
mov    $0x3,%edi
lea    0xe9b(%rip),%rsi
call   1030 <debug@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<confSaveUnsigned>:
push   %rbx
mov    %rdx,%rbx
lea    0xee3(%rip),%rsi
call   1040 <sscanf@plt>
mov    (%rbx),%edx
lea    0xec7(%rip),%rsi
mov    $0x3,%edi
call   1030 <debug@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%u\00"
@.str.1 = [17 x i8] c"set unsigned: %u\00"
define i32 @confSaveUnsigned(i8* %0, i16 signext %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i16
%6 = alloca i8*
%7 = alloca i32*
store i8* %0, i8** %4
store i16 %1, i16* %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = bitcast i8* %8 to i32*
store i32* %9, i32** %7
%10 = load i8*, i8** %4
%11 = load i32*, i32** %7
%12 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %11)
%13 = load i32*, i32** %7
%14 = load i32, i32* %13
%15 = call i32 @debug(i32 3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%u\00"
@.str.1 = [17 x i8] c"set unsigned: %u\00"
define i32 @confSaveUnsigned(i8* nocapture %0, i16 signext %1, i8* %2) {
%4 = bitcast i8* %2 to i32*
%5 = tail call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%6 = load i32, i32* %4
%7 = tail call i32 @debug(i32 3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}
void do_not_optimize(int b) { do_not_optimize(0); }


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

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

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

LLVM IR (-O2):
define void @do_not_optimize(i32 %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ game_exit_cleanup();
int /*<<< orphan*/ printf(char *);
void signal_handler(int signal) {
  game_exit_cleanup();
  printf(
      "\nPankkiiri nousee, sammuttaa valot huoneesta ja poistuu paikalta.\n");
  exit(signal);
}


x86 assembly (clang, -O0):
<signal_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <game_exit_cleanup@plt>
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<signal_handler>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <game_exit_cleanup@plt>
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [67 x i8] c"\0APankkiiri nousee, sammuttaa valot huoneesta ja poistuu paikalta.\0A\00"
define void @signal_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @game_exit_cleanup()
%4 = call i32 @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@str = [66 x i8] c"\0APankkiiri nousee, sammuttaa valot huoneesta ja poistuu paikalta.\00"
define void @signal_handler(i32 %0) {
%2 = tail call i32 (...) @game_exit_cleanup()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 %0)
unreachable
}
int main(void) {
  if (foo(__FUNCTION__))
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1040 <foo@plt>
cmp    $0x0,%eax
je     114b <main+0x2b>
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1040 <foo@plt>
test   %eax,%eax
jne    1137 <main+0x17>
xor    %eax,%eax
pop    %rcx
ret
call   1030 <abort@plt>

LLVM IR (-O0):
@__FUNCTION__.main = [5 x i8] c"main\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, ...) bitcast (i32 (...)* @foo to i32 (i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__FUNCTION__.main, i64 0, i64 0))
%3 = icmp ne i32 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
unreachable
5: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
@__FUNCTION__.main = [5 x i8] c"main\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) bitcast (i32 (...)* @foo to i32 (i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__FUNCTION__.main, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
br i1 %2, label %4, label %3
3: ; preds = %0
tail call void @abort()
unreachable
4: ; preds = %0
ret i32 0
}
unsigned xrop3_55_1_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = D | T;
  stk1 = S & stk2;
  stk1 = ~stk1;
  return (stk1 & (~S) & (~T)) | (D & S) | (D & T);
}


x86 assembly (clang, -O0):
<xrop3_55_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x10(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0x10(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_55_1_1>:
mov    %edi,%ecx
shl    $0x8,%ecx
or     %edi,%ecx
mov    %esi,%eax
shl    $0x8,%eax
or     %esi,%eax
or     %ecx,%eax
not    %eax
or     %edi,%esi
or     %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @xrop3_55_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = or i32 %6, %4
%8 = xor i32 %7, -1
%9 = or i8 %1, %0
%10 = zext i8 %9 to i32
%11 = or i32 %10, %8
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fwrite(double *, size_t, size_t, int /*<<< orphan*/ *);
int c_fwrite_double_(double *f, int *nf, FILE **fp) {
  return fwrite(f, (size_t)sizeof(double), (size_t)*nf, *fp);
}


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

x86 assembly (clang, -O2):
<c_fwrite_double_>:
movslq (%rsi),%rax
mov    (%rdx),%rcx
mov    $0x8,%esi
mov    %rax,%rdx
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
define i32 @c_fwrite_double_(double* %0, i32* %1, i32** %2) {
%4 = alloca double*
%5 = alloca i32*
%6 = alloca i32**
store double* %0, double** %4
store i32* %1, i32** %5
store i32** %2, i32*** %6
%7 = load double*, double** %4
%8 = load i32*, i32** %5
%9 = load i32, i32* %8
%10 = sext i32 %9 to i64
%11 = load i32**, i32*** %6
%12 = load i32*, i32** %11
%13 = call i32 @fwrite(double* %7, i64 8, i64 %10, i32* %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @c_fwrite_double_(double* nocapture %0, i32* nocapture %1, i32** nocapture %2) {
%4 = load i32, i32* %1
%5 = sext i32 %4 to i64
%6 = load i32*, i32** %2
%7 = tail call i32 @fwrite(double* %0, i64 8, i64 %5, i32* %6)
ret i32 %7
}
/* Variables and functions */
unsigned char low_nibble_to_char(unsigned char);
unsigned char high_nibble_to_char(unsigned char input) {
  return low_nibble_to_char(input >> 4);
}


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

x86 assembly (clang, -O2):
<high_nibble_to_char>:
shr    $0x4,%dil
movzbl %dil,%edi
jmp    1030 <low_nibble_to_char@plt>

LLVM IR (-O0):
define zeroext i8 @high_nibble_to_char(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = ashr i32 %4, 4
%6 = trunc i32 %5 to i8
%7 = call zeroext i8 @low_nibble_to_char(i8 zeroext %6)
ret i8 %7
}

LLVM IR (-O2):
define zeroext i8 @high_nibble_to_char(i8 zeroext %0) {
%2 = lshr i8 %0, 4
%3 = tail call zeroext i8 @low_nibble_to_char(i8 zeroext %2)
ret i8 %3
}
/* Variables and functions */
unsigned long parity(unsigned long);
unsigned long hamming(unsigned long in) {
  in &= (1UL << 12) - 1;
  in <<= 3;
  in |= parity(in & 0xcccccccc) << 2;
  in |= parity(in & 0xaaaaaaaa) << 1;
  in |= parity(in);
  return in;
}


x86 assembly (clang, -O0):
<hamming>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xfff,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %rax,-0x8(%rbp)
movabs $0xcccccccc,%rdi
and    -0x8(%rbp),%rdi
call   1030 <parity@plt>
shl    $0x2,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
movabs $0xaaaaaaaa,%rdi
and    -0x8(%rbp),%rdi
call   1030 <parity@plt>
shl    $0x1,%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <parity@plt>
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hamming>:
push   %r14
push   %rbx
push   %rax
shl    $0x3,%rdi
mov    %edi,%ebx
and    $0x7ff8,%ebx
and    $0x4cc8,%edi
call   1030 <parity@plt>
mov    %rax,%r14
shl    $0x2,%r14
or     %rbx,%r14
mov    %r14d,%edi
and    $0xaaaaaaa8,%edi
call   1030 <parity@plt>
mov    %rax,%rbx
add    %rax,%rbx
or     %r14,%rbx
mov    %rbx,%rdi
call   1030 <parity@plt>
or     %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @hamming(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 4095
store i64 %4, i64* %2
%5 = load i64, i64* %2
%6 = shl i64 %5, 3
store i64 %6, i64* %2
%7 = load i64, i64* %2
%8 = and i64 %7, 3435973836
%9 = call i64 @parity(i64 %8)
%10 = shl i64 %9, 2
%11 = load i64, i64* %2
%12 = or i64 %11, %10
store i64 %12, i64* %2
%13 = load i64, i64* %2
%14 = and i64 %13, 2863311530
%15 = call i64 @parity(i64 %14)
%16 = shl i64 %15, 1
%17 = load i64, i64* %2
%18 = or i64 %17, %16
store i64 %18, i64* %2
%19 = load i64, i64* %2
%20 = call i64 @parity(i64 %19)
%21 = load i64, i64* %2
%22 = or i64 %21, %20
store i64 %22, i64* %2
%23 = load i64, i64* %2
ret i64 %23
}

LLVM IR (-O2):
define i64 @hamming(i64 %0) {
%2 = shl i64 %0, 3
%3 = and i64 %2, 32760
%4 = and i64 %2, 19656
%5 = tail call i64 @parity(i64 %4)
%6 = shl i64 %5, 2
%7 = or i64 %6, %3
%8 = and i64 %7, 2863311528
%9 = tail call i64 @parity(i64 %8)
%10 = shl i64 %9, 1
%11 = or i64 %7, %10
%12 = tail call i64 @parity(i64 %11)
%13 = or i64 %11, %12
ret i64 %13
}
/* Type definitions */
typedef int __u8;
typedef int __u16;

/* Variables and functions */
__u8 pn_dev(__u16 handle) { return handle >> 8; }


x86 assembly (clang, -O0):
<pn_dev>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pn_dev>:
mov    %edi,%eax
sar    $0x8,%eax
ret

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

LLVM IR (-O2):
define i32 @pn_dev(i32 %0) {
%2 = ashr i32 %0, 8
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ listRelease(void *);
void dictListDestructor(void *privdata, void *val) {
  ((void)privdata);
  listRelease(val);
}


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

x86 assembly (clang, -O2):
<dictListDestructor>:
mov    %rsi,%rdi
jmp    1030 <listRelease@plt>

LLVM IR (-O0):
define void @dictListDestructor(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 @listRelease(i8* %6)
ret void
}

LLVM IR (-O2):
define void @dictListDestructor(i8* nocapture readnone %0, i8* %1) {
%3 = tail call i32 @listRelease(i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void trap() {
  endwin();
  exit(0);
}


x86 assembly (clang, -O0):
<trap>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <endwin@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<trap>:
push   %rax
xor    %eax,%eax
call   1030 <endwin@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @trap() {
%1 = call i32 (...) @endwin()
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @trap() {
%1 = tail call i32 (...) @endwin()
%2 = tail call i32 @exit(i32 0)
unreachable
}
void g_convert_with_iconv() {}


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

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

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

LLVM IR (-O2):
define void @g_convert_with_iconv() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("\nHello World\n\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"\0AHello World\0A\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [14 x i8] c"\0AHello World\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void INT_Excep_PERIA_INTA250(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_PERIA_INTA250() {
ret void
}
void __attribute__((__section__("mlocked_text")))
stress_usr1_handler(int signum) {
  (void)signum;
}


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

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

LLVM IR (-O0):
define void @stress_usr1_handler(i32 %0) section "mlocked_text" {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
ret void
}

LLVM IR (-O2):
define void @stress_usr1_handler(i32 %0) section "mlocked_text" {
ret void
}
/* Variables and functions */
int write_value_to_fcd(int, unsigned char, int /*<<< orphan*/ *);
int fcdppSetIFGain(unsigned char value) {
  return write_value_to_fcd(117, value, NULL);
}


x86 assembly (clang, -O0):
<fcdppSetIFGain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x75,%edi
xor    %eax,%eax
mov    %eax,%edx
movzbl -0x1(%rbp),%esi
call   1030 <write_value_to_fcd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fcdppSetIFGain>:
mov    %edi,%esi
mov    $0x75,%edi
xor    %edx,%edx
jmp    1030 <write_value_to_fcd@plt>

LLVM IR (-O0):
define i32 @fcdppSetIFGain(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @write_value_to_fcd(i32 117, i8 zeroext %3, i32* null)
ret i32 %4
}

LLVM IR (-O2):
define i32 @fcdppSetIFGain(i8 zeroext %0) {
%2 = tail call i32 @write_value_to_fcd(i32 117, i8 zeroext %0, i32* null)
ret i32 %2
}
/* Variables and functions */
_Bool get_data_bool();
int /*<<< orphan*/ iface_set_option_state(char const *, _Bool);
int /*<<< orphan*/ options_set_bool(char const *, _Bool);
int /*<<< orphan*/ send_int_to_srv(int);
int /*<<< orphan*/ send_str_to_srv(char const *);
void sync_bool_option(const char *name) {
  _Bool value;
  send_int_to_srv(0x08);
  send_str_to_srv(name);
  value = get_data_bool();
  options_set_bool(name, value);
  iface_set_option_state(name, value);
}


x86 assembly (clang, -O0):
<sync_bool_option>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x8,%edi
call   1040 <send_int_to_srv@plt>
mov    -0x8(%rbp),%rdi
call   1050 <send_str_to_srv@plt>
mov    $0x0,%al
call   1070 <get_data_bool@plt>
and    $0x1,%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%esi
call   1030 <options_set_bool@plt>
mov    -0x8(%rbp),%rdi
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%esi
call   1060 <iface_set_option_state@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sync_bool_option>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x8,%edi
call   1040 <send_int_to_srv@plt>
mov    %rbx,%rdi
call   1050 <send_str_to_srv@plt>
xor    %eax,%eax
call   1070 <get_data_bool@plt>
movzbl %al,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <options_set_bool@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <iface_set_option_state@plt>

LLVM IR (-O0):
define void @sync_bool_option(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
%4 = call i32 @send_int_to_srv(i32 8)
%5 = load i8*, i8** %2
%6 = call i32 @send_str_to_srv(i8* %5)
%7 = call zeroext i1 (...) @get_data_bool()
%8 = zext i1 %7 to i8
store i8 %8, i8* %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %3
%11 = trunc i8 %10 to i1
%12 = call i32 @options_set_bool(i8* %9, i1 zeroext %11)
%13 = load i8*, i8** %2
%14 = load i8, i8* %3
%15 = trunc i8 %14 to i1
%16 = call i32 @iface_set_option_state(i8* %13, i1 zeroext %15)
ret void
}

LLVM IR (-O2):
define void @sync_bool_option(i8* %0) {
%2 = tail call i32 @send_int_to_srv(i32 8)
%3 = tail call i32 @send_str_to_srv(i8* %0)
%4 = tail call zeroext i1 (...) @get_data_bool()
%5 = tail call i32 @options_set_bool(i8* %0, i1 zeroext %4)
%6 = tail call i32 @iface_set_option_state(i8* %0, i1 zeroext %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
int main() {
  system("say Hello World Chris");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [22 x i8] c"say Hello World Chris\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"say Hello World Chris\00"
define i32 @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret i32 0
}