xunge/DecIR huggingface dataset:
char *draw_line(ch, num_chars, buffer)
char ch;
int num_chars;
char *buffer;
{
  int x;
  for (x = 0; x < num_chars; x++)
    buffer[x] = ch;
  buffer[x] = '\0';
  return buffer;
}


x86 assembly (clang, -O0):
<draw_line>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1140 <draw_line+0x40>
mov    -0x1(%rbp),%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1118 <draw_line+0x18>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_line>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
test   %esi,%esi
jle    112f <draw_line+0x1f>
mov    %edi,%eax
mov    %esi,%r14d
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r14,%rdx
call   1030 <memset@plt>
jmp    1132 <draw_line+0x22>
xor    %r14d,%r14d
movb   $0x0,(%rbx,%r14,1)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @draw_line(i32 %0, i32 %1, i8* returned writeonly %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %9
5: ; preds = %3
%6 = trunc i32 %0 to i8
%7 = zext i32 %1 to i64
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %5, %3
%10 = phi i64 [ 0, %3 ], [ %8, %5 ]
%11 = getelementptr inbounds i8, i8* %2, i64 %10
store i8 0, i8* %11
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t ToLE32(uint32_t value) { return value; }


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

x86 assembly (clang, -O2):
<ToLE32>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @ToLE32(i32 returned %0) {
ret i32 %0
}
int ft_ishexa(char c) {
  if (c >= '0' && c <= '9')
    return (1);
  if (c >= 'a' && c <= 'f')
    return (1);
  if (c >= 'A' && c <= 'F')
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<ft_ishexa>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1130 <ft_ishexa+0x30>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1130 <ft_ishexa+0x30>
movl   $0x1,-0x4(%rbp)
jmp    1183 <ft_ishexa+0x83>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1156 <ft_ishexa+0x56>
movsbl -0x5(%rbp),%eax
cmp    $0x66,%eax
jg     1156 <ft_ishexa+0x56>
movl   $0x1,-0x4(%rbp)
jmp    1183 <ft_ishexa+0x83>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     117c <ft_ishexa+0x7c>
movsbl -0x5(%rbp),%eax
cmp    $0x46,%eax
jg     117c <ft_ishexa+0x7c>
movl   $0x1,-0x4(%rbp)
jmp    1183 <ft_ishexa+0x83>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_ishexa>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%al
setb   %al
and    $0xdf,%dil
add    $0xbf,%dil
cmp    $0x6,%dil
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @ft_ishexa(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 1, i32* %2
br label %31
12: ; preds = %7, %1
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = icmp sge i32 %14, 97
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = icmp sle i32 %18, 102
br i1 %19, label %20, label %21
20: ; preds = %16
store i32 1, i32* %2
br label %31
21: ; preds = %16, %12
%22 = load i8, i8* %3
%23 = sext i8 %22 to i32
%24 = icmp sge i32 %23, 65
br i1 %24, label %25, label %30
25: ; preds = %21
%26 = load i8, i8* %3
%27 = sext i8 %26 to i32
%28 = icmp sle i32 %27, 70
br i1 %28, label %29, label %30
29: ; preds = %25
store i32 1, i32* %2
br label %31
30: ; preds = %25, %21
store i32 0, i32* %2
br label %31
31: ; preds = %30, %29, %20, %11
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
define i32 @ft_ishexa(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = and i8 %0, -33
%5 = add i8 %4, -65
%6 = icmp ult i8 %5, 6
%7 = or i1 %3, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ symlink(char const *, char const *);
int slate_SymbolicLinkFile(const char *pathExisting, const char *pathNew) {
  return !symlink(pathExisting, pathNew);
}


x86 assembly (clang, -O0):
<slate_SymbolicLinkFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <symlink@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slate_SymbolicLinkFile>:
push   %rax
call   1030 <symlink@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @slate_SymbolicLinkFile(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @symlink(i8* %5, i8* %6)
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @slate_SymbolicLinkFile(i8* %0, i8* %1) {
%3 = tail call i32 @symlink(i8* %0, i8* %1)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
unsigned short is_Number(char *s, unsigned short end) {
  unsigned short i;
  for (i = 0; i < end; i++)
    if (s[i] > 57 || s[i] < 48)
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<is_Number>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
movw   $0x0,-0x14(%rbp)
movzwl -0x14(%rbp),%eax
movzwl -0x12(%rbp),%ecx
cmp    %ecx,%eax
jge    1170 <is_Number+0x70>
mov    -0x10(%rbp),%rax
movzwl -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jg     114f <is_Number+0x4f>
mov    -0x10(%rbp),%rax
movzwl -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jge    115a <is_Number+0x5a>
movw   $0x0,-0x2(%rbp)
jmp    1176 <is_Number+0x76>
jmp    115f <is_Number+0x5f>
mov    -0x14(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x14(%rbp)
jmp    1115 <is_Number+0x15>
movw   $0x1,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_Number>:
mov    $0x1,%ax
test   %esi,%esi
je     1125 <is_Number+0x25>
movzwl %si,%esi
xor    %edx,%edx
nopl   (%rax)
movzbl (%rdi,%rdx,1),%ecx
add    $0xc6,%cl
cmp    $0xf5,%cl
jbe    1126 <is_Number+0x26>
add    $0x1,%rdx
cmp    %rdx,%rsi
jne    1110 <is_Number+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define zeroext i16 @is_Number(i8* %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i8*
%5 = alloca i16
%6 = alloca i16
store i8* %0, i8** %4
store i16 %1, i16* %5
store i16 0, i16* %6
br label %7
7: ; preds = %31, %2
%8 = load i16, i16* %6
%9 = zext i16 %8 to i32
%10 = load i16, i16* %5
%11 = zext i16 %10 to i32
%12 = icmp slt i32 %9, %11
br i1 %12, label %13, label %34
13: ; preds = %7
%14 = load i8*, i8** %4
%15 = load i16, i16* %6
%16 = zext i16 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp sgt i32 %19, 57
br i1 %20, label %29, label %21
21: ; preds = %13
%22 = load i8*, i8** %4
%23 = load i16, i16* %6
%24 = zext i16 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp slt i32 %27, 48
br i1 %28, label %29, label %30
29: ; preds = %21, %13
store i16 0, i16* %3
br label %35
30: ; preds = %21
br label %31
31: ; preds = %30
%32 = load i16, i16* %6
%33 = add i16 %32, 1
store i16 %33, i16* %6
br label %7
34: ; preds = %7
store i16 1, i16* %3
br label %35
35: ; preds = %34, %29
%36 = load i16, i16* %3
ret i16 %36
}

LLVM IR (-O2):
define zeroext i16 @is_Number(i8* nocapture %0, i16 zeroext %1) {
%3 = icmp eq i16 %1, 0
br i1 %3, label %15, label %4
4: ; preds = %2
%5 = zext i16 %1 to i64
br label %8
6: ; preds = %8
%7 = icmp eq i64 %14, %5
br i1 %7, label %15, label %8
8: ; preds = %4, %6
%9 = phi i64 [ 0, %4 ], [ %14, %6 ]
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = add i8 %11, -58
%13 = icmp ult i8 %12, -10
%14 = add nuw nsw i64 %9, 1
br i1 %13, label %15, label %6
15: ; preds = %8, %6, %2
%16 = phi i16 [ 1, %2 ], [ 1, %6 ], [ 0, %8 ]
ret i16 %16
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ init(int);
int /*<<< orphan*/ prompt();
int /*<<< orphan*/ sigchld_handler();
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ ten_ms_sleep(int);
int main(int argc, char **argv) {
  init(argc);
  fprintf(stdout, "\nWelcome to TJ Shell! (POLLING) \n\n");
  while (1) {
    prompt();
    ten_ms_sleep(10);
    sigchld_handler();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1070 <init@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
lea    0xe82(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x0,%al
call   1040 <prompt@plt>
mov    $0xa,%edi
call   1030 <ten_ms_sleep@plt>
mov    $0x0,%al
call   1050 <sigchld_handler@plt>
jmp    1183 <main+0x33>

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1070 <init@plt>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
lea    0xe9a(%rip),%rsi
call   1060 <fprintf@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <prompt@plt>
mov    $0xa,%edi
call   1030 <ten_ms_sleep@plt>
xor    %eax,%eax
call   1050 <sigchld_handler@plt>
jmp    1170 <main+0x20>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [35 x i8] c"\0AWelcome to TJ Shell! (POLLING) \0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = call i32 @init(i32 %6)
%8 = load i32, i32* @stdout
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %2, %10
%11 = call i32 (...) @prompt()
%12 = call i32 @ten_ms_sleep(i32 10)
%13 = call i32 (...) @sigchld_handler()
br label %10
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [35 x i8] c"\0AWelcome to TJ Shell! (POLLING) \0A\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @init(i32 %0)
%4 = load i32, i32* @stdout
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %2, %6
%7 = tail call i32 (...) @prompt()
%8 = tail call i32 @ten_ms_sleep(i32 10)
%9 = tail call i32 (...) @sigchld_handler()
br label %6
}
/* Variables and functions */
int /*<<< orphan*/ put8(int);
void fstp_preg64_dword(int reg64) {
  put8(0xD9);
  put8(0x18 + reg64);
}


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

x86 assembly (clang, -O2):
<fstp_preg64_dword>:
push   %rbx
mov    %edi,%ebx
mov    $0xd9,%edi
call   1030 <put8@plt>
add    $0x18,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <put8@plt>

LLVM IR (-O0):
define void @fstp_preg64_dword(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @put8(i32 217)
%4 = load i32, i32* %2
%5 = add nsw i32 24, %4
%6 = call i32 @put8(i32 %5)
ret void
}

LLVM IR (-O2):
define void @fstp_preg64_dword(i32 %0) {
%2 = tail call i32 @put8(i32 217)
%3 = add nsw i32 %0, 24
%4 = tail call i32 @put8(i32 %3)
ret void
}
/* Variables and functions */
int abs(int);
int /*<<< orphan*/ printf(char *);
void print_user_tip(int number_to_guess, int guess) {
  int distance = abs(number_to_guess - guess);
  if (distance == 1) {
    printf("    hot\n");
  } else if (distance == 2) {
    printf("    warm\n");
  } else {
    printf("    cold\n");
  }
}


x86 assembly (clang, -O0):
<print_user_tip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
sub    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1157 <print_user_tip+0x37>
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
jmp    1183 <print_user_tip+0x63>
cmpl   $0x2,-0xc(%rbp)
jne    1172 <print_user_tip+0x52>
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
jmp    117e <print_user_tip+0x5e>
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
jmp    1183 <print_user_tip+0x63>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_user_tip>:
sub    %esi,%edi
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
cmp    $0x2,%eax
lea    0xee6(%rip),%rcx
lea    0xed6(%rip),%rdx
cmove  %rcx,%rdx
cmp    $0x1,%eax
lea    0xeda(%rip),%rdi
cmovne %rdx,%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [9 x i8] c" hot\0A\00"
@.str.1 = [10 x i8] c" warm\0A\00"
@.str.2 = [10 x i8] c" cold\0A\00"
define void @print_user_tip(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = sub nsw i32 %6, %7
%9 = call i32 @abs(i32 %8)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %22
14: ; preds = %2
%15 = load i32, i32* %5
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %21
19: ; preds = %14
%20 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %17
br label %22
22: ; preds = %21, %12
ret void
}

LLVM IR (-O2):
@str = [9 x i8] c" cold\00"
@str.3 = [9 x i8] c" warm\00"
@str.4 = [8 x i8] c" hot\00"
define void @print_user_tip(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
%4 = tail call i32 @llvm.abs.i32(i32 %3, i1 true)
%5 = icmp eq i32 %4, 2
%6 = select i1 %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0)
%7 = icmp eq i32 %4, 1
%8 = select i1 %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str.4, i64 0, i64 0), i8* %6
%9 = tail call i32 @puts(i8* dereferenceable(1) %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main(void) {
  printf("请输入一个小数");
  float float_value;
  scanf("%f", &float_value);
  printf("This input is %e or %f", float_value, float_value);
  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    0xee6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xeb0(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xec5(%rip),%rdi
movaps %xmm0,%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E4\B8\80\E4\B8\AA\E5\B0\8F\E6\95\B0\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [23 x i8] c"This input is %e or %f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%5 = load float, float* %2
%6 = fpext float %5 to double
%7 = load float, float* %2
%8 = fpext float %7 to double
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), double %6, double %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E4\B8\80\E4\B8\AA\E5\B0\8F\E6\95\B0\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [23 x i8] c"This input is %e or %f\00"
define i32 @main() {
%1 = alloca float
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = bitcast float* %1 to i8*
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fpext float %5 to double
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), double %6, double %6)
ret i32 0
}
/* Variables and functions */
int write(int, unsigned char *, int);
int serial_write(int sid, unsigned char byte) {
  int n;
  n = write(sid, &byte, 1);
  if (n < 0)
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<serial_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x9(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    114b <serial_write+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    1152 <serial_write+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_write>:
push   %rax
mov    %sil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
shr    $0x1f,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @serial_write(i32 %0, i8 zeroext %1) {
%3 = alloca i8
store i8 %1, i8* %3
%4 = call i32 @write(i32 %0, i8* %3, i32 1)
%5 = lshr i32 %4, 31
ret i32 %5
}
int _cnt(int head, int tail, int size) { return ((head + size) - tail) % size; }


x86 assembly (clang, -O0):
<_cnt>:
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
sub    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cnt>:
mov    %edx,%ecx
sub    %esi,%edi
lea    (%rdi,%rcx,1),%eax
cltd
idiv   %ecx
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @_cnt(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 = load i32, i32* %5
%11 = sub nsw i32 %9, %10
%12 = load i32, i32* %6
%13 = srem i32 %11, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @_cnt(i32 %0, i32 %1, i32 %2) {
%4 = sub i32 %0, %1
%5 = add i32 %4, %2
%6 = srem i32 %5, %2
ret i32 %6
}
int security_msg_queue_msgsnd(struct msg_queue *msq, struct msg_msg *msg,
                              int msqflg) {
  return 0;
}


x86 assembly (clang, -O0):
<security_msg_queue_msgsnd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.msg_queue = type opaque
%struct.msg_msg = type opaque
define i32 @security_msg_queue_msgsnd(%struct.msg_queue* %0, %struct.msg_msg* %1, i32 %2) {
%4 = alloca %struct.msg_queue*
%5 = alloca %struct.msg_msg*
%6 = alloca i32
store %struct.msg_queue* %0, %struct.msg_queue** %4
store %struct.msg_msg* %1, %struct.msg_msg** %5
store i32 %2, i32* %6
ret i32 0
}

LLVM IR (-O2):
%struct.msg_queue = type opaque
%struct.msg_msg = type opaque
define i32 @security_msg_queue_msgsnd(%struct.msg_queue* nocapture readnone %0, %struct.msg_msg* nocapture readnone %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
int ssleay_rand_bytes(unsigned char *, int, int /*<<< orphan*/);
int ssleay_rand_nopseudo_bytes(unsigned char *buf, int num) {
  return ssleay_rand_bytes(buf, num, 0);
}


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

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

LLVM IR (-O0):
define i32 @ssleay_rand_nopseudo_bytes(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* %4
%7 = call i32 @ssleay_rand_bytes(i8* %5, i32 %6, i32 0)
ret i32 %7
}

LLVM IR (-O2):
define i32 @ssleay_rand_nopseudo_bytes(i8* %0, i32 %1) {
%3 = tail call i32 @ssleay_rand_bytes(i8* %0, i32 %1, i32 0)
ret i32 %3
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ not_buggy(int, int *);
int main(void) {
  int *stuff = (int *)malloc(sizeof(int) * 20);
  for (;;)
    not_buggy(20, stuff);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x50,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x14,%edi
call   1030 <not_buggy@plt>
jmp    113d <main+0x1d>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x50,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
xchg   %ax,%ax
mov    $0x14,%edi
mov    %rbx,%rsi
call   1030 <not_buggy@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i64 @malloc(i32 80)
%4 = inttoptr i64 %3 to i32*
store i32* %4, i32** %2
br label %5
5: ; preds = %5, %0
%6 = load i32*, i32** %2
%7 = call i32 @not_buggy(i32 20, i32* %6)
br label %5
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @malloc(i32 80)
%2 = inttoptr i64 %1 to i32*
br label %3
3: ; preds = %3, %0
%4 = tail call i32 @not_buggy(i32 20, i32* %2)
br label %3
}
/* Type definitions */
typedef int uint32_t;
typedef unsigned short uint16_t;

/* Variables and functions */
void ADI16RegWrite(uint32_t ui32Base, uint32_t ui32Reg, uint16_t ui16Val) {
  ;
  ;
  (*((volatile unsigned short *)(ui32Base + (ui32Reg & 0xFE)))) = ui16Val;
}


x86 assembly (clang, -O0):
<ADI16RegWrite>:
push   %rbp
mov    %rsp,%rbp
mov    %dx,%ax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    -0xa(%rbp),%cx
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%edx
and    $0xfe,%edx
add    %edx,%eax
cltq
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADI16RegWrite>:
and    $0xfe,%esi
movslq %edi,%rax
mov    %dx,(%rsi,%rax,1)
ret

LLVM IR (-O0):
define void @ADI16RegWrite(i32 %0, i32 %1, i16 zeroext %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i16
store i32 %0, i32* %4
store i32 %1, i32* %5
store i16 %2, i16* %6
%7 = load i16, i16* %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = and i32 %9, 254
%11 = add nsw i32 %8, %10
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i16*
store volatile i16 %7, i16* %13
ret void
}

LLVM IR (-O2):
define void @ADI16RegWrite(i32 %0, i32 %1, i16 zeroext %2) {
%4 = and i32 %1, 254
%5 = add nsw i32 %4, %0
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i16*
store volatile i16 %2, i16* %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ factor();
int /*<<< orphan*/ term_prime();
term() {
  factor();
  term_prime();
}


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

x86 assembly (clang, -O2):
<term>:
push   %rax
xor    %eax,%eax
call   1040 <factor@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <term_prime@plt>

LLVM IR (-O0):
define i32 @term() {
%1 = alloca i32
%2 = call i32 (...) @factor()
%3 = call i32 (...) @term_prime()
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
define i32 @term() {
%1 = tail call i32 (...) @factor()
%2 = tail call i32 (...) @term_prime()
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ nonempty_type();
void var_type_specifier() { nonempty_type(); }


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

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

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

LLVM IR (-O2):
define void @var_type_specifier() {
%1 = tail call i32 (...) @nonempty_type()
ret void
}
/* Variables and functions */
void *memcpy(void *, void const *, size_t);
void *rte_memcpy(void *dst, const void *src, size_t n) {
  return (memcpy(dst, src, n));
}


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

x86 assembly (clang, -O2):
<rte_memcpy>:
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define i8* @rte_memcpy(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
ret i8* %7
}

LLVM IR (-O2):
define i8* @rte_memcpy(i8* returned writeonly %0, i8* nocapture %1, i64 %2) {
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 %1, i64 %2, i1 false)
ret i8* %0
}
/* Variables and functions */
char *malloc(int);
char *cptr(char value) {
  char *p = malloc(sizeof(char));
  *p = value;
  return p;
}


x86 assembly (clang, -O0):
<cptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x1,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x1(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cptr>:
push   %rbx
mov    %edi,%ebx
mov    $0x1,%edi
call   1030 <malloc@plt>
mov    %bl,(%rax)
pop    %rbx
ret

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

LLVM IR (-O2):
define noalias i8* @cptr(i8 signext %0) {
%2 = tail call dereferenceable_or_null(1) i8* @malloc(i32 1)
store i8 %0, i8* %2
ret i8* %2
}
int ipc_sock_lock_q(void *dri_if) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @ipc_sock_lock_q(i8* nocapture readnone %0) {
ret i32 0
}
void MmioUtil_Write32(void *base, const unsigned long offset,
                      const unsigned int val) {
  *(volatile unsigned int *)(void *)((char *)(base) + (offset)) = (val);
}


x86 assembly (clang, -O0):
<MmioUtil_Write32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<MmioUtil_Write32>:
mov    %edx,(%rdi,%rsi,1)
ret

LLVM IR (-O0):
define void @MmioUtil_Write32(i8* %0, i64 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = load i64, i64* %5
%10 = getelementptr inbounds i8, i8* %8, i64 %9
%11 = bitcast i8* %10 to i32*
store volatile i32 %7, i32* %11
ret void
}

LLVM IR (-O2):
define void @MmioUtil_Write32(i8* %0, i64 %1, i32 %2) {
%4 = getelementptr inbounds i8, i8* %0, i64 %1
%5 = bitcast i8* %4 to i32*
store volatile i32 %2, i32* %5
ret void
}
void foo396(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo396(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ aply_fann(char *, double, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ train_fann(char *, char *);
int main() {
  train_fann("friss.dat", "friss.net");
  printf("%lf \n", aply_fann("friss.net", 0.00923, 0));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xecd(%rip),%rdi
lea    0xed0(%rip),%rsi
call   1040 <train_fann@plt>
lea    0xec4(%rip),%rdi
movsd  0xeaa(%rip),%xmm0
xor    %esi,%esi
call   1050 <aply_fann@plt>
mov    %eax,%esi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed0(%rip),%rdi
lea    0xed3(%rip),%rbx
mov    %rbx,%rsi
call   1040 <train_fann@plt>
movsd  0xeb1(%rip),%xmm0
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <aply_fann@plt>
lea    0xebc(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"friss.dat\00"
@.str.1 = [10 x i8] c"friss.net\00"
@.str.2 = [6 x i8] c"%lf \0A\00"
define i32 @main() {
%1 = call i32 @train_fann(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @aply_fann(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double 9.230000e-03, i32 0)
%3 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"friss.dat\00"
@.str.1 = [10 x i8] c"friss.net\00"
@.str.2 = [6 x i8] c"%lf \0A\00"
define i32 @main() {
%1 = tail call i32 @train_fann(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @aply_fann(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double 9.230000e-03, i32 0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void foo(void) {
  int i = 0;
  i++;
  printf("i: %d\n", i);
}


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

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

LLVM IR (-O0):
@.str = [7 x i8] c"i: %d\0A\00"
define void @foo() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* %1
%3 = add nsw i32 %2, 1
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"i: %d\0A\00"
define void @foo() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
int main() {
  system("cls");
  system("explorer.exe");
  system("\"C:\\Program Files (x86)\\Notepad++\\notepad++.exe\"");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"cls\00"
@.str.1 = [13 x i8] c"explorer.exe\00"
@.str.2 = [49 x i8] c"\22C:\\Program Files (x86)\\Notepad++\\notepad++.exe\22\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @system(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
@.str.1 = [13 x i8] c"explorer.exe\00"
@.str.2 = [49 x i8] c"\22C:\\Program Files (x86)\\Notepad++\\notepad++.exe\22\00"
define i32 @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @system(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
unsigned long BIT_MASK(int);
int BIT_WORD(int);
void __change_bit(int nr, volatile unsigned long *addr) {
  unsigned long mask = BIT_MASK(nr);
  unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
  *p ^= mask;
}


x86 assembly (clang, -O0):
<__change_bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <BIT_MASK@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <BIT_WORD@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rax
xor    (%rax),%rcx
mov    %rcx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__change_bit>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
call   1030 <BIT_MASK@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   1040 <BIT_WORD@plt>
cltq
xor    %rbx,(%r14,%rax,8)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @__change_bit(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i64*
store i32 %0, i32* %3
store i64* %1, i64** %4
%7 = load i32, i32* %3
%8 = call i64 @BIT_MASK(i32 %7)
store i64 %8, i64* %5
%9 = load i64*, i64** %4
%10 = load i32, i32* %3
%11 = call i32 @BIT_WORD(i32 %10)
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i64, i64* %9, i64 %12
store i64* %13, i64** %6
%14 = load i64, i64* %5
%15 = load i64*, i64** %6
%16 = load i64, i64* %15
%17 = xor i64 %16, %14
store i64 %17, i64* %15
ret void
}

LLVM IR (-O2):
define void @__change_bit(i32 %0, i64* nocapture %1) {
%3 = tail call i64 @BIT_MASK(i32 %0)
%4 = tail call i32 @BIT_WORD(i32 %0)
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i64, i64* %1, i64 %5
%7 = load i64, i64* %6
%8 = xor i64 %7, %3
store i64 %8, i64* %6
ret void
}
void do_sleep(argc, argv) char **argv;
{
  if (argc > 1)
    sleep(atoi(argv[1]));
}


x86 assembly (clang, -O0):
<do_sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    1151 <do_sleep+0x31>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0x0,%al
call   1030 <atoi@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1040 <sleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_sleep>:
cmp    $0x2,%edi
jl     113b <do_sleep+0x1b>
push   %rax
mov    0x8(%rsi),%rdi
xor    %eax,%eax
call   1030 <atoi@plt>
mov    %eax,%edi
xor    %eax,%eax
pop    %rcx
jmp    1040 <sleep@plt>
ret

LLVM IR (-O0):
define void @do_sleep(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp sgt i32 %5, 1
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i8**, i8*** %4
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %10)
%12 = call i32 (i32, ...) bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 %11)
br label %13
13: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
define void @do_sleep(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %6)
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 %7)
br label %9
9: ; preds = %4, %2
ret void
}
int test_imm_05int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x05 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_05int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 327680
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
unsigned long cmpxchg(unsigned long *p, unsigned long expected,
                      unsigned long desired) {
  unsigned long exp = expected;
  __atomic_compare_exchange_n(p, &exp, desired, 0, 5, 5);
  return exp;
}


x86 assembly (clang, -O0):
<cmpxchg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rdx
lock cmpxchg %rdx,(%rcx)
mov    %rax,%rcx
sete   %al
mov    %al,-0x39(%rbp)
mov    %rcx,-0x38(%rbp)
test   $0x1,%al
jne    114e <cmpxchg+0x4e>
mov    -0x38(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x39(%rbp),%al
and    $0x1,%al
mov    %al,-0x29(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmpxchg>:
mov    %rsi,%rax
lock cmpxchg %rdx,(%rdi)
ret

LLVM IR (-O0):
define i64 @cmpxchg(i64* %0, i64 %1, i64 %2) {
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i8
store i64* %0, i64** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%10 = load i64, i64* %5
store i64 %10, i64* %7
%11 = load i64*, i64** %4
%12 = load i64, i64* %6
store i64 %12, i64* %8
%13 = load i64, i64* %7
%14 = load i64, i64* %8
%15 = cmpxchg i64* %11, i64 %13, i64 %14 seq_cst seq_cst
%16 = extractvalue { i64, i1 } %15, 0
%17 = extractvalue { i64, i1 } %15, 1
br i1 %17, label %19, label %18
18: ; preds = %3
store i64 %16, i64* %7
br label %19
19: ; preds = %18, %3
%20 = zext i1 %17 to i8
store i8 %20, i8* %9
%21 = load i8, i8* %9
%22 = trunc i8 %21 to i1
%23 = load i64, i64* %7
ret i64 %23
}

LLVM IR (-O2):
define i64 @cmpxchg(i64* nocapture %0, i64 %1, i64 %2) {
%4 = cmpxchg i64* %0, i64 %1, i64 %2 seq_cst seq_cst
%5 = extractvalue { i64, i1 } %4, 0
ret i64 %5
}
/* Type definitions */
struct sn_context {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ sn_reopen_asoc_streams(struct sn_context *);
void *cleanup_sctp(void *args) {
  struct sn_context *snc = args;
  sleep(3);
  sn_reopen_asoc_streams(snc);
}


x86 assembly (clang, -O0):
<cleanup_sctp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x3,%edi
call   1040 <sleep@plt>
mov    -0x18(%rbp),%rdi
call   1030 <sn_reopen_asoc_streams@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanup_sctp>:
push   %rbx
mov    %rdi,%rbx
mov    $0x3,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <sn_reopen_asoc_streams@plt>

LLVM IR (-O0):
%struct.sn_context = type { i32 }
define i8* @cleanup_sctp(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca %struct.sn_context*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to %struct.sn_context*
store %struct.sn_context* %6, %struct.sn_context** %4
%7 = call i32 @sleep(i32 3)
%8 = load %struct.sn_context*, %struct.sn_context** %4
%9 = call i32 @sn_reopen_asoc_streams(%struct.sn_context* %8)
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
%struct.sn_context = type { i32 }
define noalias i8* @cleanup_sctp(i8* %0) {
%2 = bitcast i8* %0 to %struct.sn_context*
%3 = tail call i32 @sleep(i32 3)
%4 = tail call i32 @sn_reopen_asoc_streams(%struct.sn_context* %2)
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ mergeA(int *, int, int, int);
void mergeSortA(int *A, int lo, int hi) {
  int middle;
  if (lo < hi) {
    middle = (int)((lo + hi) / 2);
    mergeSortA(A, lo, middle);
    mergeSortA(A, middle + 1, hi);
    mergeA(A, lo, middle, hi);
  }
}


x86 assembly (clang, -O0):
<mergeSortA>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1182 <mergeSortA+0x62>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <mergeSortA@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <mergeSortA@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1030 <mergeA@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mergeSortA>:
cmp    %edx,%esi
jge    1172 <mergeSortA+0x52>
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r12d
mov    %rdi,%r15
lea    (%r14,%r12,1),%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
mov    %ebx,%edx
call   1040 <mergeSortA@plt>
lea    0x1(%rbx),%esi
mov    %r15,%rdi
mov    %r14d,%edx
call   1040 <mergeSortA@plt>
mov    %r15,%rdi
mov    %r12d,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <mergeA@plt>
ret

LLVM IR (-O0):
define void @mergeSortA(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %28
11: ; preds = %3
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = add nsw i32 %12, %13
%15 = sdiv i32 %14, 2
store i32 %15, i32* %7
%16 = load i32*, i32** %4
%17 = load i32, i32* %5
%18 = load i32, i32* %7
%19 = load i32*, i32** %4
%20 = load i32, i32* %7
%21 = add nsw i32 %20, 1
%22 = load i32, i32* %6
%23 = load i32*, i32** %4
%24 = load i32, i32* %5
%25 = load i32, i32* %7
%26 = load i32, i32* %6
%27 = call i32 @mergeA(i32* %23, i32 %24, i32 %25, i32 %26)
br label %28
28: ; preds = %11, %3
ret void
}

LLVM IR (-O2):
define void @mergeSortA(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %6, label %5
5: ; preds = %3, %6
ret void
6: ; preds = %3
%7 = add nsw i32 %2, %1
%8 = sdiv i32 %7, 2
tail call void @mergeSortA(i32* %0, i32 %1, i32 %8)
%9 = add nsw i32 %8, 1
tail call void @mergeSortA(i32* %0, i32 %9, i32 %2)
%10 = tail call i32 @mergeA(i32* %0, i32 %1, i32 %8, i32 %2)
br label %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
void log_default_stdout_func(char *prefix, char *contents) {
  printf("%s %s\n", prefix, contents);
}


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

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"%s %s\0A\00"
define void @log_default_stdout_func(i8* %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gendep__register_unlink(char const *);
int /*<<< orphan*/ printf(char *, char const *);
int real_unlink(char const *);
int __unlink(const char *fn) {
  int rv;
  if (0)
    printf("unlink(%s)\n", fn);
  rv = real_unlink(fn);
  if (rv >= 0)
    gendep__register_unlink(fn);
  return rv;
}


x86 assembly (clang, -O0):
<__unlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <real_unlink@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     114b <__unlink+0x2b>
mov    -0x8(%rbp),%rdi
call   1040 <gendep__register_unlink@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__unlink>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <real_unlink@plt>
mov    %eax,%ebp
test   %eax,%eax
js     1139 <__unlink+0x19>
mov    %rbx,%rdi
call   1040 <gendep__register_unlink@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @__unlink(i8* %0) {
%2 = tail call i32 @real_unlink(i8* %0)
%3 = icmp sgt i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @gendep__register_unlink(i8* %0)
br label %6
6: ; preds = %4, %1
ret i32 %2
}