xunge/DecIR huggingface dataset:
/* Variables and functions */
int getchar();
int /*<<< orphan*/ isspace(int);
int reverseNumber(int numero) {
  int c;
  int flag = 1;
  while ((c = getchar()) != '\n')
    if (!isspace(c))
      flag = 0;
  return flag;
}


x86 assembly (clang, -O0):
<reverseNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xa,%eax
je     1162 <reverseNumber+0x42>
mov    -0x8(%rbp),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
jne    115d <reverseNumber+0x3d>
movl   $0x0,-0xc(%rbp)
jmp    1132 <reverseNumber+0x12>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverseNumber>:
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    $0x1,%ebx
cmp    $0xa,%eax
je     1158 <reverseNumber+0x38>
mov    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
mov    %eax,%edi
call   1030 <isspace@plt>
test   %eax,%eax
cmove  %eax,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%eax
jne    1140 <reverseNumber+0x20>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @reverseNumber(i32 %0) {
%2 = tail call i32 (...) @getchar()
%3 = icmp eq i32 %2, 10
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %10, %4 ], [ %2, %1 ]
%6 = phi i32 [ %9, %4 ], [ 1, %1 ]
%7 = tail call i32 @isspace(i32 %5)
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i32 0, i32 %6
%10 = tail call i32 (...) @getchar()
%11 = icmp eq i32 %10, 10
br i1 %11, label %12, label %4
12: ; preds = %4, %1
%13 = phi i32 [ 1, %1 ], [ %9, %4 ]
ret i32 %13
}
/* Variables and functions */
const char *longopts_arg(const char *option) {
  for (; *option && *option != '='; option++)
    ;
  if (*option == '=')
    return option + 1;
  else
    return NULL;
}


x86 assembly (clang, -O0):
<longopts_arg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     112d <longopts_arg+0x2d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    113d <longopts_arg+0x3d>
jmp    1153 <longopts_arg+0x53>
jmp    1142 <longopts_arg+0x42>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1108 <longopts_arg+0x8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3d,%eax
jne    1174 <longopts_arg+0x74>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    117c <longopts_arg+0x7c>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<longopts_arg>:
add    $0x1,%rdi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl -0x1(%rdi),%ecx
test   %cl,%cl
je     1123 <longopts_arg+0x23>
cmp    $0x3d,%cl
je     1123 <longopts_arg+0x23>
add    $0x1,%rdi
jmp    1110 <longopts_arg+0x10>
xor    %eax,%eax
cmp    $0x3d,%cl
cmove  %rdi,%rax
ret

LLVM IR (-O0):
define i8* @longopts_arg(i8* %0) {
%2 = alloca i8*
%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 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %4
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 61
br label %14
14: ; preds = %9, %4
%15 = phi i1 [ false, %4 ], [ %13, %9 ]
br i1 %15, label %16, label %20
16: ; preds = %14
br label %17
17: ; preds = %16
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %3
br label %4
20: ; preds = %14
%21 = load i8*, i8** %3
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 61
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i64 1
store i8* %27, i8** %2
br label %29
28: ; preds = %20
store i8* null, i8** %2
br label %29
29: ; preds = %28, %25
%30 = load i8*, i8** %2
ret i8* %30
}

LLVM IR (-O2):
define i8* @longopts_arg(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 0, label %7
i8 61, label %7
]
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2, %2
%8 = icmp eq i8 %4, 61
%9 = getelementptr inbounds i8, i8* %3, i64 1
%10 = select i1 %8, i8* %9, i8* null
ret i8* %10
}
void foo(int *x, ...) { *x = 1; }


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

x86 assembly (clang, -O2):
<foo>:
movl   $0x1,(%rdi)
ret

LLVM IR (-O0):
define void @foo(i32* %0, ...) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
store i32 1, i32* %3
ret void
}

LLVM IR (-O2):
define void @foo(i32* nocapture writeonly %0, ...) {
store i32 1, i32* %0
ret void
}
int f(int a, int b, int c) {
  a += (short)b * (short)c;
  if (!a)
    return 10;
  return a;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cwtl
mov    -0x10(%rbp),%ecx
movswl %cx,%ecx
imul   %ecx,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1136 <f+0x36>
movl   $0xa,-0x4(%rbp)
jmp    113c <f+0x3c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movswl %si,%eax
movswl %dx,%ecx
imul   %eax,%ecx
add    %edi,%ecx
mov    $0xa,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @f(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* %6
%9 = trunc i32 %8 to i16
%10 = sext i16 %9 to i32
%11 = load i32, i32* %7
%12 = trunc i32 %11 to i16
%13 = sext i16 %12 to i32
%14 = mul nsw i32 %10, %13
%15 = load i32, i32* %5
%16 = add nsw i32 %15, %14
store i32 %16, i32* %5
%17 = load i32, i32* %5
%18 = icmp ne i32 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %3
store i32 10, i32* %4
br label %22
20: ; preds = %3
%21 = load i32, i32* %5
store i32 %21, i32* %4
br label %22
22: ; preds = %20, %19
%23 = load i32, i32* %4
ret i32 %23
}

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1, i32 %2) {
%4 = shl i32 %1, 16
%5 = ashr exact i32 %4, 16
%6 = shl i32 %2, 16
%7 = ashr exact i32 %6, 16
%8 = mul nsw i32 %7, %5
%9 = add nsw i32 %8, %0
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i32 10, i32 %9
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ DoEncoding();
void AfmSetEncoding(const char *enc) { DoEncoding(); }


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

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

LLVM IR (-O0):
define void @AfmSetEncoding(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @DoEncoding()
ret void
}

LLVM IR (-O2):
define void @AfmSetEncoding(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @DoEncoding()
ret void
}
int pref_encoding(int ascii, int specials, int eightbits) {
  return ((((ascii + eightbits) + 2) / 3) * 4) <
                 (ascii - specials + (specials + eightbits) * 3)
             ? 0x01
             : 0x02;
}


x86 assembly (clang, -O0):
<pref_encoding>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
add    $0x2,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
shl    $0x2,%edx
mov    -0x4(%rbp),%esi
sub    -0x8(%rbp),%esi
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
imul   $0x3,%eax,%eax
add    %eax,%esi
mov    $0x2,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmovl  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pref_encoding>:
lea    (%rdi,%rdx,1),%eax
add    $0x2,%eax
cltq
imul   $0x55555556,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
shl    $0x2,%eax
sub    %esi,%edi
add    %esi,%edx
lea    (%rdx,%rdx,2),%ecx
add    %edi,%ecx
xor    %edx,%edx
cmp    %ecx,%eax
setl   %dl
mov    $0x2,%eax
sub    %edx,%eax
ret

LLVM IR (-O0):
define i32 @pref_encoding(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %6
%9 = add nsw i32 %7, %8
%10 = add nsw i32 %9, 2
%11 = sdiv i32 %10, 3
%12 = mul nsw i32 %11, 4
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = sub nsw i32 %13, %14
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = add nsw i32 %16, %17
%19 = mul nsw i32 %18, 3
%20 = add nsw i32 %15, %19
%21 = icmp slt i32 %12, %20
%22 = zext i1 %21 to i64
%23 = select i1 %21, i32 1, i32 2
ret i32 %23
}

LLVM IR (-O2):
define i32 @pref_encoding(i32 %0, i32 %1, i32 %2) {
%4 = add i32 %0, 2
%5 = add i32 %4, %2
%6 = sdiv i32 %5, 3
%7 = shl nsw i32 %6, 2
%8 = sub i32 %0, %1
%9 = add nsw i32 %2, %1
%10 = mul nsw i32 %9, 3
%11 = add nsw i32 %8, %10
%12 = icmp slt i32 %7, %11
%13 = select i1 %12, i32 1, i32 2
ret i32 %13
}
/* Type definitions */
struct bitmask {
  int dummy;
};

/* Variables and functions */
int _getbit(struct bitmask const *, unsigned int);
int bitmask_isbitset(const struct bitmask *bmp, unsigned int i) {
  return _getbit(bmp, i);
}


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

x86 assembly (clang, -O2):
<bitmask_isbitset>:
jmp    1030 <_getbit@plt>

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

LLVM IR (-O2):
%struct.bitmask = type { i32 }
define i32 @bitmask_isbitset(%struct.bitmask* %0, i32 %1) {
%3 = tail call i32 @_getbit(%struct.bitmask* %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ isxdigit(int);
int is_hex_string(const char *s) {
  while (*s != '\0') {
    if (!isxdigit((int)*s)) {
      return 0;
    }
    s++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_hex_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115e <is_hex_string+0x4e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isxdigit@plt>
cmp    $0x0,%eax
jne    114d <is_hex_string+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    1165 <is_hex_string+0x55>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <is_hex_string+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @is_hex_string(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %7
4: ; preds = %7
%5 = load i8, i8* %13
%6 = icmp eq i8 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %13, %4 ], [ %0, %1 ]
%10 = sext i8 %8 to i32
%11 = tail call i32 @isxdigit(i32 %10)
%12 = icmp eq i32 %11, 0
%13 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %12, label %14, label %4
14: ; preds = %7, %4, %1
%15 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %7 ]
ret i32 %15
}
/* Variables and functions */
bool isNumber(char mychar) {
  return (mychar > '9' || mychar < '0') ? false : true;
}


x86 assembly (clang, -O0):
<isNumber>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x39,%ecx
mov    %al,-0x2(%rbp)
jg     1129 <isNumber+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
setl   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%dl
mov    $0x1,%eax
xor    %ecx,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isNumber>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @isNumber(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sgt i32 %4, 57
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp slt i32 %8, 48
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 0, i32 1
ret i32 %13
}

LLVM IR (-O2):
define i32 @isNumber(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ task_assert_flag(int, int);
void task_assert_exec(int id) { task_assert_flag(id, (1 << 1)); }


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

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

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

LLVM IR (-O2):
define void @task_assert_exec(i32 %0) {
%2 = tail call i32 @task_assert_flag(i32 %0, i32 2)
ret void
}
int add_one(void *user, unsigned a, unsigned b, unsigned c) {
  unsigned *ptr = user;
  ++*ptr;
  return 0;
}


x86 assembly (clang, -O0):
<add_one>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_one>:
addl   $0x1,(%rdi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @add_one(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to i32*
store i32* %11, i32** %9
%12 = load i32*, i32** %9
%13 = load i32, i32* %12
%14 = add i32 %13, 1
store i32 %14, i32* %12
ret i32 0
}

LLVM IR (-O2):
define i32 @add_one(i8* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = bitcast i8* %0 to i32*
%6 = load i32, i32* %5
%7 = add i32 %6, 1
store i32 %7, i32* %5
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main() {
  printf(" -Dlinux");
  printf(" -D__linux__");
  printf(" -Dunix");
  printf("\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
lea    0xec6(%rip),%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c" -Dlinux\00"
@.str.1 = [13 x i8] c" -D__linux__\00"
@.str.2 = [8 x i8] c" -Dunix\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [9 x i8] c" -Dlinux\00"
@.str.1 = [13 x i8] c" -D__linux__\00"
@.str.2 = [8 x i8] c" -Dunix\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @putchar(i32 10)
%5 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
double drand();
double rand_double(double min, double max) {
  return drand() * (max - min) + min;
}


x86 assembly (clang, -O0):
<rand_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    $0x0,%al
call   1030 <drand@plt>
movsd  -0x10(%rbp),%xmm2
subsd  -0x8(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_double>:
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1030 <drand@plt>
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
subsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @rand_double(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = call double (...) @drand()
%6 = load double, double* %4
%7 = load double, double* %3
%8 = fsub double %6, %7
%9 = load double, double* %3
%10 = call double @llvm.fmuladd.f64(double %5, double %8, double %9)
ret double %10
}

LLVM IR (-O2):
define double @rand_double(double %0, double %1) {
%3 = tail call double (...) @drand()
%4 = fsub double %1, %0
%5 = tail call double @llvm.fmuladd.f64(double %3, double %4, double %0)
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ print_info(char const *);
void console_init(void) {
  static const char console_test[] = "\r\n\r\nLinuxBIOS-"
                                     "1.1.0"
                                     ".0Fallback"
                                     " "
                                     "Thu Jun 19 05:42:16 MDT 2003"
                                     " starting...\r\n";
  print_info(console_test);
}


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

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

LLVM IR (-O0):
@console_init.console_test = internal constant [73 x i8] c"\0D\0A\0D\0ALinuxBIOS-1.1.0.0Fallback Thu Jun 19 05:42:16 MDT 2003 starting...\0D\0A\00"
define void @console_init() {
%1 = call i32 @print_info(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @console_init.console_test, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@console_init.console_test = internal constant [73 x i8] c"\0D\0A\0D\0ALinuxBIOS-1.1.0.0Fallback Thu Jun 19 05:42:16 MDT 2003 starting...\0D\0A\00"
define void @console_init() {
%1 = tail call i32 @print_info(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @console_init.console_test, i64 0, i64 0))
ret void
}
int GLUE_RESET_WTP(unsigned char *out, void *ptr) {
  if (out) {
    *out++ = 0x48;
    *out++ = 0xBE;
    *(void **)out = ptr;
    out += sizeof(void *);
  }
  return 2 + sizeof(void *);
}


x86 assembly (clang, -O0):
<GLUE_RESET_WTP>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1152 <GLUE_RESET_WTP+0x52>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x48,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0xbe,(%rax)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    $0xa,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GLUE_RESET_WTP>:
test   %rdi,%rdi
je     110e <GLUE_RESET_WTP+0xe>
movw   $0xbe48,(%rdi)
mov    %rsi,0x2(%rdi)
mov    $0xa,%eax
ret

LLVM IR (-O0):
define i32 @GLUE_RESET_WTP(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 = icmp ne i8* %5, null
br i1 %6, label %7, label %17
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %3
store i8 72, i8* %8
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %3
store i8 -66, i8* %10
%12 = load i8*, i8** %4
%13 = load i8*, i8** %3
%14 = bitcast i8* %13 to i8**
store i8* %12, i8** %14
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 8
store i8* %16, i8** %3
br label %17
17: ; preds = %7, %2
ret i32 10
}

LLVM IR (-O2):
define i32 @GLUE_RESET_WTP(i8* writeonly %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8, i8* %0, i64 1
store i8 72, i8* %0
%6 = getelementptr inbounds i8, i8* %0, i64 2
store i8 -66, i8* %5
%7 = bitcast i8* %6 to i8**
store i8* %1, i8** %7
br label %8
8: ; preds = %4, %2
ret i32 10
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;
struct tcphdr {
  int /*<<< orphan*/ source;
};

/* Variables and functions */
int /*<<< orphan*/ ntohs(int /*<<< orphan*/);
uint16_t _tcphdr_source_ntohs(struct tcphdr *h) { return ntohs(h->source); }


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

x86 assembly (clang, -O2):
<_tcphdr_source_ntohs>:
mov    (%rdi),%edi
jmp    1030 <ntohs@plt>

LLVM IR (-O0):
%struct.tcphdr = type { i32 }
define i32 @_tcphdr_source_ntohs(%struct.tcphdr* %0) {
%2 = alloca %struct.tcphdr*
store %struct.tcphdr* %0, %struct.tcphdr** %2
%3 = load %struct.tcphdr*, %struct.tcphdr** %2
%4 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = call i32 @ntohs(i32 %5)
ret i32 %6
}

LLVM IR (-O2):
%struct.tcphdr = type { i32 }
define i32 @_tcphdr_source_ntohs(%struct.tcphdr* nocapture %0) {
%2 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = tail call i32 @ntohs(i32 %3)
ret i32 %4
}
int XpmLibraryVersion(void) { return ((3 * 100 + 4) * 100 + 11); }


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

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

LLVM IR (-O0):
define i32 @XpmLibraryVersion() {
ret i32 30411
}

LLVM IR (-O2):
define i32 @XpmLibraryVersion() {
ret i32 30411
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef scalar_t__ u_int;
typedef int /*<<< orphan*/ bool_t;
struct TYPE_3__ {
  scalar_t__ x_private;
};
typedef TYPE_1__ XDR;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ FALSE;
int /*<<< orphan*/ TRUE;
scalar_t__ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
bool_t xdrstdio_setpos(XDR *xdrs, u_int pos) {
  return ((fseek((FILE *)xdrs->x_private, (long)pos, 0) < 0) ? FALSE : TRUE);
}


x86 assembly (clang, -O0):
<xdrstdio_setpos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1030 <fseek@plt>
cmp    $0x0,%rax
jge    114d <xdrstdio_setpos+0x3d>
mov    0x2e95(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
jmp    1159 <xdrstdio_setpos+0x49>
mov    0x2e94(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdrstdio_setpos>:
push   %rax
mov    (%rdi),%rdi
xor    %edx,%edx
call   1030 <fseek@plt>
test   %rax,%rax
jns    1129 <xdrstdio_setpos+0x19>
mov    0x2eb1(%rip),%rax
jmp    1130 <xdrstdio_setpos+0x20>
mov    0x2eb8(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64 }
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @xdrstdio_setpos(%struct.TYPE_3__* %0, i64 %1) {
%3 = alloca %struct.TYPE_3__*
%4 = alloca i64
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %3
store i64 %1, i64* %4
%5 = load %struct.TYPE_3__*, %struct.TYPE_3__** %3
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
%7 = load i64, i64* %6
%8 = inttoptr i64 %7 to i32*
%9 = load i64, i64* %4
%10 = call i64 @fseek(i32* %8, i64 %9, i32 0)
%11 = icmp slt i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load i32, i32* @FALSE
br label %16
14: ; preds = %2
%15 = load i32, i32* @TRUE
br label %16
16: ; preds = %14, %12
%17 = phi i32 [ %13, %12 ], [ %15, %14 ]
ret i32 %17
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i64 }
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @xdrstdio_setpos(%struct.TYPE_3__* nocapture %0, i64 %1) {
%3 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
%4 = load i64, i64* %3
%5 = inttoptr i64 %4 to i32*
%6 = tail call i64 @fseek(i32* %5, i64 %1, i32 0)
%7 = icmp slt i64 %6, 0
%8 = load i32, i32* @FALSE
%9 = load i32, i32* @TRUE
%10 = select i1 %7, i32 %8, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int main(void) {
  char *c1 = "foo";
  char *c2 = "foo";
  int i;
  for (i = 0; i < 3; i++)
    if (c1[i] != c2[i])
      abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xebf(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    1190 <main+0x70>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     117d <main+0x5d>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1182 <main+0x62>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114c <main+0x2c>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@.str = [4 x i8] c"foo\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %3
store i32 0, i32* %4
br label %5
5: ; preds = %25, %0
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 3
br i1 %7, label %8, label %28
8: ; preds = %5
%9 = load i8*, i8** %2
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = load i8*, i8** %3
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %14, %20
br i1 %21, label %22, label %24
22: ; preds = %8
%23 = call i32 (...) @abort()
unreachable
24: ; preds = %8
br label %25
25: ; preds = %24
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %5
28: ; preds = %5
%29 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ Window;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int /*<<< orphan*/ XFree(char *);
char *xgexec_exec_full(int /*<<< orphan*/ *, int /*<<< orphan*/, char *,
                       char **, char **);
char *xgexec_exec(Display *dpy, Window w, char *req) {
  char *result, *out, *err;
  result = xgexec_exec_full(dpy, w, req, &out, &err);
  XFree(out);
  XFree(err);
  return result;
}


x86 assembly (clang, -O0):
<xgexec_exec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    -0x28(%rbp),%rcx
lea    -0x30(%rbp),%r8
call   1040 <xgexec_exec_full@plt>
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <XFree@plt>
mov    -0x30(%rbp),%rdi
call   1030 <XFree@plt>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xgexec_exec>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rcx
mov    %rsp,%r8
call   1040 <xgexec_exec_full@plt>
mov    %rax,%rbx
mov    0x8(%rsp),%rdi
call   1030 <XFree@plt>
mov    (%rsp),%rdi
call   1030 <XFree@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i8* @xgexec_exec(i32* %0, i32 %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%10 = load i32*, i32** %4
%11 = load i32, i32* %5
%12 = load i8*, i8** %6
%13 = call i8* @xgexec_exec_full(i32* %10, i32 %11, i8* %12, i8** %8, i8** %9)
store i8* %13, i8** %7
%14 = load i8*, i8** %8
%15 = call i32 @XFree(i8* %14)
%16 = load i8*, i8** %9
%17 = call i32 @XFree(i8* %16)
%18 = load i8*, i8** %7
ret i8* %18
}

LLVM IR (-O2):
define i8* @xgexec_exec(i32* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = bitcast i8** %4 to i8*
%7 = bitcast i8** %5 to i8*
%8 = call i8* @xgexec_exec_full(i32* %0, i32 %1, i8* %2, i8** %4, i8** %5)
%9 = load i8*, i8** %4
%10 = call i32 @XFree(i8* %9)
%11 = load i8*, i8** %5
%12 = call i32 @XFree(i8* %11)
ret i8* %8
}
void amdgpu_mn_lock(struct amdgpu_mn *mn) {}


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

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

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

LLVM IR (-O2):
%struct.amdgpu_mn = type opaque
define void @amdgpu_mn_lock(%struct.amdgpu_mn* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outb(char, int);
void commandRegister4(char var) { outb(var, 0x0260 + 0x0F); }


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

x86 assembly (clang, -O2):
<commandRegister4>:
mov    $0x26f,%esi
jmp    1030 <outb@plt>

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

LLVM IR (-O2):
define void @commandRegister4(i8 signext %0) {
%2 = tail call i32 @outb(i8 signext %0, i32 623)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ say(char *, int);
void talk(void) { say("This bed smells kinda funny...", 1); }


x86 assembly (clang, -O0):
<talk>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x1,%esi
call   1030 <say@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<talk>:
lea    0xee9(%rip),%rdi
mov    $0x1,%esi
jmp    1030 <say@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"This bed smells kinda funny...\00"
define void @talk() {
%1 = call i32 @say(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"This bed smells kinda funny...\00"
define void @talk() {
%1 = tail call i32 @say(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
int exact_square(int num) {
  int i;
  for (i = 0; i < num; i++)
    if (i * i == num)
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<exact_square>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1149 <exact_square+0x49>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1136 <exact_square+0x36>
movl   $0x1,-0x4(%rbp)
jmp    1150 <exact_square+0x50>
jmp    113b <exact_square+0x3b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <exact_square+0xe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<exact_square>:
xor    %eax,%eax
test   %edi,%edi
jle    1128 <exact_square+0x28>
cs nopw 0x0(%rax,%rax,1)
mov    %eax,%ecx
imul   %eax,%ecx
cmp    %edi,%ecx
je     1123 <exact_square+0x23>
add    $0x1,%eax
cmp    %eax,%edi
jne    1110 <exact_square+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

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

/* Variables and functions */
uint32_t esp_bt_gap_get_cod_srvc(uint32_t cod) {
  return (cod & (0xffe000)) >> (13);
}


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

x86 assembly (clang, -O2):
<esp_bt_gap_get_cod_srvc>:
mov    %edi,%eax
shr    $0xd,%eax
and    $0x7ff,%eax
ret

LLVM IR (-O0):
define i32 @esp_bt_gap_get_cod_srvc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 16769024
%5 = ashr i32 %4, 13
ret i32 %5
}

LLVM IR (-O2):
define i32 @esp_bt_gap_get_cod_srvc(i32 %0) {
%2 = lshr i32 %0, 13
%3 = and i32 %2, 2047
ret i32 %3
}
int indice_de_ligne(char c) { return c - '0' - 1; }


x86 assembly (clang, -O0):
<indice_de_ligne>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
sub    $0x30,%eax
sub    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<indice_de_ligne>:
lea    -0x31(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @indice_de_ligne(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = sub nsw i32 %4, 48
%6 = sub nsw i32 %5, 1
ret i32 %6
}

LLVM IR (-O2):
define i32 @indice_de_ligne(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -49
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ print_9x9();
void main(void) { print_9x9(); }


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

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

LLVM IR (-O0):
define void @main() {
%1 = call i32 (...) @print_9x9()
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @print_9x9()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void C12(void) { printf("Test23\n"); }


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

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

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

LLVM IR (-O2):
@str = [7 x i8] c"Test23\00"
define void @C12() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int read_int(char *);
int get_brightness() {
  return read_int("/sys/class/leds/smc::kbd_backlight/brightness");
}


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

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

LLVM IR (-O0):
@.str = [46 x i8] c"/sys/class/leds/smc::kbd_backlight/brightness\00"
define i32 @get_brightness() {
%1 = call i32 @read_int(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [46 x i8] c"/sys/class/leds/smc::kbd_backlight/brightness\00"
define i32 @get_brightness() {
%1 = tail call i32 @read_int(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
unsigned int _xbegin();
unsigned int __attribute__((__target__("rtm"))) xbegin_wrap(void) {
  return _xbegin();
}


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

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

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

LLVM IR (-O2):
define i32 @xbegin_wrap() {
%1 = tail call i32 (...) @_xbegin()
ret i32 %1
}
/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int bar();
int foo();
int main(void) {
  int f = foo();
  int b = bar();
  return f + b == 17 ? EXIT_SUCCESS : EXIT_FAILURE;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <foo@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <bar@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    $0x11,%eax
jne    1163 <main+0x43>
mov    0x2e7f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
jmp    116f <main+0x4f>
mov    0x2e76(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <foo@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <bar@plt>
add    %ebx,%eax
cmp    $0x11,%eax
jne    1141 <main+0x21>
mov    0x2e99(%rip),%rax
jmp    1148 <main+0x28>
mov    0x2e98(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @foo()
store i32 %4, i32* %2
%5 = call i32 (...) @bar()
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = add nsw i32 %6, %7
%9 = icmp eq i32 %8, 17
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = load i32, i32* @EXIT_SUCCESS
br label %14
12: ; preds = %0
%13 = load i32, i32* @EXIT_FAILURE
br label %14
14: ; preds = %12, %10
%15 = phi i32 [ %11, %10 ], [ %13, %12 ]
ret i32 %15
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @foo()
%2 = tail call i32 (...) @bar()
%3 = add nsw i32 %2, %1
%4 = icmp eq i32 %3, 17
%5 = load i32, i32* @EXIT_SUCCESS
%6 = load i32, i32* @EXIT_FAILURE
%7 = select i1 %4, i32 %5, i32 %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ forward();
scalar_t__ isStuck();
int /*<<< orphan*/ turnLeft();
int /*<<< orphan*/ usleep(int);
void umain() {
  int sign = 1;
  while (1) {
    if (isStuck())
      turnLeft();
    forward();
    usleep(100000);
  }
}


x86 assembly (clang, -O0):
<umain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
mov    $0x0,%al
call   1040 <isStuck@plt>
cmp    $0x0,%rax
je     1167 <umain+0x27>
mov    $0x0,%al
call   1050 <turnLeft@plt>
mov    $0x0,%al
call   1030 <forward@plt>
mov    $0x186a0,%edi
call   1060 <usleep@plt>
jmp    114f <umain+0xf>

x86 assembly (clang, -O2):
<umain>:
push   %rax
jmp    1161 <umain+0x21>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1030 <forward@plt>
mov    $0x186a0,%edi
call   1060 <usleep@plt>
xor    %eax,%eax
call   1040 <isStuck@plt>
test   %rax,%rax
je     1150 <umain+0x10>
xor    %eax,%eax
call   1050 <turnLeft@plt>
jmp    1150 <umain+0x10>

LLVM IR (-O0):
define void @umain() {
%1 = alloca i32
store i32 1, i32* %1
br label %2
2: ; preds = %0, %7
%3 = call i64 (...) @isStuck()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = call i32 (...) @turnLeft()
br label %7
7: ; preds = %5, %2
%8 = call i32 (...) @forward()
%9 = call i32 @usleep(i32 100000)
br label %2
}

LLVM IR (-O2):
define void @umain() {
br label %1
1: ; preds = %6, %0
%2 = tail call i64 (...) @isStuck()
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (...) @turnLeft()
br label %6
6: ; preds = %4, %1
%7 = tail call i32 (...) @forward()
%8 = tail call i32 @usleep(i32 100000)
br label %1
}
/* Variables and functions */
int arith_div(int, int);
int arith_ceiling(int x, int y) { return arith_div(x, y); }


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

x86 assembly (clang, -O2):
<arith_ceiling>:
jmp    1030 <arith_div@plt>

LLVM IR (-O0):
define i32 @arith_ceiling(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 @arith_div(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @arith_ceiling(i32 %0, i32 %1) {
%3 = tail call i32 @arith_div(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
long long divmodti4(int /*<<< orphan*/, unsigned long long, unsigned long long);
long long __udivti3(unsigned long long numerator,
                    unsigned long long denominator) {
  int sign;
  long long dividend;
  long long modul;
  dividend = divmodti4(0, numerator, denominator);
  return dividend;
}


x86 assembly (clang, -O0):
<__udivti3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
xor    %edi,%edi
call   1030 <divmodti4@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__udivti3>:
mov    %rsi,%rdx
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <divmodti4@plt>

LLVM IR (-O0):
define i64 @__udivti3(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%8 = load i64, i64* %3
%9 = load i64, i64* %4
%10 = call i64 @divmodti4(i32 0, i64 %8, i64 %9)
store i64 %10, i64* %6
%11 = load i64, i64* %6
ret i64 %11
}

LLVM IR (-O2):
define i64 @__udivti3(i64 %0, i64 %1) {
%3 = tail call i64 @divmodti4(i32 0, i64 %0, i64 %1)
ret i64 %3
}
/* Variables and functions */
int FHTDoubleCombined(double *, int, int);
int FHTDouble(double *buffer, int len, int chunk) {
  return FHTDoubleCombined(buffer, len, chunk);
}


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

x86 assembly (clang, -O2):
<FHTDouble>:
jmp    1030 <FHTDoubleCombined@plt>

LLVM IR (-O0):
define i32 @FHTDouble(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* %6
%10 = call i32 @FHTDoubleCombined(double* %7, i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @FHTDouble(double* %0, i32 %1, i32 %2) {
%4 = tail call i32 @FHTDoubleCombined(double* %0, i32 %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ ezPrintChar(int /*<<< orphan*/, int /*<<< orphan*/,
                               unsigned char);
void ezPrint(unsigned char x, unsigned char y, const char *text) {
  while (*text) {
    ezPrintChar(*(text++), x++, y);
  }
}


x86 assembly (clang, -O0):
<ezPrint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1163 <ezPrint+0x53>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
mov    -0x1(%rbp),%al
mov    %al,%cl
add    $0x1,%cl
mov    %cl,-0x1(%rbp)
movzbl %al,%esi
movzbl -0x2(%rbp),%edx
call   1030 <ezPrintChar@plt>
jmp    1128 <ezPrint+0x18>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ezPrint>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdx),%al
test   %al,%al
je     114e <ezPrint+0x3e>
mov    %rdx,%rbx
mov    %edi,%ebp
add    $0x1,%rbx
movzbl %sil,%r14d
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
movzbl %bpl,%esi
add    $0x1,%bpl
mov    %r14d,%edx
call   1030 <ezPrintChar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <ezPrint+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @ezPrint(i8 zeroext %0, i8 zeroext %1, i8* nocapture %2) {
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 0
br i1 %5, label %17, label %6
6: ; preds = %3, %6
%7 = phi i8 [ %15, %6 ], [ %4, %3 ]
%8 = phi i8* [ %10, %6 ], [ %2, %3 ]
%9 = phi i8 [ %12, %6 ], [ %0, %3 ]
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = sext i8 %7 to i32
%12 = add i8 %9, 1
%13 = zext i8 %9 to i32
%14 = tail call i32 @ezPrintChar(i32 %11, i32 %13, i8 zeroext %1)
%15 = load i8, i8* %10
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %6
17: ; preds = %6, %3
ret void
}