xunge/DecIR huggingface dataset:
int iptcb_get_entry_n(struct ip6t_entry *i, unsigned int number,
                      unsigned int *pos, struct ip6t_entry **pe) {
  if (*pos == number) {
    *pe = i;
    return 1;
  }
  (*pos)++;
  return 0;
}


x86 assembly (clang, -O0):
<iptcb_get_entry_n>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    1139 <iptcb_get_entry_n+0x39>
mov    -0x10(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    114b <iptcb_get_entry_n+0x4b>
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iptcb_get_entry_n>:
mov    (%rdx),%eax
cmp    %esi,%eax
jne    110f <iptcb_get_entry_n+0xf>
mov    %rdi,(%rcx)
mov    $0x1,%eax
ret
add    $0x1,%eax
mov    %eax,(%rdx)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
%struct.ip6t_entry = type opaque
define i32 @iptcb_get_entry_n(%struct.ip6t_entry* %0, i32 %1, i32* nocapture %2, %struct.ip6t_entry** nocapture writeonly %3) {
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, %1
br i1 %6, label %7, label %8
7: ; preds = %4
store %struct.ip6t_entry* %0, %struct.ip6t_entry** %3
br label %10
8: ; preds = %4
%9 = add i32 %5, 1
store i32 %9, i32* %2
br label %10
10: ; preds = %8, %7
%11 = phi i32 [ 1, %7 ], [ 0, %8 ]
ret i32 %11
}
int helper_ret_5() { return 5; }


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

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

LLVM IR (-O0):
define i32 @helper_ret_5() {
ret i32 5
}

LLVM IR (-O2):
define i32 @helper_ret_5() {
ret i32 5
}
/* Variables and functions */
int getpid();
int wbt_getpid() { return getpid(); }


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

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

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

LLVM IR (-O2):
define i32 @wbt_getpid() {
%1 = tail call i32 (...) @getpid()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ swe_revjul(double, int, int *, int *, int *, double *);
void revjul(double jd, int gregflag, int *jmon, int *jday, int *jyear,
            double *jut) {
  swe_revjul(jd, gregflag, jyear, jmon, jday, jut);
}


x86 assembly (clang, -O0):
<revjul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x30(%rbp),%r8
call   1030 <swe_revjul@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<revjul>:
mov    %rdx,%rax
mov    %rsi,%rdx
mov    %rcx,%rsi
mov    %rax,%rcx
jmp    1030 <swe_revjul@plt>

LLVM IR (-O0):
define void @revjul(double %0, i32 %1, i32* %2, i32* %3, i32* %4, double* %5) {
%7 = alloca double
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca double*
store double %0, double* %7
store i32 %1, i32* %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store i32* %4, i32** %11
store double* %5, double** %12
%13 = load double, double* %7
%14 = load i32, i32* %8
%15 = load i32*, i32** %11
%16 = load i32*, i32** %9
%17 = load i32*, i32** %10
%18 = load double*, double** %12
%19 = call i32 @swe_revjul(double %13, i32 %14, i32* %15, i32* %16, i32* %17, double* %18)
ret void
}

LLVM IR (-O2):
define void @revjul(double %0, i32 %1, i32* %2, i32* %3, i32* %4, double* %5) {
%7 = tail call i32 @swe_revjul(double %0, i32 %1, i32* %4, i32* %2, i32* %3, double* %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  printf("vck");
  printf("\n%d\n", (int)(2e3));
  printf("%d\n", (int)(2e3));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"vck\00"
@.str.1 = [5 x i8] c"\0A%d\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 2000)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 2000)
ret i32 0
}
/* Variables and functions */
int get_wordarr_len(char **wordarr) {
  int it;
  it = 0;
  while (wordarr[it] != NULL)
    it++;
  return (it);
}


x86 assembly (clang, -O0):
<get_wordarr_len>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1130 <get_wordarr_len+0x30>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <get_wordarr_len+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_wordarr_len>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpq   $0x0,(%rdi)
lea    0x8(%rdi),%rdi
jne    1110 <get_wordarr_len+0x10>
ret

LLVM IR (-O0):
define i32 @get_wordarr_len(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
store i8** %0, i8*** %2
store i32 0, i32* %3
br label %4
4: ; preds = %11, %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 = icmp ne i8* %9, null
br i1 %10, label %11, label %14
11: ; preds = %4
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @get_wordarr_len(i8** nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8*, i8** %0, i64 %3
%5 = load i8*, i8** %4
%6 = icmp eq i8* %5, null
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ userMain();
int main() { userMain(); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <userMain@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @userMain()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ put32(unsigned int);
int /*<<< orphan*/ put8(int);
void mov_reg32_imm32(int reg32, unsigned int imm32) {
  put8(0xB8 + reg32);
  put32(imm32);
}


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

x86 assembly (clang, -O2):
<mov_reg32_imm32>:
push   %rbx
mov    %esi,%ebx
add    $0xb8,%edi
call   1030 <put8@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <put32@plt>

LLVM IR (-O0):
define void @mov_reg32_imm32(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 = add nsw i32 184, %5
%7 = call i32 @put8(i32 %6)
%8 = load i32, i32* %4
%9 = call i32 @put32(i32 %8)
ret void
}

LLVM IR (-O2):
define void @mov_reg32_imm32(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 184
%4 = tail call i32 @put8(i32 %3)
%5 = tail call i32 @put32(i32 %1)
ret void
}
int HelpItem155(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @HelpItem155() {
ret i32 0
}

LLVM IR (-O2):
define i32 @HelpItem155() {
ret i32 0
}
void andagain(void) {
  int count, fill_value, dest;
  count = 1;
  fill_value = 2;
  dest = 0;
  asm("cld\n\t"
      "rep\n\t"
      "stosl"
      :
      : "r"(count), "r"(fill_value), "r"(dest)
      : "%ecx", "%edi");
  printf("count = %d  fill_value = %d dest = %d \n", count, fill_value, dest);
}


x86 assembly (clang, -O0):
<andagain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%esi
cld
rep stos %eax,%es:(%rdi)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<andagain>:
mov    $0x1,%eax
mov    $0x2,%edx
xor    %esi,%esi
cld
rep stos %eax,%es:(%rdi)
lea    0xeda(%rip),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
xor    %ecx,%ecx
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"count = %d fill_value = %d dest = %d \0A\00"
define void @andagain() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 1, i32* %1
store i32 2, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"count = %d fill_value = %d dest = %d \0A\00"
define void @andagain() {
tail call void asm sideeffect "cld\0A\09rep\0A\09stosl", "r,r,r,~{ecx},~{edi},~{dirflag},~{fpsr},~{flags}"(i32 1, i32 2, i32 0)
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 1, i32 2, i32 0)
ret void
}
/* Variables and functions */
int client_connect(char *);
int ocfs2_client_connect(void) { return client_connect("ocfs2_controld_sock"); }


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

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

LLVM IR (-O0):
@.str = [20 x i8] c"ocfs2_controld_sock\00"
define i32 @ocfs2_client_connect() {
%1 = call i32 @client_connect(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [20 x i8] c"ocfs2_controld_sock\00"
define i32 @ocfs2_client_connect() {
%1 = tail call i32 @client_connect(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
char decode_ch(int string_offset, int offset, char ch) {
  return (ch ^ (string_offset * 157135 + offset / 2));
}


x86 assembly (clang, -O0):
<decode_ch>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
mov    %eax,-0x10(%rbp)
imul   $0x265cf,-0x4(%rbp),%ecx
mov    -0x8(%rbp),%eax
mov    $0x2,%esi
cltd
idiv   %esi
mov    %eax,%edx
mov    -0x10(%rbp),%eax
add    %edx,%ecx
xor    %ecx,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_ch>:
imul   $0x265cf,%edi,%ecx
mov    %esi,%eax
shr    $0x1f,%eax
add    %esi,%eax
shr    %eax
add    %ecx,%eax
xor    %edx,%eax
ret

LLVM IR (-O0):
define signext i8 @decode_ch(i32 %0, i32 %1, i8 signext %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8 %2, i8* %6
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = load i32, i32* %4
%10 = mul nsw i32 %9, 157135
%11 = load i32, i32* %5
%12 = sdiv i32 %11, 2
%13 = add nsw i32 %10, %12
%14 = xor i32 %8, %13
%15 = trunc i32 %14 to i8
ret i8 %15
}

LLVM IR (-O2):
define signext i8 @decode_ch(i32 %0, i32 %1, i8 signext %2) {
%4 = mul nsw i32 %0, 157135
%5 = sdiv i32 %1, 2
%6 = add nsw i32 %5, %4
%7 = trunc i32 %6 to i8
%8 = xor i8 %7, %2
ret i8 %8
}
/* Variables and functions */
int abs(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a = 10;
  int b = 20;
  printf("%d\n", ((a + b) - abs(a - b)) / 2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xa,-0x4(%rbp)
movl   $0x14,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
sub    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 10, i32* %1
store i32 20, i32* %2
%3 = load i32, i32* %1
%4 = load i32, i32* %2
%5 = add nsw i32 %3, %4
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = sub nsw i32 %6, %7
%9 = call i32 @abs(i32 %8)
%10 = sub nsw i32 %5, %9
%11 = sdiv i32 %10, 2
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 10)
ret i32 0
}
void encode_string(unsigned char *org_str) { ; }


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

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

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

LLVM IR (-O2):
define void @encode_string(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int getfoo();
int do_test(void) { return getfoo(); }


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

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

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

LLVM IR (-O2):
define i32 @do_test() {
%1 = tail call i32 (...) @getfoo()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void reset_colors() {
  printf("%s", "\033["
               "0m");
}


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

x86 assembly (clang, -O2):
<reset_colors>:
lea    0xee9(%rip),%rdi
lea    0xee5(%rip),%rsi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"\1B[0m\00"
define void @reset_colors() {
%1 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"\1B[0m\00"
define void @reset_colors() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *strdupe(const char *s) {
  char *t = malloc(strlen(s) + 1);
  strcpy(t, s);
  return t;
}


x86 assembly (clang, -O0):
<strdupe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdupe>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strdupe(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i8* @malloc(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8*, i8** %2
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define i8* @strdupe(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Variables and functions */
int gcd(int, int);
int /*<<< orphan*/ printf(char *, int, int, int);
int main() {
  int x = 1024;
  int y = 12;
  printf("GCD(%d,%d)=%d", x, y, gcd(x, y));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x400,-0x4(%rbp)
movl   $0xc,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <gcd@plt>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    %eax,%ecx
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x400,%edi
mov    $0xc,%esi
call   1040 <gcd@plt>
lea    0xec9(%rip),%rdi
mov    $0x400,%esi
mov    $0xc,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"GCD(%d,%d)=%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 1024, i32* %1
store i32 12, i32* %2
%3 = load i32, i32* %1
%4 = load i32, i32* %2
%5 = load i32, i32* %1
%6 = load i32, i32* %2
%7 = call i32 @gcd(i32 %5, i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4, i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"GCD(%d,%d)=%d\00"
define i32 @main() {
%1 = tail call i32 @gcd(i32 1024, i32 12)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 1024, i32 12, i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void memerror() {
  printf("Error allocating memory\n");
  exit(-1);
}


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

x86 assembly (clang, -O2):
<memerror>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Error allocating memory\0A\00"
define void @memerror() {
%1 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@str = [24 x i8] c"Error allocating memory\00"
define void @memerror() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 -1)
unreachable
}
void nrf_802154_temperature_init(void) {}


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

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

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

LLVM IR (-O2):
define void @nrf_802154_temperature_init() {
ret void
}
long __syscall4(long n, long a1, long a2, long a3, long a4) {
  unsigned long ret;
  register long r10 __asm__("r10") = a4;
  __asm__ __volatile__("syscall"
                       : "=a"(ret)
                       : "a"(n), "D"(a1), "S"(a2), "d"(a3), "r"(r10)
                       : "rcx", "r11", "memory");
  return ret;
}


x86 assembly (clang, -O0):
<__syscall4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x38(%rbp),%r10
syscall
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__syscall4>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
mov    %r8,%r10
syscall
ret

LLVM IR (-O0):
define i64 @__syscall4(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
store i64 %0, i64* %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i64 %4, i64* %10
%13 = load i64, i64* %10
store i64 %13, i64* %12
%14 = load i64, i64* %6
%15 = load i64, i64* %7
%16 = load i64, i64* %8
%17 = load i64, i64* %9
%18 = load i64, i64* %12
%19 = call i64 asm sideeffect "syscall", "={ax},{ax},{di},{si},{dx},{r10},~{rcx},~{r11},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %14, i64 %15, i64 %16, i64 %17, i64 %18)
store i64 %19, i64* %11
%20 = load i64, i64* %11
ret i64 %20
}

LLVM IR (-O2):
define i64 @__syscall4(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = tail call i64 asm sideeffect "syscall", "={ax},{ax},{di},{si},{dx},{r10},~{rcx},~{r11},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4)
ret i64 %6
}
/* Variables and functions */
scalar_t__ __infer_nondet_int();
int /*<<< orphan*/ infinite_loop_bad();
void FP_loop_with_unreachable_good() {
  while (1) {
    if (__infer_nondet_int()) {
      infinite_loop_bad();
    }
  }
}


x86 assembly (clang, -O0):
<FP_loop_with_unreachable_good>:
push   %rbp
mov    %rsp,%rbp
jmp    1129 <FP_loop_with_unreachable_good+0x9>
mov    $0x0,%al
call   1030 <__infer_nondet_int@plt>
cmp    $0x0,%rax
je     1141 <FP_loop_with_unreachable_good+0x21>
mov    $0x0,%al
call   1040 <infinite_loop_bad@plt>
jmp    1129 <FP_loop_with_unreachable_good+0x9>

x86 assembly (clang, -O2):
<FP_loop_with_unreachable_good>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <__infer_nondet_int@plt>
test   %rax,%rax
je     1130 <FP_loop_with_unreachable_good+0x10>
xor    %eax,%eax
call   1040 <infinite_loop_bad@plt>
jmp    1130 <FP_loop_with_unreachable_good+0x10>

LLVM IR (-O0):
define void @FP_loop_with_unreachable_good() {
br label %1
1: ; preds = %0, %6
%2 = call i64 (...) @__infer_nondet_int()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = call i32 (...) @infinite_loop_bad()
br label %6
6: ; preds = %4, %1
br label %1
}

LLVM IR (-O2):
define void @FP_loop_with_unreachable_good() {
br label %1
1: ; preds = %6, %0
%2 = tail call i64 (...) @__infer_nondet_int()
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (...) @infinite_loop_bad()
br label %6
6: ; preds = %4, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ HwColibriHandle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void HwColibriUpdated() { UAVObjUpdated(HwColibriHandle()); }


x86 assembly (clang, -O0):
<HwColibriUpdated>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <HwColibriHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjUpdated@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<HwColibriUpdated>:
push   %rax
xor    %eax,%eax
call   1030 <HwColibriHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjUpdated@plt>

LLVM IR (-O0):
define void @HwColibriUpdated() {
%1 = call i32 (...) @HwColibriHandle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @HwColibriUpdated() {
%1 = tail call i32 (...) @HwColibriHandle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ op_write1(int);
void op_enc_dec_de(void) { op_write1(0x1b); }


x86 assembly (clang, -O0):
<op_enc_dec_de>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1b,%edi
call   1030 <op_write1@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_enc_dec_de>:
mov    $0x1b,%edi
jmp    1030 <op_write1@plt>

LLVM IR (-O0):
define void @op_enc_dec_de() {
%1 = call i32 @op_write1(i32 27)
ret void
}

LLVM IR (-O2):
define void @op_enc_dec_de() {
%1 = tail call i32 @op_write1(i32 27)
ret void
}
/* Variables and functions */
int increment(int);
int callee2(int n) {
  register int l1 = increment(n);
  register int l2 = increment(l1);
  return l1 + l2;
}


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

x86 assembly (clang, -O2):
<callee2>:
push   %rbx
call   1030 <increment@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1030 <increment@plt>
add    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @callee2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @increment(i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @increment(i32 %7)
store i32 %8, i32* %4
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = add nsw i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @callee2(i32 %0) {
%2 = tail call i32 @increment(i32 %0)
%3 = tail call i32 @increment(i32 %2)
%4 = add nsw i32 %3, %2
ret i32 %4
}
double ep2ts(epoch)
double epoch;
{
  double dj;
  dj = ep2jd(epoch);
  return ((dj - 2433282.5) * 86400.0);
}


x86 assembly (clang, -O0):
<ep2ts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x1,%al
call   1030 <ep2jd@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xec9(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xeb5(%rip),%xmm1
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ep2ts>:
push   %rax
mov    $0x1,%al
call   1030 <ep2jd@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0xed9(%rip),%xmm0
mulsd  0xed9(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @ep2ts(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call i32 (double, ...) bitcast (i32 (...)* @ep2jd to i32 (double, ...)*)(double %4)
%6 = sitofp i32 %5 to double
store double %6, double* %3
%7 = load double, double* %3
%8 = fsub double %7, 0x4142908140000000
%9 = fmul double %8, 8.640000e+04
ret double %9
}

LLVM IR (-O2):
define double @ep2ts(double %0) {
%2 = tail call i32 (double, ...) bitcast (i32 (...)* @ep2jd to i32 (double, ...)*)(double %0)
%3 = sitofp i32 %2 to double
%4 = fadd double %3, 0xC142908140000000
%5 = fmul double %4, 8.640000e+04
ret double %5
}
char *dialog_version(void) {
  return "1.0"
         "-"
         "20060221";
}


x86 assembly (clang, -O0):
<dialog_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dialog_version>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [13 x i8] c"1.0-20060221\00"
define i8* @dialog_version() {
ret i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [13 x i8] c"1.0-20060221\00"
define i8* @dialog_version() {
ret i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0)
}
int test_andonel(unsigned long b) { return __builtin_popcountl(b & 1); }


x86 assembly (clang, -O0):
<test_andonel>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
and    $0x1,%rcx
mov    %rcx,%rax
shr    %rax
movabs $0x5555555555555555,%rdx
55 55 55
and    %rdx,%rax
sub    %rax,%rcx
movabs $0x3333333333333333,%rdx
33 33 33
mov    %rcx,%rax
and    %rdx,%rax
shr    $0x2,%rcx
and    %rdx,%rcx
add    %rcx,%rax
mov    %rax,%rcx
shr    $0x4,%rcx
add    %rcx,%rax
movabs $0xf0f0f0f0f0f0f0f,%rcx
0f 0f 0f
and    %rcx,%rax
movabs $0x101010101010101,%rcx
01 01 01
imul   %rcx,%rax
shr    $0x38,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_andonel>:
mov    %rdi,%rax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @test_andonel(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 1
%5 = call i64 @llvm.ctpop.i64(i64 %4)
%6 = trunc i64 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @test_andonel(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = and i32 %2, 1
ret i32 %3
}
long int labs(long int j) { return (j < 0) ? (-j) : j; }


x86 assembly (clang, -O0):
<labs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1122 <labs+0x22>
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    112a <labs+0x2a>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @labs(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i64, i64* %2
%7 = sub nsw i64 0, %6
br label %10
8: ; preds = %1
%9 = load i64, i64* %2
br label %10
10: ; preds = %8, %5
%11 = phi i64 [ %7, %5 ], [ %9, %8 ]
ret i64 %11
}

LLVM IR (-O2):
define i64 @labs(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
ret i64 %2
}
/* Variables and functions */
int test_and_change_bit(int, void volatile *);
int sync_test_and_change_bit(int nr, volatile void *addr) {
  return test_and_change_bit(nr, addr);
}


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

x86 assembly (clang, -O2):
<sync_test_and_change_bit>:
jmp    1030 <test_and_change_bit@plt>

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

LLVM IR (-O2):
define i32 @sync_test_and_change_bit(i32 %0, i8* %1) {
%3 = tail call i32 @test_and_change_bit(i32 %0, i8* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ test_pca();
int main() {
  test_pca();
  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_pca@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_pca@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_pca()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_pca()
ret i32 0
}
/* Variables and functions */
int func5b(int);
__attribute__((gnu_)) __attribute__((always_)) int func5a(int x) {
  return func5b(x * 23);
}


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

x86 assembly (clang, -O2):
<func5a>:
lea    (%rdi,%rdi,2),%eax
shl    $0x3,%eax
sub    %edi,%eax
mov    %eax,%edi
jmp    1030 <func5b@plt>

LLVM IR (-O0):
define i32 @func5a(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 23
%5 = call i32 @func5b(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @func5a(i32 %0) {
%2 = mul nsw i32 %0, 23
%3 = tail call i32 @func5b(i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ srand(unsigned int);
void srandom(unsigned int seed) { srand(seed); }


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

x86 assembly (clang, -O2):
<srandom>:
jmp    1030 <srand@plt>

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

LLVM IR (-O2):
define void @srandom(i32 %0) {
%2 = tail call i32 @srand(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void signalHandler(int sig) { printf("Signal received\n"); }


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

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

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

LLVM IR (-O2):
@str = [16 x i8] c"Signal received\00"
define void @signalHandler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret void
}
void ptrace_sandbox_permit_query_time(struct pt_sandbox *p_sandbox) {
  (void)p_sandbox;
}


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

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

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

LLVM IR (-O2):
%struct.pt_sandbox = type opaque
define void @ptrace_sandbox_permit_query_time(%struct.pt_sandbox* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ set_io_bit(int, int /*<<< orphan*/);
void TOSH_MAKE_FLASH_SELECT_OUTPUT() { set_io_bit(0x39, 0); }


x86 assembly (clang, -O0):
<TOSH_MAKE_FLASH_SELECT_OUTPUT>:
push   %rbp
mov    %rsp,%rbp
mov    $0x39,%edi
xor    %esi,%esi
call   1030 <set_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_MAKE_FLASH_SELECT_OUTPUT>:
mov    $0x39,%edi
xor    %esi,%esi
jmp    1030 <set_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_MAKE_FLASH_SELECT_OUTPUT() {
%1 = call i32 @set_io_bit(i32 57, i32 0)
ret void
}

LLVM IR (-O2):
define void @TOSH_MAKE_FLASH_SELECT_OUTPUT() {
%1 = tail call i32 @set_io_bit(i32 57, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_memblock_new_user() {
  printf("NOT IMPLEMENTED:"
         "pa_memblock_new_user"
         "\n");
}


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

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

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

LLVM IR (-O2):
@str = [37 x i8] c"NOT IMPLEMENTED:pa_memblock_new_user\00"
define i32 @pa_memblock_new_user() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ mcsetstate(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int);
void mcgenstate(void) { mcsetstate(0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); }


x86 assembly (clang, -O0):
<mcgenstate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
xor    %r8d,%r8d
mov    $0x1,%r9d
mov    %r8d,%edi
mov    %r8d,%esi
mov    %r8d,%edx
mov    %r8d,%ecx
movl   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0x18(%rsp)
movl   $0x1,0x20(%rsp)
call   1030 <mcsetstate@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mcgenstate>:
push   %rax
sub    $0x8,%rsp
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    $0x1,%r9d
push   $0x1
push   $0x0
push   $0x0
push   $0x0
push   $0x0
call   1030 <mcsetstate@plt>
add    $0x30,%rsp
pop    %rax
ret

LLVM IR (-O0):
define void @mcgenstate() {
%1 = call i32 @mcsetstate(i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 1)
ret void
}

LLVM IR (-O2):
define void @mcgenstate() {
%1 = tail call i32 @mcsetstate(i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int setfsgid(int);
int setfsuid(int);
int main(int argc, char *argv[]) {
  printf("File system UID: %d\n", setfsuid(-1));
  printf("File system GID: %d\n", setfsgid(-1));
  exit(EXIT_SUCCESS);
}


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    $0xffffffff,%edi
call   1040 <setfsuid@plt>
mov    %eax,%esi
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <setfsgid@plt>
mov    %eax,%esi
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xffffffff,%edi
call   1040 <setfsuid@plt>
lea    0xeae(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <setfsgid@plt>
lea    0xeab(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0x2e68(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"File system UID: %d\0A\00"
@.str.1 = [21 x i8] c"File system GID: %d\0A\00"
@EXIT_SUCCESS = global i32 0
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 = call i32 @setfsuid(i32 -1)
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @setfsgid(i32 -1)
%9 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @EXIT_SUCCESS
%11 = call i32 @exit(i32 %10)
unreachable
}

LLVM IR (-O2):
@.str = [21 x i8] c"File system UID: %d\0A\00"
@.str.1 = [21 x i8] c"File system GID: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @setfsuid(i32 -1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @setfsgid(i32 -1)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @EXIT_SUCCESS
%8 = tail call i32 @exit(i32 %7)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ foobar(char *);
__attribute__((no_instrument_function)) void func(void) {
  foobar("Hello world\n");
}


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"Hello world\0A\00"
define void @func() {
%1 = call i32 @foobar(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello world\0A\00"
define void @func() {
%1 = tail call i32 @foobar(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
unsigned long CalCrcCheck(unsigned char const *, int);
unsigned long GetCRC32(const unsigned char *pData, int len) {
  return CalCrcCheck(pData, len);
}


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

x86 assembly (clang, -O2):
<GetCRC32>:
jmp    1030 <CalCrcCheck@plt>

LLVM IR (-O0):
define i64 @GetCRC32(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 i64 @CalCrcCheck(i8* %5, i32 %6)
ret i64 %7
}

LLVM IR (-O2):
define i64 @GetCRC32(i8* %0, i32 %1) {
%3 = tail call i64 @CalCrcCheck(i8* %0, i32 %1)
ret i64 %3
}
/* Type definitions */
struct rtnl_route {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ rtnl_route_put(struct rtnl_route *);
void _nl_auto_rtnl_route_fcn(struct rtnl_route **v) {
  if (*v)
    rtnl_route_put(*v);
}


x86 assembly (clang, -O0):
<_nl_auto_rtnl_route_fcn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1136 <_nl_auto_rtnl_route_fcn+0x26>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <rtnl_route_put@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_nl_auto_rtnl_route_fcn>:
mov    (%rdi),%rdi
test   %rdi,%rdi
je     111d <_nl_auto_rtnl_route_fcn+0xd>
jmp    1030 <rtnl_route_put@plt>
ret

LLVM IR (-O0):
%struct.rtnl_route = type { i32 }
define void @_nl_auto_rtnl_route_fcn(%struct.rtnl_route** %0) {
%2 = alloca %struct.rtnl_route**
store %struct.rtnl_route** %0, %struct.rtnl_route*** %2
%3 = load %struct.rtnl_route**, %struct.rtnl_route*** %2
%4 = load %struct.rtnl_route*, %struct.rtnl_route** %3
%5 = icmp ne %struct.rtnl_route* %4, null
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load %struct.rtnl_route**, %struct.rtnl_route*** %2
%8 = load %struct.rtnl_route*, %struct.rtnl_route** %7
%9 = call i32 @rtnl_route_put(%struct.rtnl_route* %8)
br label %10
10: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
%struct.rtnl_route = type { i32 }
define void @_nl_auto_rtnl_route_fcn(%struct.rtnl_route** nocapture %0) {
%2 = load %struct.rtnl_route*, %struct.rtnl_route** %0
%3 = icmp eq %struct.rtnl_route* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @rtnl_route_put(%struct.rtnl_route* %2)
br label %6
6: ; preds = %4, %1
ret void
}
long ssl23_default_timeout(void) { return (300); }


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

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

LLVM IR (-O0):
define i64 @ssl23_default_timeout() {
ret i64 300
}

LLVM IR (-O2):
define i64 @ssl23_default_timeout() {
ret i64 300
}
/* Variables and functions */
int /*<<< orphan*/ error(int, int /*<<< orphan*/, char *);
void *malloc(size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *cust_alloc(size_t size) {
  register void *value = malloc(size);
  if (value == NULL)
    error(-1, 0, "Virtual memory exhausted.");
  else
    memset(value, 0, size);
  return value;
}


x86 assembly (clang, -O0):
<cust_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116c <cust_alloc+0x3c>
mov    $0xffffffff,%edi
xor    %esi,%esi
lea    0xe9e(%rip),%rdx
call   1050 <error@plt>
jmp    117b <cust_alloc+0x4b>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cust_alloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1153 <cust_alloc+0x23>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1030 <memset@plt>
jmp    1166 <cust_alloc+0x36>
lea    0xea6(%rip),%rdx
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1050 <error@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Virtual memory exhausted.\00"
define i8* @cust_alloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @error(i32 -1, i32 0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %14
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = load i64, i64* %2
%13 = call i32 @memset(i8* %11, i32 0, i64 %12)
br label %14
14: ; preds = %10, %8
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
@.str = [26 x i8] c"Virtual memory exhausted.\00"
define i8* @cust_alloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @error(i32 -1, i32 0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %8
6: ; preds = %1
%7 = tail call i32 @memset(i8* %2, i32 0, i64 %0)
br label %8
8: ; preds = %6, %4
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ translit_text(char *, int, char, char);
void newline_to_nul(char *s, int len) { translit_text(s, len, '\n', '\0'); }


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

x86 assembly (clang, -O2):
<newline_to_nul>:
mov    $0xa,%edx
xor    %ecx,%ecx
jmp    1030 <translit_text@plt>

LLVM IR (-O0):
define void @newline_to_nul(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 @translit_text(i8* %5, i32 %6, i8 signext 10, i8 signext 0)
ret void
}

LLVM IR (-O2):
define void @newline_to_nul(i8* %0, i32 %1) {
%3 = tail call i32 @translit_text(i8* %0, i32 %1, i8 signext 10, i8 signext 0)
ret void
}