xunge/DecIR huggingface dataset:
unsigned char Get7Bits(unsigned char *input, int startBit) {
  register unsigned int word;
  word = (unsigned)input[startBit / 8] << 8;
  word |= (unsigned)input[startBit / 8 + 1];
  word >>= 15 - (startBit % 8 + 7);
  return word & 0xFE;
}


x86 assembly (clang, -O0):
<Get7Bits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
shl    $0x8,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
add    $0x1,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
add    $0x7,%edx
mov    $0xf,%ecx
sub    %edx,%ecx
mov    -0x10(%rbp),%eax
shr    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    $0xfe,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Get7Bits>:
lea    0x7(%rsi),%ecx
test   %esi,%esi
cmovns %esi,%ecx
mov    %ecx,%eax
sar    $0x3,%eax
cltq
movzwl (%rdi,%rax,1),%eax
shl    $0x10,%eax
bswap  %eax
and    $0xfffffff8,%ecx
sub    %ecx,%esi
mov    $0x8,%cl
sub    %sil,%cl
shr    %cl,%eax
and    $0xfe,%al
ret

LLVM IR (-O0):
define zeroext i8 @Get7Bits(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = sdiv i32 %7, 8
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %6, i64 %9
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
store i32 %13, i32* %5
%14 = load i8*, i8** %3
%15 = load i32, i32* %4
%16 = sdiv i32 %15, 8
%17 = add nsw i32 %16, 1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %14, i64 %18
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = load i32, i32* %5
%23 = or i32 %22, %21
store i32 %23, i32* %5
%24 = load i32, i32* %4
%25 = srem i32 %24, 8
%26 = add nsw i32 %25, 7
%27 = sub nsw i32 15, %26
%28 = load i32, i32* %5
%29 = lshr i32 %28, %27
store i32 %29, i32* %5
%30 = load i32, i32* %5
%31 = and i32 %30, 254
%32 = trunc i32 %31 to i8
ret i8 %32
}

LLVM IR (-O2):
define zeroext i8 @Get7Bits(i8* nocapture %0, i32 %1) {
%3 = sdiv i32 %1, 8
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 8
%9 = add nsw i32 %3, 1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = or i32 %8, %13
%15 = srem i32 %1, 8
%16 = sub nsw i32 8, %15
%17 = lshr i32 %14, %16
%18 = trunc i32 %17 to i8
%19 = and i8 %18, -2
ret i8 %19
}
void __ccaprice_atomic_spin(void) {
  __asm__ __volatile__("pause" ::: "memory");
}


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

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

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

LLVM IR (-O2):
define void @__ccaprice_atomic_spin() {
tail call void asm sideeffect "pause", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ addch(int);
void console_write_char(int ch) { addch(ch); }


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

x86 assembly (clang, -O2):
<console_write_char>:
jmp    1030 <addch@plt>

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

LLVM IR (-O2):
define void @console_write_char(i32 %0) {
%2 = tail call i32 @addch(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ testAdd();
int /*<<< orphan*/ testLoad();
int /*<<< orphan*/ testStore();
void testAtomic() {
  testStore();
  testLoad();
  testAdd();
}


x86 assembly (clang, -O0):
<testAtomic>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <testStore@plt>
mov    $0x0,%al
call   1030 <testLoad@plt>
mov    $0x0,%al
call   1040 <testAdd@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testAtomic>:
push   %rax
xor    %eax,%eax
call   1050 <testStore@plt>
xor    %eax,%eax
call   1030 <testLoad@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <testAdd@plt>

LLVM IR (-O0):
define void @testAtomic() {
%1 = call i32 (...) @testStore()
%2 = call i32 (...) @testLoad()
%3 = call i32 (...) @testAdd()
ret void
}

LLVM IR (-O2):
define void @testAtomic() {
%1 = tail call i32 (...) @testStore()
%2 = tail call i32 (...) @testLoad()
%3 = tail call i32 (...) @testAdd()
ret void
}
char *Strchr(char *s, char c) {
  while (*s) {
    if (*s++ == c)
      return s;
  }
  return (char *)0;
}


x86 assembly (clang, -O0):
<Strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     114b <Strchr+0x4b>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    1146 <Strchr+0x46>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <Strchr+0x53>
jmp    110e <Strchr+0xe>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Strchr>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rax),%ecx
test   %cl,%cl
je     1121 <Strchr+0x21>
add    $0x1,%rax
cmp    %sil,%cl
jne    1110 <Strchr+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @Strchr(i8* %0, i8 signext %1) {
br label %3
3: ; preds = %7, %2
%4 = phi i8* [ %0, %2 ], [ %8, %7 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %4, i64 1
%9 = icmp eq i8 %5, %1
br i1 %9, label %10, label %3
10: ; preds = %3, %7
%11 = phi i8* [ %8, %7 ], [ null, %3 ]
ret i8* %11
}
/* Variables and functions */
int last_slash(char const *, int *, int *);
char *basename(const char *path) {
  int len, found = 0, slash_index = 0;
  slash_index = last_slash(path, &found, &len);
  return found ? (char *)path + slash_index + 1 : (char *)path;
}


x86 assembly (clang, -O0):
<basename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1030 <last_slash@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1160 <basename+0x50>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1168 <basename+0x58>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basename>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movl   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1030 <last_slash@plt>
cmpl   $0x0,0x8(%rsp)
cltq
lea    0x1(%rbx,%rax,1),%rax
cmove  %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @basename(i8* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = call i32 @last_slash(i8* %0, i32* %3, i32* %2)
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
%9 = sext i32 %6 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = select i1 %8, i8* %0, i8* %11
ret i8* %12
}
long zig_zag_unfixl(unsigned long inp) {
  return ((long)(((inp)&1) ? (~((inp) >> 1)) : ((inp) >> 1)));
}


x86 assembly (clang, -O0):
<zig_zag_unfixl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     112f <zig_zag_unfixl+0x2f>
mov    -0x8(%rbp),%rax
shr    $0x1,%rax
xor    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    113b <zig_zag_unfixl+0x3b>
mov    -0x8(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<zig_zag_unfixl>:
mov    %rdi,%rax
shr    %rax
and    $0x1,%edi
neg    %rdi
xor    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @zig_zag_unfixl(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 1
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i64, i64* %2
%8 = lshr i64 %7, 1
%9 = xor i64 %8, -1
br label %13
10: ; preds = %1
%11 = load i64, i64* %2
%12 = lshr i64 %11, 1
br label %13
13: ; preds = %10, %6
%14 = phi i64 [ %9, %6 ], [ %12, %10 ]
ret i64 %14
}

LLVM IR (-O2):
define i64 @zig_zag_unfixl(i64 %0) {
%2 = lshr i64 %0, 1
%3 = and i64 %0, 1
%4 = sub nsw i64 0, %3
%5 = xor i64 %2, %4
ret i64 %5
}
__attribute__((format_arg(1))) const char *_(const char *msgid) {
  return 0 ? "# GETTEXT POISON #" : msgid;
}


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

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

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

LLVM IR (-O2):
define i8* @_(i8* readnone returned %0) {
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
void json_version() {
  printf("{\n\t\"version\": \"%s\"\n}\n", "2.13");
  exit(0);
}


x86 assembly (clang, -O0):
<json_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xee4(%rip),%rsi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<json_version>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xee7(%rip),%rsi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"{\0A\09\22version\22: \22%s\22\0A}\0A\00"
@.str.1 = [5 x i8] c"2.13\00"
define void @json_version() {
%1 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [22 x i8] c"{\0A\09\22version\22: \22%s\22\0A}\0A\00"
@.str.1 = [5 x i8] c"2.13\00"
define void @json_version() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int findDuplicate(int *, int);
int /*<<< orphan*/ printf(char *, int, int *);
int main() {
  int a[] = {1, 2, 3, 5, 6, 6, 7, 8, 4};
  int n = findDuplicate(a, 9);
  printf("Duplicate number found : %d on %p \n", n, a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x24,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
call   1050 <findDuplicate@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%esi
lea    -0x30(%rbp),%rdx
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xef5(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xeda(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebe(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x9,%esi
call   1040 <findDuplicate@plt>
lea    0xec7(%rip),%rdi
mov    %eax,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [9 x i32] [i32 1, i32 2, i32 3, i32 5, i32 6, i32 6, i32 7, i32 8, i32 4]
@.str = [36 x i8] c"Duplicate number found : %d on %p \0A\00"
define i32 @main() {
%1 = alloca [9 x i32]
%2 = alloca i32
%3 = bitcast [9 x i32]* %1 to i8*
%4 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%5 = call i32 @findDuplicate(i32* %4, i32 9)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %6, i32* %7)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [9 x i32] [i32 1, i32 2, i32 3, i32 5, i32 6, i32 6, i32 7, i32 8, i32 4]
@.str = [36 x i8] c"Duplicate number found : %d on %p \0A\00"
define i32 @main() {
%1 = alloca [9 x i32]
%2 = bitcast [9 x i32]* %1 to i8*
%3 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%4 = call i32 @findDuplicate(i32* %3, i32 9)
%5 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %4, i32* %3)
ret i32 0
}
void redBlackTree() {}


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

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

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

LLVM IR (-O2):
define void @redBlackTree() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int /*<<< orphan*/ strncpy(char *, int /*<<< orphan*/, int);
const char *osDirLastError(char *buf, int max_size) {
  strncpy(buf, strerror(errno), max_size);
  return buf;
}


x86 assembly (clang, -O0):
<osDirLastError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<osDirLastError>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %ebp,%edx
call   1030 <strncpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i32 0
define i8* @osDirLastError(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* @errno
%7 = call i32 @strerror(i32 %6)
%8 = load i32, i32* %4
%9 = call i32 @strncpy(i8* %5, i32 %7, i32 %8)
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
@errno = global i32 0
define i8* @osDirLastError(i8* returned %0, i32 %1) {
%3 = load i32, i32* @errno
%4 = tail call i32 @strerror(i32 %3)
%5 = tail call i32 @strncpy(i8* %0, i32 %4, i32 %1)
ret i8* %0
}
void OnKeyPress(unsigned char key, int x, int y) {}


x86 assembly (clang, -O0):
<OnKeyPress>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @OnKeyPress(i8 zeroext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret void
}

LLVM IR (-O2):
define void @OnKeyPress(i8 zeroext %0, i32 %1, i32 %2) {
ret void
}
/* Variables and functions */
char *addBinary(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, const char *argv[]) {
  printf("Hello, World!\n");
  char *a = "11";
  char *b = "1";
  char *res = addBinary(a, b);
  printf("二进制的相加结果:%s\n", res);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0xeb6(%rip),%rsi
call   1050 <addBinary@plt>
lea    0xeac(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Hello, World!\0A\00"
@.str.1 = [3 x i8] c"11\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [29 x i8] c"\E4\BA\8C\E8\BF\9B\E5\88\B6\E7\9A\84\E7\9B\B8\E5\8A\A0\E7\BB\93\E6\9E\9C:%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %6
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %7
%10 = load i8*, i8** %6
%11 = load i8*, i8** %7
%12 = call i8* @addBinary(i8* %10, i8* %11)
store i8* %12, i8** %8
%13 = load i8*, i8** %8
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* %13)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"11\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [29 x i8] c"\E4\BA\8C\E8\BF\9B\E5\88\B6\E7\9A\84\E7\9B\B8\E5\8A\A0\E7\BB\93\E6\9E\9C:%s\0A\00"
@str = [14 x i8] c"Hello, World!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%4 = tail call i8* @addBinary(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* %4)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ attr_t;

/* Variables and functions */
int /*<<< orphan*/ COLOR_PAIR(int /*<<< orphan*/);
int /*<<< orphan*/ CSLP_GetPair(int, int);
attr_t CSLP_GetPairAttr(int txt, int bg) {
  return (COLOR_PAIR(CSLP_GetPair(txt, bg)));
}


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

x86 assembly (clang, -O2):
<CSLP_GetPairAttr>:
push   %rax
call   1040 <CSLP_GetPair@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <COLOR_PAIR@plt>

LLVM IR (-O0):
define i32 @CSLP_GetPairAttr(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 @CSLP_GetPair(i32 %5, i32 %6)
%8 = call i32 @COLOR_PAIR(i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @CSLP_GetPairAttr(i32 %0, i32 %1) {
%3 = tail call i32 @CSLP_GetPair(i32 %0, i32 %1)
%4 = tail call i32 @COLOR_PAIR(i32 %3)
ret i32 %4
}
/* Variables and functions */
float expf(float);
float tanhf(float x) {
  float x0 = expf(x);
  float x1 = 1.0 / x0;
  return ((x0 + x1) / (x0 - x1));
}


x86 assembly (clang, -O0):
<tanhf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <expf@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xec3(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
subss  -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tanhf>:
push   %rax
call   1030 <expf@plt>
movss  0xee2(%rip),%xmm2
divss  %xmm0,%xmm2
movaps %xmm0,%xmm1
addss  %xmm2,%xmm1
subss  %xmm2,%xmm0
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @tanhf(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %2
%5 = load float, float* %2
%6 = call float @expf(float %5)
store float %6, float* %3
%7 = load float, float* %3
%8 = fpext float %7 to double
%9 = fdiv double 1.000000e+00, %8
%10 = fptrunc double %9 to float
store float %10, float* %4
%11 = load float, float* %3
%12 = load float, float* %4
%13 = fadd float %11, %12
%14 = load float, float* %3
%15 = load float, float* %4
%16 = fsub float %14, %15
%17 = fdiv float %13, %16
ret float %17
}

LLVM IR (-O2):
define float @tanhf(float %0) {
%2 = tail call float @expf(float %0)
%3 = fdiv float 1.000000e+00, %2
%4 = fadd float %2, %3
%5 = fsub float %2, %3
%6 = fdiv float %4, %5
ret float %6
}
/* Variables and functions */
int /*<<< orphan*/ addbyte(int);
void NEG_HOST_REG_L(int reg) {
  addbyte(0xf7);
  addbyte(0xd8 | reg);
}


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

x86 assembly (clang, -O2):
<NEG_HOST_REG_L>:
push   %rbx
mov    %edi,%ebx
mov    $0xf7,%edi
call   1030 <addbyte@plt>
or     $0xd8,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <addbyte@plt>

LLVM IR (-O0):
define void @NEG_HOST_REG_L(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @addbyte(i32 247)
%4 = load i32, i32* %2
%5 = or i32 216, %4
%6 = call i32 @addbyte(i32 %5)
ret void
}

LLVM IR (-O2):
define void @NEG_HOST_REG_L(i32 %0) {
%2 = tail call i32 @addbyte(i32 247)
%3 = or i32 %0, 216
%4 = tail call i32 @addbyte(i32 %3)
ret void
}
void mmc_pwrseq_pre_power_on(struct mmc_host *host) {}


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

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

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

LLVM IR (-O2):
%struct.mmc_host = type opaque
define void @mmc_pwrseq_pre_power_on(%struct.mmc_host* nocapture %0) {
ret void
}
/* Variables and functions */
scalar_t__ ntohl(unsigned int);
unsigned int git_ntohl(unsigned int x) { return (unsigned int)ntohl(x); }


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

x86 assembly (clang, -O2):
<git_ntohl>:
jmp    1030 <ntohl@plt>

LLVM IR (-O0):
define i32 @git_ntohl(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @ntohl(i32 %3)
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @git_ntohl(i32 %0) {
%2 = tail call i64 @ntohl(i32 %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
void __TR_clear_cache(beg, end) char *beg, *end;
{}


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

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

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

LLVM IR (-O2):
define void @__TR_clear_cache(i8* nocapture %0, i8* nocapture %1) {
ret void
}
int int_fetch_and_acquire(int *ptr, int value) {
  return __atomic_fetch_and(ptr, value, 2);
}


x86 assembly (clang, -O0):
<int_fetch_and_acquire>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%ecx
mov    %ecx,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    %ecx,-0x1c(%rbp)
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x28(%rbp),%rcx
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
and    %esi,%edx
lock cmpxchg %edx,(%rcx)
sete   %cl
mov    %eax,-0x2c(%rbp)
test   $0x1,%cl
mov    %eax,-0x18(%rbp)
jne    114d <int_fetch_and_acquire+0x4d>
jmp    1124 <int_fetch_and_acquire+0x24>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_fetch_and_acquire>:
mov    (%rdi),%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%ecx
and    %esi,%ecx
lock cmpxchg %ecx,(%rdi)
jne    1110 <int_fetch_and_acquire+0x10>
ret

LLVM IR (-O0):
define i32 @int_fetch_and_acquire(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = load i32*, i32** %3
%8 = load i32, i32* %4
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = atomicrmw and i32* %7, i32 %9 acquire
store i32 %10, i32* %6
%11 = load i32, i32* %6
ret i32 %11
}

LLVM IR (-O2):
define i32 @int_fetch_and_acquire(i32* nocapture %0, i32 %1) {
%3 = atomicrmw and i32* %0, i32 %1 acquire
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void print_call_with_return_value(const char *symbol_name) {
  printf("    return cutest_mock.%s.func(", symbol_name);
}


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

x86 assembly (clang, -O2):
<print_call_with_return_value>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [32 x i8] c" return cutest_mock.%s.func(\00"
define void @print_call_with_return_value(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c" return cutest_mock.%s.func(\00"
define void @print_call_with_return_value(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
void putc(char c) {
  char *tx = (char *)0xff000000;
  *tx = c;
}


x86 assembly (clang, -O0):
<putc>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0xff000000,%eax
mov    %rax,-0x10(%rbp)
mov    -0x1(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<putc>:
mov    $0xff000000,%eax
mov    %dil,(%rax)
ret

LLVM IR (-O0):
define void @putc(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8*
store i8 %0, i8* %2
store i8* inttoptr (i64 4278190080 to i8*), i8** %3
%4 = load i8, i8* %2
%5 = load i8*, i8** %3
store i8 %4, i8* %5
ret void
}

LLVM IR (-O2):
define void @putc(i8 signext %0) {
store i8 %0, i8* inttoptr (i64 4278190080 to i8*)
ret void
}
void foo649(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo649(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int fib_accum(int n, int accum1, int accum2) {
  if (n <= 1) {
    printf("fib accum completed\n");
    return accum2;
  }
  return fib_accum((n - 1), accum2, accum1 + accum2);
}


x86 assembly (clang, -O0):
<fib_accum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     1152 <fib_accum+0x32>
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1169 <fib_accum+0x49>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
add    -0x10(%rbp),%edx
call   1040 <fib_accum@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib_accum>:
push   %rbx
mov    %edx,%ebx
cmp    $0x2,%edi
jl     1130 <fib_accum+0x20>
add    $0x1,%edi
nopl   0x0(%rax,%rax,1)
mov    %ebx,%eax
add    %ebx,%esi
add    $0xffffffff,%edi
mov    %esi,%ebx
mov    %eax,%esi
cmp    $0x3,%edi
jae    1120 <fib_accum+0x10>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"fib accum completed\0A\00"
define i32 @fib_accum(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* %5
%9 = icmp sle i32 %8, 1
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %7
store i32 %12, i32* %4
br label %21
13: ; preds = %3
%14 = load i32, i32* %5
%15 = sub nsw i32 %14, 1
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = add nsw i32 %17, %18
%20 = call i32 @fib_accum(i32 %15, i32 %16, i32 %19)
store i32 %20, i32* %4
br label %21
21: ; preds = %13, %10
%22 = load i32, i32* %4
ret i32 %22
}

LLVM IR (-O2):
@str = [20 x i8] c"fib accum completed\00"
define i32 @fib_accum(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %8
5: ; preds = %8, %3
%6 = phi i32 [ %2, %3 ], [ %13, %8 ]
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret i32 %6
8: ; preds = %3, %8
%9 = phi i32 [ %13, %8 ], [ %2, %3 ]
%10 = phi i32 [ %9, %8 ], [ %1, %3 ]
%11 = phi i32 [ %12, %8 ], [ %0, %3 ]
%12 = add nsw i32 %11, -1
%13 = add nsw i32 %9, %10
%14 = icmp ult i32 %11, 3
br i1 %14, label %5, label %8
}
/* Variables and functions */
int /*<<< orphan*/ strtof(char *, int /*<<< orphan*/ *);
int main(void) {
  strtof("10", NULL);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"10\00"
define i32 @main() {
%1 = tail call i32 @strtof(i8* nocapture getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* null)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
scalar_t__ __get_interrupt_state();
int /*<<< orphan*/ cli();
unsigned int irq_disable(void) {
  uint8_t mask = __get_interrupt_state();
  cli();
  return (unsigned int)mask;
}


x86 assembly (clang, -O0):
<irq_disable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <__get_interrupt_state@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <cli@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irq_disable>:
push   %rbx
xor    %eax,%eax
call   1030 <__get_interrupt_state@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <cli@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @irq_disable() {
%1 = alloca i64
%2 = call i64 (...) @__get_interrupt_state()
store i64 %2, i64* %1
%3 = call i32 (...) @cli()
%4 = load i64, i64* %1
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @irq_disable() {
%1 = tail call i64 (...) @__get_interrupt_state()
%2 = tail call i32 (...) @cli()
%3 = trunc i64 %1 to i32
ret i32 %3
}
/* Variables and functions */
int max(int *, int /*<<< orphan*/, int);
int find_max(int a[], int size) { return max(a, 0, size - 1); }


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

x86 assembly (clang, -O2):
<find_max>:
lea    -0x1(%rsi),%edx
xor    %esi,%esi
jmp    1030 <max@plt>

LLVM IR (-O0):
define i32 @find_max(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 = sub nsw i32 %6, 1
%8 = call i32 @max(i32* %5, i32 0, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @find_max(i32* %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = tail call i32 @max(i32* %0, i32 0, i32 %3)
ret i32 %4
}
unsigned bar(unsigned i) { return (i * 6) & 5; }


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
imul   $0x6,-0x4(%rbp),%eax
and    $0x5,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
add    %edi,%edi
lea    (%rdi,%rdi,2),%eax
and    $0x4,%eax
ret

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

LLVM IR (-O2):
define i32 @bar(i32 %0) {
%2 = mul i32 %0, 6
%3 = and i32 %2, 4
ret i32 %3
}
int fun534() { return 534; }


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

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

LLVM IR (-O0):
define i32 @fun534() {
ret i32 534
}

LLVM IR (-O2):
define i32 @fun534() {
ret i32 534
}
/* Variables and functions */
scalar_t__ isdigit(char);
int isnumber(char *s) {
  while (*s)
    if (isdigit(*s))
      s++;
    else
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<isnumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1161 <isnumber+0x51>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1150 <isnumber+0x40>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    115c <isnumber+0x4c>
movl   $0x0,-0x4(%rbp)
jmp    1168 <isnumber+0x58>
jmp    111c <isnumber+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isnumber>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
mov    $0x1,%ebp
test   %al,%al
je     114c <isnumber+0x3c>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     114a <isnumber+0x3a>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <isnumber+0x20>
jmp    114c <isnumber+0x3c>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @isnumber(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
br label %4
4: ; preds = %17, %1
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %18
8: ; preds = %4
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = call i64 @isdigit(i8 signext %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %3
br label %17
16: ; preds = %8
store i32 0, i32* %2
br label %19
17: ; preds = %13
br label %4
18: ; preds = %4
store i32 1, i32* %2
br label %19
19: ; preds = %18, %16
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @isnumber(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %7
4: ; preds = %7
%5 = load i8, i8* %12
%6 = icmp eq i8 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %12, %4 ], [ %0, %1 ]
%10 = tail call i64 @isdigit(i8 signext %8)
%11 = icmp eq i64 %10, 0
%12 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %11, label %13, label %4
13: ; preds = %7, %4, %1
%14 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %7 ]
ret i32 %14
}
/* Type definitions */
struct crypto_skcipher {
  int dummy;
};

/* Variables and functions */
struct crypto_skcipher *crypto_get_default_null_skcipher();
struct crypto_skcipher *crypto_get_default_null_skcipher2(void) {
  return crypto_get_default_null_skcipher();
}


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

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

LLVM IR (-O0):
%struct.crypto_skcipher = type { i32 }
define %struct.crypto_skcipher* @crypto_get_default_null_skcipher2() {
%1 = call %struct.crypto_skcipher* (...) @crypto_get_default_null_skcipher()
ret %struct.crypto_skcipher* %1
}

LLVM IR (-O2):
%struct.crypto_skcipher = type { i32 }
define %struct.crypto_skcipher* @crypto_get_default_null_skcipher2() {
%1 = tail call %struct.crypto_skcipher* (...) @crypto_get_default_null_skcipher()
ret %struct.crypto_skcipher* %1
}
/* Variables and functions */
int cosf(float);
float sqrtf(float);
float lawofcosines(float b, float c, float alpha) {
  return sqrtf(b * b + c * c - 2 * b * c * cosf(alpha));
}


x86 assembly (clang, -O0):
<lawofcosines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xea0(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <cosf@plt>
movss  -0x14(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
cvtsi2ss %eax,%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1040 <sqrtf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lawofcosines>:
sub    $0x18,%rsp
movss  %xmm1,0x14(%rsp)
movss  %xmm0,0xc(%rsp)
movaps %xmm1,%xmm3
mulss  %xmm1,%xmm3
movaps %xmm0,%xmm1
mulss  %xmm0,%xmm1
addss  %xmm3,%xmm1
movss  %xmm1,0x10(%rsp)
movaps %xmm2,%xmm0
call   1030 <cosf@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  0xc(%rsp),%xmm1
mulss  0xe9b(%rip),%xmm1
mulss  0x14(%rsp),%xmm1
mulss  %xmm0,%xmm1
addss  0x10(%rsp),%xmm1
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm1
movaps %xmm1,%xmm0
jb     1189 <lawofcosines+0x69>
sqrtss %xmm0,%xmm0
add    $0x18,%rsp
ret
add    $0x18,%rsp
jmp    1040 <sqrtf@plt>

LLVM IR (-O0):
define float @lawofcosines(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %4
%9 = load float, float* %5
%10 = load float, float* %5
%11 = fmul float %9, %10
%12 = call float @llvm.fmuladd.f32(float %7, float %8, float %11)
%13 = load float, float* %4
%14 = fmul float 2.000000e+00, %13
%15 = load float, float* %5
%16 = fmul float %14, %15
%17 = load float, float* %6
%18 = call i32 @cosf(float %17)
%19 = sitofp i32 %18 to float
%20 = fneg float %16
%21 = call float @llvm.fmuladd.f32(float %20, float %19, float %12)
%22 = call float @sqrtf(float %21)
ret float %22
}

LLVM IR (-O2):
define float @lawofcosines(float %0, float %1, float %2) {
%4 = fmul float %1, %1
%5 = tail call float @llvm.fmuladd.f32(float %0, float %0, float %4)
%6 = tail call i32 @cosf(float %2)
%7 = sitofp i32 %6 to float
%8 = fmul float %0, -2.000000e+00
%9 = fmul float %8, %1
%10 = tail call float @llvm.fmuladd.f32(float %9, float %7, float %5)
%11 = tail call float @sqrtf(float %10)
ret float %11
}
/* Variables and functions */
int read_8042_cmd_byte();
int /*<<< orphan*/ write_8042_cmd_byte(int);
void disable_mouse(void) {
  write_8042_cmd_byte(read_8042_cmd_byte() | 0b100000);
}


x86 assembly (clang, -O0):
<disable_mouse>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <read_8042_cmd_byte@plt>
mov    %eax,%edi
or     $0x20,%edi
call   1030 <write_8042_cmd_byte@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<disable_mouse>:
push   %rax
xor    %eax,%eax
call   1040 <read_8042_cmd_byte@plt>
or     $0x20,%eax
mov    %eax,%edi
pop    %rax
jmp    1030 <write_8042_cmd_byte@plt>

LLVM IR (-O0):
define void @disable_mouse() {
%1 = call i32 (...) @read_8042_cmd_byte()
%2 = or i32 %1, 32
%3 = call i32 @write_8042_cmd_byte(i32 %2)
ret void
}

LLVM IR (-O2):
define void @disable_mouse() {
%1 = tail call i32 (...) @read_8042_cmd_byte()
%2 = or i32 %1, 32
%3 = tail call i32 @write_8042_cmd_byte(i32 %2)
ret void
}
/* Type definitions */
struct a {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ abort();
void a_impl(struct a *const this) { abort(); }


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

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

LLVM IR (-O0):
%struct.a = type { i32 }
define void @a_impl(%struct.a* %0) {
%2 = alloca %struct.a*
store %struct.a* %0, %struct.a** %2
%3 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
%struct.a = type { i32 }
define void @a_impl(%struct.a* nocapture readnone %0) {
%2 = tail call i32 (...) @abort()
unreachable
}
/* Type definitions */
struct wl_resource {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wl_resource_post_event(struct wl_resource *, int,
                                          struct wl_resource *);
void wl_data_device_send_selection(struct wl_resource *resource_,
                                   struct wl_resource *id) {
  wl_resource_post_event(resource_, 5, id);
}


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

x86 assembly (clang, -O2):
<wl_data_device_send_selection>:
mov    %rsi,%rdx
mov    $0x5,%esi
jmp    1030 <wl_resource_post_event@plt>

LLVM IR (-O0):
%struct.wl_resource = type { i32 }
define void @wl_data_device_send_selection(%struct.wl_resource* %0, %struct.wl_resource* %1) {
%3 = alloca %struct.wl_resource*
%4 = alloca %struct.wl_resource*
store %struct.wl_resource* %0, %struct.wl_resource** %3
store %struct.wl_resource* %1, %struct.wl_resource** %4
%5 = load %struct.wl_resource*, %struct.wl_resource** %3
%6 = load %struct.wl_resource*, %struct.wl_resource** %4
%7 = call i32 @wl_resource_post_event(%struct.wl_resource* %5, i32 5, %struct.wl_resource* %6)
ret void
}

LLVM IR (-O2):
%struct.wl_resource = type { i32 }
define void @wl_data_device_send_selection(%struct.wl_resource* %0, %struct.wl_resource* %1) {
%3 = tail call i32 @wl_resource_post_event(%struct.wl_resource* %0, i32 5, %struct.wl_resource* %1)
ret void
}
int isascii(int c) { return (((unsigned char)(c)) <= 0x7f); }


x86 assembly (clang, -O0):
<isascii>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
movzbl %al,%eax
cmp    $0x7f,%eax
setle  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isascii>:
xor    %eax,%eax
test   $0x80,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @isascii(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = trunc i32 %3 to i8
%5 = zext i8 %4 to i32
%6 = icmp sle i32 %5, 127
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @isascii(i32 %0) {
%2 = lshr i32 %0, 7
%3 = and i32 %2, 1
%4 = xor i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main(void) {
  int a, b, c;
  printf("Enter a three digit number: ");
  scanf("%1d%1d%1d", &a, &b, &c);
  printf("Reversed: %d%d%d\n", c, b, a);
  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   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0x14(%rsp),%ecx
lea    0xec7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Enter a three digit number: \00"
@.str.1 = [10 x i8] c"%1d%1d%1d\00"
@.str.2 = [18 x i8] c"Reversed: %d%d%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Enter a three digit number: \00"
@.str.1 = [10 x i8] c"%1d%1d%1d\00"
@.str.2 = [18 x i8] c"Reversed: %d%d%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = load i32, i32* %1
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %9, i32 %10, i32 %11)
ret i32 0
}
/* Variables and functions */
unsigned long vx86_NBSB_Read(int, unsigned char);
unsigned long sb_Read(unsigned char offset) {
  return vx86_NBSB_Read(2, offset);
}


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

x86 assembly (clang, -O2):
<sb_Read>:
mov    %edi,%esi
mov    $0x2,%edi
jmp    1030 <vx86_NBSB_Read@plt>

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

LLVM IR (-O2):
define i64 @sb_Read(i8 zeroext %0) {
%2 = tail call i64 @vx86_NBSB_Read(i32 2, i8 zeroext %0)
ret i64 %2
}