xunge/DecIR huggingface dataset:
void clear_line(char *line) {
  int len;
  int i = 0;
  while (line[i] < 100) {
    line[i++] = 0;
  };
}


x86 assembly (clang, -O0):
<clear_line>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x64,%eax
jge    113f <clear_line+0x3f>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x10(%rbp)
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    110f <clear_line+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_line>:
cmpb   $0x63,(%rdi)
jg     111d <clear_line+0x1d>
add    $0x1,%rdi
nopl   0x0(%rax)
movb   $0x0,-0x1(%rdi)
cmpb   $0x64,(%rdi)
lea    0x1(%rdi),%rdi
jl     1110 <clear_line+0x10>
ret

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

LLVM IR (-O2):
define void @clear_line(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp slt i8 %2, 100
br i1 %3, label %4, label %11
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = add nuw nsw i64 %5, 1
store i8 0, i8* %6
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp slt i8 %9, 100
br i1 %10, label %4, label %11
11: ; preds = %4, %1
ret void
}
/* Variables and functions */
char const *strong_s3();
const char *__attribute__((section(".test.c"))) call_strong_s3(void) {
  return strong_s3() + 1;
}


x86 assembly (clang, -O0):
<call_strong_s3>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <strong_s3@plt>
add    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_strong_s3>:
push   %rax
xor    %eax,%eax
call   1030 <strong_s3@plt>
add    $0x1,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @call_strong_s3() section ".test.c" {
%1 = call i8* (...) @strong_s3()
%2 = getelementptr inbounds i8, i8* %1, i64 1
ret i8* %2
}

LLVM IR (-O2):
define i8* @call_strong_s3() section ".test.c" {
%1 = tail call i8* (...) @strong_s3()
%2 = getelementptr inbounds i8, i8* %1, i64 1
ret i8* %2
}
/* Variables and functions */
int t1_3d_init_ctxno_zc(unsigned int, int);
int t1_3d_getctxno_zc(unsigned int f, int orient) {
  return t1_3d_init_ctxno_zc(
      (f & ((0x00004000 | 0x00000400 | 0x00008000 | 0x00000800 | 0x00010000 |
             0x00001000 | 0x00020000 | 0x00002000 | 0x00000100) |
            (0x00400000 | 0x00040000 | 0x00800000 | 0x00080000 | 0x01000000 |
             0x00100000 | 0x02000000 | 0x00200000 | 0x00000200) |
            (0x00000010 | 0x00000001 | 0x00000020 | 0x00000002 | 0x00000040 |
             0x00000004 | 0x00000080 | 0x00000008))),
      orient);
}


x86 assembly (clang, -O0):
<t1_3d_getctxno_zc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
and    $0x3ffffff,%edi
mov    -0x8(%rbp),%esi
call   1030 <t1_3d_init_ctxno_zc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t1_3d_getctxno_zc>:
and    $0x3ffffff,%edi
jmp    1030 <t1_3d_init_ctxno_zc@plt>

LLVM IR (-O0):
define i32 @t1_3d_getctxno_zc(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 = and i32 %5, 67108863
%7 = load i32, i32* %4
%8 = call i32 @t1_3d_init_ctxno_zc(i32 %6, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @t1_3d_getctxno_zc(i32 %0, i32 %1) {
%3 = and i32 %0, 67108863
%4 = tail call i32 @t1_3d_init_ctxno_zc(i32 %3, i32 %1)
ret i32 %4
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
void PWMOutputInvert(uint32_t ui32Base, uint32_t ui32PWMOutBits, bool bInvert) {
  ;

  ;
  if (bInvert == 1) {
    (*((volatile unsigned long *)(ui32Base + 0x0000000C))) |= ui32PWMOutBits;
  } else {
    (*((volatile unsigned long *)(ui32Base + 0x0000000C))) &= ~(ui32PWMOutBits);
  }
}


x86 assembly (clang, -O0):
<PWMOutputInvert>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    1131 <PWMOutputInvert+0x31>
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%rcx
or     %rdx,%rcx
mov    %rcx,0xc(%rax)
jmp    1148 <PWMOutputInvert+0x48>
mov    -0x10(%rbp),%rdx
xor    $0xffffffffffffffff,%rdx
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%rcx
and    %rdx,%rcx
mov    %rcx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<PWMOutputInvert>:
mov    %rdi,-0x10(%rsp)
mov    %rsi,-0x8(%rsp)
mov    -0x8(%rsp),%rax
cmp    $0x1,%edx
jne    111e <PWMOutputInvert+0x1e>
mov    -0x10(%rsp),%rcx
or     %rax,0xc(%rcx)
ret
not    %rax
mov    -0x10(%rsp),%rcx
and    %rax,0xc(%rcx)
ret

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

LLVM IR (-O2):
define void @PWMOutputInvert(i64 %0, i64 %1, i32 %2) {
%4 = alloca i64
%5 = alloca i64
store volatile i64 %0, i64* %4
store volatile i64 %1, i64* %5
%6 = icmp eq i32 %2, 1
%7 = load volatile i64, i64* %5
br i1 %6, label %8, label %14
8: ; preds = %3
%9 = load volatile i64, i64* %4
%10 = add i64 %9, 12
%11 = inttoptr i64 %10 to i64*
%12 = load volatile i64, i64* %11
%13 = or i64 %12, %7
store volatile i64 %13, i64* %11
br label %21
14: ; preds = %3
%15 = xor i64 %7, -1
%16 = load volatile i64, i64* %4
%17 = add i64 %16, 12
%18 = inttoptr i64 %17 to i64*
%19 = load volatile i64, i64* %18
%20 = and i64 %19, %15
store volatile i64 %20, i64* %18
br label %21
21: ; preds = %14, %8
ret void
}
void av_packet_alloc() {}


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

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

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

LLVM IR (-O2):
define void @av_packet_alloc() {
ret void
}
/* Variables and functions */
size_t uitoa(int, char *, unsigned int);
size_t itoa(int nb, char *nb_str, unsigned int base) {
  if (nb < 0) {
    *nb_str = '-';
    return 1 + uitoa(nb * -1, nb_str + 1, base);
  }
  return uitoa(nb, nb_str, base);
}


x86 assembly (clang, -O0):
<itoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1154 <itoa+0x44>
mov    -0x18(%rbp),%rax
movb   $0x2d,(%rax)
imul   $0xffffffff,-0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
mov    -0x1c(%rbp),%edx
call   1030 <uitoa@plt>
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1167 <itoa+0x57>
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <uitoa@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<itoa>:
test   %edi,%edi
js     1119 <itoa+0x9>
jmp    1030 <uitoa@plt>
push   %rax
movb   $0x2d,(%rsi)
neg    %edi
add    $0x1,%rsi
call   1030 <uitoa@plt>
add    $0x1,%rax
pop    %rcx
ret

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

LLVM IR (-O2):
define i64 @itoa(i32 %0, i8* %1, i32 %2) {
%4 = icmp slt i32 %0, 0
br i1 %4, label %5, label %10
5: ; preds = %3
store i8 45, i8* %1
%6 = sub nsw i32 0, %0
%7 = getelementptr inbounds i8, i8* %1, i64 1
%8 = tail call i64 @uitoa(i32 %6, i8* %7, i32 %2)
%9 = add i64 %8, 1
br label %12
10: ; preds = %3
%11 = tail call i64 @uitoa(i32 %0, i8* %1, i32 %2)
br label %12
12: ; preds = %10, %5
%13 = phi i64 [ %9, %5 ], [ %11, %10 ]
ret i64 %13
}
/* Variables and functions */
int ft_strlen(char *);
int /*<<< orphan*/ ft_swap(char *, char *);
void ft_strrev(char *str) {
  char *end;
  end = str + ft_strlen(str) - 1;
  while (str < end) {
    ft_swap(str, end);
    str++;
    end--;
  }
}


x86 assembly (clang, -O0):
<ft_strrev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ft_strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1189 <ft_strrev+0x69>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <ft_swap@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1151 <ft_strrev+0x31>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strrev>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <ft_strlen@plt>
cltq
lea    (%r14,%rax,1),%rbx
add    $0xffffffffffffffff,%rbx
cmp    %r14,%rbx
jbe    1158 <ft_strrev+0x38>
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <ft_swap@plt>
add    $0x1,%r14
add    $0xffffffffffffffff,%rbx
cmp    %rbx,%r14
jb     1140 <ft_strrev+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @ft_strrev(i8* %0) {
%2 = tail call i32 @ft_strlen(i8* %0)
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = getelementptr inbounds i8, i8* %4, i64 -1
%6 = icmp ugt i8* %5, %0
br i1 %6, label %7, label %14
7: ; preds = %1, %7
%8 = phi i8* [ %12, %7 ], [ %5, %1 ]
%9 = phi i8* [ %11, %7 ], [ %0, %1 ]
%10 = tail call i32 @ft_swap(i8* %9, i8* %8)
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = getelementptr inbounds i8, i8* %8, i64 -1
%13 = icmp ult i8* %11, %12
br i1 %13, label %7, label %14
14: ; preds = %7, %1
ret void
}
void test_safe_call(void) { puts(__func__); }


x86 assembly (clang, -O0):
<test_safe_call>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@__func__.test_safe_call = [15 x i8] c"test_safe_call\00"
define void @test_safe_call() {
%1 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.test_safe_call, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.test_safe_call = [15 x i8] c"test_safe_call\00"
define void @test_safe_call() {
%1 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__.test_safe_call, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _exit_errno(int);
int _ensure(int line, int retval) {
  if (retval == -1)
    _exit_errno(line);
  return retval;
}


x86 assembly (clang, -O0):
<_ensure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    1130 <_ensure+0x20>
mov    -0x4(%rbp),%edi
call   1030 <_exit_errno@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ensure>:
push   %rbx
mov    %esi,%ebx
cmp    $0xffffffff,%esi
jne    111d <_ensure+0xd>
call   1030 <_exit_errno@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @_ensure(i32 %0, i32 returned %1) {
%3 = icmp eq i32 %1, -1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @_exit_errno(i32 %0)
br label %6
6: ; preds = %4, %2
ret i32 %1
}
/* Variables and functions */
int tasksignalall();
int cornet_signalall() { return tasksignalall(); }


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

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

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

LLVM IR (-O2):
define i32 @cornet_signalall() {
%1 = tail call i32 (...) @tasksignalall()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void _clrscr(void) { system("cls"); }


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"cls\00"
define void @_clrscr() {
%1 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
define void @_clrscr() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abc(int *);
int /*<<< orphan*/ bcd(int **);
int /*<<< orphan*/ printf(char *);
int main() {
  int a = 10;
  abc(&a);
  int *b = &a;
  bcd(&b);
  abc(&a);
  printf("\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0xa,0x4(%rsp)
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <abc@plt>
mov    %rbx,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1050 <bcd@plt>
mov    %rbx,%rdi
call   1040 <abc@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = bitcast i32* %1 to i8*
store i32 10, i32* %1
%4 = call i32 @abc(i32* %1)
%5 = bitcast i32** %2 to i8*
store i32* %1, i32** %2
%6 = call i32 @bcd(i32** %2)
%7 = call i32 @abc(i32* %1)
%8 = call i32 @putchar(i32 10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int);
int /*<<< orphan*/ usleep(int);
void *threadFunc(void *arg) {
  char *str;
  int i = 0;
  str = (char *)arg;
  while (i < 110) {
    usleep(1);
    printf("threadFunc says: %s at step %d\n", str, i);
    ++i;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<threadFunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x6e,-0x14(%rbp)
jge    1170 <threadFunc+0x50>
mov    $0x1,%edi
call   1040 <usleep@plt>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113b <threadFunc+0x1b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<threadFunc>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
xor    %ebp,%ebp
lea    0xed0(%rip),%r14
mov    $0x1,%edi
call   1040 <usleep@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    $0x6e,%ebp
jne    1130 <threadFunc+0x10>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"threadFunc says: %s at step %d\0A\00"
define i8* @threadFunc(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %4
%5 = load i8*, i8** %2
store i8* %5, i8** %3
br label %6
6: ; preds = %9, %1
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 110
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = call i32 @usleep(i32 1)
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %11, i32 %12)
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
br label %6
16: ; preds = %6
ret i8* null
}

LLVM IR (-O2):
@.str = [32 x i8] c"threadFunc says: %s at step %d\0A\00"
define noalias i8* @threadFunc(i8* %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 0, %1 ], [ %6, %2 ]
%4 = tail call i32 @usleep(i32 1)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %3)
%6 = add nuw nsw i32 %3, 1
%7 = icmp eq i32 %6, 110
br i1 %7, label %8, label %2
8: ; preds = %2
ret i8* null
}
/* Type definitions */
struct tnode {
  int dummy;
};

/* Variables and functions */
struct tnode *tree_prev_next(struct tnode *, int);
struct tnode *tree_next(struct tnode *node) {
  return tree_prev_next(node, 1);
}


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

x86 assembly (clang, -O2):
<tree_next>:
mov    $0x1,%esi
jmp    1030 <tree_prev_next@plt>

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

LLVM IR (-O2):
%struct.tnode = type { i32 }
define %struct.tnode* @tree_next(%struct.tnode* %0) {
%2 = tail call %struct.tnode* @tree_prev_next(%struct.tnode* %0, i32 1)
ret %struct.tnode* %2
}
int strindex(char s[], char t) {
  int i, k;
  for (i = 0, k = -1; s[i] != '\0'; i++)
    if (s[i] == t)
      k = i;
  if (k >= 0)
    return k;
  return k;
}


x86 assembly (clang, -O0):
<strindex>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1162 <strindex+0x62>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    114f <strindex+0x4f>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1154 <strindex+0x54>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    111c <strindex+0x1c>
cmpl   $0x0,-0x1c(%rbp)
jl     1177 <strindex+0x77>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117d <strindex+0x7d>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strindex>:
mov    (%rdi),%cl
mov    $0xffffffff,%eax
test   %cl,%cl
je     1123 <strindex+0x23>
xor    %edx,%edx
nopl   (%rax)
cmp    %sil,%cl
cmove  %edx,%eax
movzbl 0x1(%rdi,%rdx,1),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1110 <strindex+0x10>
ret

LLVM IR (-O0):
define i32 @strindex(i8* %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8 %1, i8* %5
store i32 0, i32* %6
store i32 -1, i32* %7
br label %8
8: ; preds = %29, %2
%9 = load i8*, i8** %4
%10 = load i32, i32* %6
%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 = icmp ne i32 %14, 0
br i1 %15, label %16, label %32
16: ; preds = %8
%17 = load i8*, i8** %4
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = load i8, i8* %5
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %22, %24
br i1 %25, label %26, label %28
26: ; preds = %16
%27 = load i32, i32* %6
store i32 %27, i32* %7
br label %28
28: ; preds = %26, %16
br label %29
29: ; preds = %28
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %8
32: ; preds = %8
%33 = load i32, i32* %7
%34 = icmp sge i32 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = load i32, i32* %7
store i32 %36, i32* %3
br label %39
37: ; preds = %32
%38 = load i32, i32* %7
store i32 %38, i32* %3
br label %39
39: ; preds = %37, %35
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
define i32 @strindex(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %12, %5 ], [ 0, %2 ]
%7 = phi i8 [ %14, %5 ], [ %3, %2 ]
%8 = phi i32 [ %11, %5 ], [ -1, %2 ]
%9 = icmp eq i8 %7, %1
%10 = trunc i64 %6 to i32
%11 = select i1 %9, i32 %10, i32 %8
%12 = add nuw nsw i64 %6, 1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %2
%17 = phi i32 [ -1, %2 ], [ %11, %5 ]
ret i32 %17
}
void PutInt32(int val, char *ptr) {
  ptr[0] = (val >> 0) & 0xff;
  ptr[1] = (val >> 8) & 0xff;
  ptr[2] = (val >> 16) & 0xff;
  ptr[3] = (val >> 24) & 0xff;
}


x86 assembly (clang, -O0):
<PutInt32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x0,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x4(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<PutInt32>:
mov    %edi,(%rsi)
ret

LLVM IR (-O0):
define void @PutInt32(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 = ashr i32 %5, 0
%7 = and i32 %6, 255
%8 = trunc i32 %7 to i8
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 0
store i8 %8, i8* %10
%11 = load i32, i32* %3
%12 = ashr i32 %11, 8
%13 = and i32 %12, 255
%14 = trunc i32 %13 to i8
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8 %14, i8* %16
%17 = load i32, i32* %3
%18 = ashr i32 %17, 16
%19 = and i32 %18, 255
%20 = trunc i32 %19 to i8
%21 = load i8*, i8** %4
%22 = getelementptr inbounds i8, i8* %21, i64 2
store i8 %20, i8* %22
%23 = load i32, i32* %3
%24 = ashr i32 %23, 24
%25 = and i32 %24, 255
%26 = trunc i32 %25 to i8
%27 = load i8*, i8** %4
%28 = getelementptr inbounds i8, i8* %27, i64 3
store i8 %26, i8* %28
ret void
}

LLVM IR (-O2):
define void @PutInt32(i32 %0, i8* nocapture writeonly %1) {
%3 = trunc i32 %0 to i8
store i8 %3, i8* %1
%4 = lshr i32 %0, 8
%5 = trunc i32 %4 to i8
%6 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %5, i8* %6
%7 = lshr i32 %0, 16
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %8, i8* %9
%10 = lshr i32 %0, 24
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %11, i8* %12
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void prints(char *s) {
  int i = 0;
  for (i = 0; s[i] != '\0'; i++)
    putchar(s[i]);
  putchar(' ');
}


x86 assembly (clang, -O0):
<prints>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     115e <prints+0x4e>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <prints+0x1a>
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prints>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <prints+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <prints+0x10>
mov    $0x20,%edi
pop    %rbx
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @prints(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8 [ %10, %4 ], [ %2, %1 ]
%7 = tail call i32 @putchar(i8 signext %6)
%8 = add nuw i64 %5, 1
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
%13 = tail call i32 @putchar(i8 signext 32)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
scalar_t__ objc_getClass(char *);
int main() {
  assert(objc_getClass("NSObject") > 0);
  assert(objc_getClass("NSApplication") > 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <objc_getClass@plt>
cmp    $0x0,%rax
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    0xec1(%rip),%rdi
call   1040 <objc_getClass@plt>
cmp    $0x0,%rax
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <objc_getClass@plt>
xor    %edi,%edi
test   %rax,%rax
setg   %dil
call   1030 <assert@plt>
lea    0xec7(%rip),%rdi
call   1040 <objc_getClass@plt>
xor    %edi,%edi
test   %rax,%rax
setg   %dil
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"NSObject\00"
@.str.1 = [14 x i8] c"NSApplication\00"
define i32 @main() {
%1 = call i64 @objc_getClass(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = icmp sgt i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @assert(i32 %3)
%5 = call i64 @objc_getClass(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp sgt i64 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"NSObject\00"
@.str.1 = [14 x i8] c"NSApplication\00"
define i32 @main() {
%1 = tail call i64 @objc_getClass(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = icmp sgt i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i64 @objc_getClass(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp sgt i64 %5, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ aes_decrypt(void *, void *, size_t, int);
int /*<<< orphan*/ setup_aeskey(int, int, void *);
int /*<<< orphan*/ use_aeskey(int);
void decrypt(void *key, void *inbuf, void *outbuf, size_t size) {
  setup_aeskey(0x2C, 1 | 4, key);
  use_aeskey(0x2C);
  aes_decrypt(inbuf, outbuf, size / 0x10, 0x10000000);
}


x86 assembly (clang, -O0):
<decrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdx
mov    $0x2c,%edi
mov    $0x5,%esi
call   1040 <setup_aeskey@plt>
mov    $0x2c,%edi
call   1030 <use_aeskey@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
shr    $0x4,%rdx
mov    $0x10000000,%ecx
call   1050 <aes_decrypt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decrypt>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rdx
mov    $0x2c,%edi
mov    $0x5,%esi
call   1040 <setup_aeskey@plt>
mov    $0x2c,%edi
call   1030 <use_aeskey@plt>
shr    $0x4,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    $0x10000000,%ecx
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <aes_decrypt@plt>

LLVM IR (-O0):
define void @decrypt(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%9 = load i8*, i8** %5
%10 = call i32 @setup_aeskey(i32 44, i32 5, i8* %9)
%11 = call i32 @use_aeskey(i32 44)
%12 = load i8*, i8** %6
%13 = load i8*, i8** %7
%14 = load i64, i64* %8
%15 = udiv i64 %14, 16
%16 = call i32 @aes_decrypt(i8* %12, i8* %13, i64 %15, i32 268435456)
ret void
}

LLVM IR (-O2):
define void @decrypt(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = tail call i32 @setup_aeskey(i32 44, i32 5, i8* %0)
%6 = tail call i32 @use_aeskey(i32 44)
%7 = lshr i64 %3, 4
%8 = tail call i32 @aes_decrypt(i8* %1, i8* %2, i64 %7, i32 268435456)
ret void
}
/* Variables and functions */
scalar_t__ RAND_MAX;
double rand();
int Rnd(int min, int max) {
  return (int)(max * (rand() / ((double)RAND_MAX + 1))) + min;
}


x86 assembly (clang, -O0):
<Rnd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
mov    0x2eaa(%rip),%rax
cvtsi2sdq (%rax),%xmm2
movsd  0xeb5(%rip),%xmm3
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Rnd>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
cvtsi2sd %esi,%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
mov    0x2eb9(%rip),%rax
cvtsi2sdq (%rax),%xmm1
addsd  0xec4(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%eax
add    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define i32 @Rnd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = sitofp i32 %5 to double
%7 = call double (...) @rand()
%8 = load i64, i64* @RAND_MAX
%9 = sitofp i64 %8 to double
%10 = fadd double %9, 1.000000e+00
%11 = fdiv double %7, %10
%12 = fmul double %6, %11
%13 = fptosi double %12 to i32
%14 = load i32, i32* %3
%15 = add nsw i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define i32 @Rnd(i32 %0, i32 %1) {
%3 = sitofp i32 %1 to double
%4 = tail call double (...) @rand()
%5 = load i64, i64* @RAND_MAX
%6 = sitofp i64 %5 to double
%7 = fadd double %6, 1.000000e+00
%8 = fdiv double %4, %7
%9 = fmul double %8, %3
%10 = fptosi double %9 to i32
%11 = add nsw i32 %10, %0
ret i32 %11
}
int main() {
  test();
  test(1);
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test()
%3 = call i32 (i32, ...) bitcast (i32 (...)* @test to i32 (i32, ...)*)(i32 1)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test()
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @test to i32 (i32, ...)*)(i32 1)
ret i32 0
}
adrreg0adr1(r0, r1, x0, x1, p0, p1) short r0, r1;
short *p0, *p1;
{
  if ((p0[10000000]) <= (*((short *)11111111)))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<adrreg0adr1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movswl 0x1312d00(%rax),%eax
mov    $0xa98ac7,%ecx
movswl (%rcx),%ecx
cmp    %ecx,%eax
jg     1146 <adrreg0adr1+0x46>
movl   $0x1,-0x4(%rbp)
jmp    114d <adrreg0adr1+0x4d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adrreg0adr1>:
movzwl 0x1312d00(%r8),%ecx
01
xor    %eax,%eax
cmp    0xa98ac7,%cx
setle  %al
ret

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

LLVM IR (-O2):
define i32 @adrreg0adr1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture %4, i16* nocapture readnone %5) {
%7 = getelementptr inbounds i16, i16* %4, i64 10000000
%8 = load i16, i16* %7
%9 = load i16, i16* inttoptr (i64 11111111 to i16*)
%10 = icmp sle i16 %8, %9
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ die(char *);
int fgetc(int /*<<< orphan*/ *);
char rdbyte(FILE *fd) {
  int c;
  c = fgetc(fd);
  if (c == EOF)
    die("Unexpected EOF");
  return c;
}


x86 assembly (clang, -O0):
<rdbyte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2ea6(%rip),%rcx
cmp    (%rcx),%eax
jne    1156 <rdbyte+0x36>
lea    0xeaf(%rip),%rdi
call   1040 <die@plt>
mov    -0xc(%rbp),%eax
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdbyte>:
push   %rbx
call   1030 <fgetc@plt>
mov    %eax,%ebx
mov    0x2eb9(%rip),%rax
cmp    (%rax),%ebx
jne    113f <rdbyte+0x1f>
lea    0xec6(%rip),%rdi
call   1040 <die@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [15 x i8] c"Unexpected EOF\00"
define signext i8 @rdbyte(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @fgetc(i32* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = load i32, i32* @EOF
%8 = icmp eq i32 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @die(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
%12 = load i32, i32* %3
%13 = trunc i32 %12 to i8
ret i8 %13
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [15 x i8] c"Unexpected EOF\00"
define signext i8 @rdbyte(i32* nocapture %0) {
%2 = tail call i32 @fgetc(i32* %0)
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @die(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = trunc i32 %2 to i8
ret i8 %8
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void g1_cb(void *arg) { puts("GPIO_1 triggered"); }


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"GPIO_1 triggered\00"
define void @g1_cb(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"GPIO_1 triggered\00"
define void @g1_cb(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char getc();
int /*<<< orphan*/ putc(int /*<<< orphan*/);
int gets(char s[]) {
  while ((*s = getc()) != '\r')
    putc(*s++);
  *s = 0;
}


x86 assembly (clang, -O0):
<gets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getc@plt>
mov    -0x10(%rbp),%rcx
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0xd,%eax
je     1161 <gets+0x41>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
call   1030 <putc@plt>
jmp    112c <gets+0xc>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gets>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1040 <getc@plt>
mov    %al,(%r14)
cmp    $0xd,%al
jne    1140 <gets+0x20>
mov    %r14,%rbx
jmp    115e <gets+0x3e>
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
lea    0x1(%r14),%rbx
call   1030 <putc@plt>
xor    %eax,%eax
call   1040 <getc@plt>
mov    %al,0x1(%r14)
mov    %rbx,%r14
cmp    $0xd,%al
jne    1140 <gets+0x20>
movb   $0x0,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @gets(i8* nocapture writeonly %0) {
%2 = tail call signext i8 (...) @getc()
store i8 %2, i8* %0
%3 = icmp eq i8 %2, 13
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = sext i8 %5 to i32
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = tail call i32 @putc(i32 %7)
%10 = tail call signext i8 (...) @getc()
store i8 %10, i8* %8
%11 = icmp eq i8 %10, 13
br i1 %11, label %12, label %4
12: ; preds = %4, %1
%13 = phi i8* [ %0, %1 ], [ %8, %4 ]
store i8 0, i8* %13
ret i32 undef
}
struct pagetable *pagetable_load(struct pagetable *p) {
  struct pagetable *oldp;
  asm("mov %%cr3, %0" : "=r"(oldp));
  asm("mov %0, %%cr3" ::"r"(p));
  return oldp;
}


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

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

LLVM IR (-O0):
%struct.pagetable = type opaque
define %struct.pagetable* @pagetable_load(%struct.pagetable* %0) {
%2 = alloca %struct.pagetable*
%3 = alloca %struct.pagetable*
store %struct.pagetable* %0, %struct.pagetable** %2
%4 = call %struct.pagetable* asm "mov %cr3, $0", "=r,~{dirflag},~{fpsr},~{flags}"()
store %struct.pagetable* %4, %struct.pagetable** %3
%5 = load %struct.pagetable*, %struct.pagetable** %2
%6 = load %struct.pagetable*, %struct.pagetable** %3
ret %struct.pagetable* %6
}

LLVM IR (-O2):
%struct.pagetable = type opaque
define %struct.pagetable* @pagetable_load(%struct.pagetable* %0) {
%2 = tail call %struct.pagetable* asm "mov %cr3, $0", "=r,~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "mov $0, %cr3", "r,~{dirflag},~{fpsr},~{flags}"(%struct.pagetable* %0)
ret %struct.pagetable* %2
}
/* Variables and functions */
int lw_sock_peek_ex(int *, int);
int lw_sock_peek(int *sock, int len) {
  int result = 0;
  result = lw_sock_peek_ex(sock, len);
  return result;
}


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

x86 assembly (clang, -O2):
<lw_sock_peek>:
jmp    1030 <lw_sock_peek_ex@plt>

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

LLVM IR (-O2):
define i32 @lw_sock_peek(i32* %0, i32 %1) {
%3 = tail call i32 @lw_sock_peek_ex(i32* %0, i32 %1)
ret i32 %3
}
/* Type definitions */
struct json_string_s {
  int dummy;
};

/* Variables and functions */
char *json_write_minified_string(struct json_string_s const *, char *);
char *json_write_pretty_string(const struct json_string_s *string, char *data) {
  return json_write_minified_string(string, data);
}


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

x86 assembly (clang, -O2):
<json_write_pretty_string>:
jmp    1030 <json_write_minified_string@plt>

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

LLVM IR (-O2):
%struct.json_string_s = type { i32 }
define i8* @json_write_pretty_string(%struct.json_string_s* %0, i8* %1) {
%3 = tail call i8* @json_write_minified_string(%struct.json_string_s* %0, i8* %1)
ret i8* %3
}
float farce(unsigned int ui) { return ui; }


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

x86 assembly (clang, -O2):
<farce>:
mov    %edi,%eax
cvtsi2ss %rax,%xmm0
ret

LLVM IR (-O0):
define float @farce(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = uitofp i32 %3 to float
ret float %4
}

LLVM IR (-O2):
define float @farce(i32 %0) {
%2 = uitofp i32 %0 to float
ret float %2
}
/* Variables and functions */
void *calloc(int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
void *emalloc(int size) {
  void *ptr;
  if ((ptr = calloc(size, 1)) == NULL) {
    fprintf(stderr, "emalloc: no memory for %d bytes", size);
    exit(1);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<emalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1178 <emalloc+0x48>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xe97(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emalloc>:
push   %rbx
mov    %edi,%ebx
mov    $0x1,%esi
call   1030 <calloc@plt>
test   %rax,%rax
je     1144 <emalloc+0x14>
pop    %rbx
ret
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
lea    0xeac(%rip),%rsi
mov    %ebx,%edx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"emalloc: no memory for %d bytes\00"
define i8* @emalloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @calloc(i32 %4, i32 1)
store i8* %5, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = load i32, i32* %2
%10 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"emalloc: no memory for %d bytes\00"
define noalias i8* @emalloc(i32 %0) {
%2 = tail call i8* @calloc(i32 %0, i32 1)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %0)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret i8* %2
}