xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint64_t;
typedef scalar_t__ time_t;

/* Variables and functions */
time_t calcTime(time_t inTime) {
  return ((time_t)(((uint64_t)inTime - 621355968000000000) / 10000000));
}


x86 assembly (clang, -O0):
<calcTime>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cltq
movabs $0x89f7ff5f7b58000,%rcx
7f 9f 08
sub    %rcx,%rax
mov    $0x989680,%ecx
cqto
idiv   %rcx
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcTime>:
movslq %edi,%rcx
movabs $0x89f7ff5f7b58000,%rax
7f 9f 08
sub    %rcx,%rax
movabs $0xd6bf94d5e57a42bd,%rcx
94 bf d6
mul    %rcx
mov    %rdx,%rax
shr    $0x17,%rax
neg    %rax
ret

LLVM IR (-O0):
define i64 @calcTime(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = sext i32 %4 to i64
%6 = sub nsw i64 %5, 621355968000000000
%7 = sdiv i64 %6, 10000000
ret i64 %7
}

LLVM IR (-O2):
define i64 @calcTime(i64 %0) {
%2 = shl i64 %0, 32
%3 = ashr exact i64 %2, 32
%4 = sub nsw i64 621355968000000000, %3
%5 = udiv i64 %4, 10000000
%6 = sub nsw i64 0, %5
ret i64 %6
}
/* Variables and functions */
int fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int f_red() { return fputs("[31m", stdout); }


x86 assembly (clang, -O0):
<f_red>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_red>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"\1B[31m\00"
@stdout = global i32 0
define i32 @f_red() {
%1 = load i32, i32* @stdout
%2 = call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[31m\00"
@stdout = global i32 0
define i32 @f_red() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %2
}
/* Type definitions */
struct stat {
  int st_size;
};

/* Variables and functions */
int stat(char *, struct stat *);
int get_file_size(char *fpath) {
  struct stat statbuf;
  if (stat(fpath, &statbuf) == -1) {
    return 0;
  }
  return statbuf.st_size;
}


x86 assembly (clang, -O0):
<get_file_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0xffffffff,%eax
jne    113e <get_file_size+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    1144 <get_file_size+0x34>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_file_size>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
je     1125 <get_file_size+0x15>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @get_file_size(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @stat(i8* %5, %struct.stat* %4)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %12
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%11 = load i32, i32* %10
store i32 %11, i32* %2
br label %12
12: ; preds = %9, %8
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @get_file_size(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i32 %4, -1
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%7 = load i32, i32* %6
%8 = select i1 %5, i32 0, i32 %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
void ft_putnchr_fd(char c, unsigned int n, int fd) {
  while (n > 0) {
    write(fd, &c, 1);
    n--;
  }
}


x86 assembly (clang, -O0):
<ft_putnchr_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jbe    114d <ft_putnchr_fd+0x3d>
mov    -0xc(%rbp),%edi
lea    -0x1(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <ft_putnchr_fd+0x14>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnchr_fd>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %dil,0xf(%rsp)
test   %esi,%esi
je     1144 <ft_putnchr_fd+0x34>
mov    %edx,%ebx
mov    %esi,%ebp
lea    0xf(%rsp),%r14
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0xffffffff,%ebp
jne    1130 <ft_putnchr_fd+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @ft_putnchr_fd(i8 signext %0, i32 %1, i32 %2) {
%4 = alloca i8
store i8 %0, i8* %4
%5 = icmp eq i32 %1, 0
br i1 %5, label %11, label %6
6: ; preds = %3, %6
%7 = phi i32 [ %9, %6 ], [ %1, %3 ]
%8 = call i32 @write(i32 %2, i8* %4, i32 1)
%9 = add i32 %7, -1
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %6
11: ; preds = %6, %3
ret void
}
void BIO_gets(void) {}


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

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

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

LLVM IR (-O2):
define void @BIO_gets() {
ret void
}
void delay(int r0) {
  volatile int count = r0;
  while (count--)
    ;
}


x86 assembly (clang, -O0):
<delay>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1126 <delay+0x26>
jmp    110d <delay+0xd>
pop    %rbp
ret

x86 assembly (clang, -O2):
<delay>:
mov    %edi,-0x4(%rsp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
subl   $0x1,-0x4(%rsp)
jae    1110 <delay+0x10>
ret

LLVM IR (-O0):
define void @delay(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
store volatile i32 %4, i32* %3
br label %5
5: ; preds = %9, %1
%6 = load volatile i32, i32* %3
%7 = add nsw i32 %6, -1
store volatile i32 %7, i32* %3
%8 = icmp ne i32 %6, 0
br i1 %8, label %9, label %10
9: ; preds = %5
br label %5
10: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @delay(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store volatile i32 %0, i32* %2
br label %4
4: ; preds = %4, %1
%5 = load volatile i32, i32* %2
%6 = add nsw i32 %5, -1
store volatile i32 %6, i32* %2
%7 = icmp eq i32 %5, 0
br i1 %7, label %8, label %4
8: ; preds = %4
ret void
}
int l3mdev_master_ifindex_rcu(const struct net_device *dev) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.net_device = type opaque
define i32 @l3mdev_master_ifindex_rcu(%struct.net_device* nocapture readnone %0) {
ret i32 0
}
int test_imm_45uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x45 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_45uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 4521984
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int mycli();
int /*<<< orphan*/ mysti(int);
unsigned long remque(void *entry, void *addr) {
  int flag = mycli();
  *(void **)(*(void **)(entry + 8)) = *(void **)entry;
  *(void **)((*(void **)entry) + 8) = *(void **)(entry + 8);
  addr = entry;
  mysti(flag);
  return (unsigned long)addr;
}


x86 assembly (clang, -O0):
<remque>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <mycli@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rcx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rcx,0x8(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <mysti@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remque>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <mycli@plt>
mov    (%rbx),%rcx
mov    0x8(%rbx),%rdx
mov    %rcx,(%rdx)
mov    (%rbx),%rcx
mov    0x8(%rbx),%rdx
mov    %rdx,0x8(%rcx)
mov    %eax,%edi
call   1030 <mysti@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @remque(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = call i32 (...) @mycli()
store i32 %6, i32* %5
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i8**
%9 = load i8*, i8** %8
%10 = load i8*, i8** %3
%11 = getelementptr i8, i8* %10, i64 8
%12 = bitcast i8* %11 to i8**
%13 = load i8*, i8** %12
%14 = bitcast i8* %13 to i8**
store i8* %9, i8** %14
%15 = load i8*, i8** %3
%16 = getelementptr i8, i8* %15, i64 8
%17 = bitcast i8* %16 to i8**
%18 = load i8*, i8** %17
%19 = load i8*, i8** %3
%20 = bitcast i8* %19 to i8**
%21 = load i8*, i8** %20
%22 = getelementptr i8, i8* %21, i64 8
%23 = bitcast i8* %22 to i8**
store i8* %18, i8** %23
%24 = load i8*, i8** %3
store i8* %24, i8** %4
%25 = load i32, i32* %5
%26 = call i32 @mysti(i32 %25)
%27 = load i8*, i8** %4
%28 = ptrtoint i8* %27 to i64
ret i64 %28
}

LLVM IR (-O2):
define i64 @remque(i8* %0, i8* nocapture readnone %1) {
%3 = tail call i32 (...) @mycli()
%4 = bitcast i8* %0 to i8**
%5 = load i8*, i8** %4
%6 = getelementptr i8, i8* %0, i64 8
%7 = bitcast i8* %6 to i8**
%8 = bitcast i8* %6 to i8***
%9 = load i8**, i8*** %8
store i8* %5, i8** %9
%10 = load i8*, i8** %7
%11 = load i8*, i8** %4
%12 = getelementptr i8, i8* %11, i64 8
%13 = bitcast i8* %12 to i8**
store i8* %10, i8** %13
%14 = tail call i32 @mysti(i32 %3)
%15 = ptrtoint i8* %0 to i64
ret i64 %15
}
/* Variables and functions */
int /*<<< orphan*/ printk(char *, char *);
void output_banner(void) { printk("%s", "\n\nOldland CPU Kernel\n\n"); }


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

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

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [23 x i8] c"\0A\0AOldland CPU Kernel\0A\0A\00"
define void @output_banner() {
%1 = call i32 @printk(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [23 x i8] c"\0A\0AOldland CPU Kernel\0A\0A\00"
define void @output_banner() {
%1 = tail call i32 @printk(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void show(int i) { printf("%d I AM LIB1\n", i); }


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

x86 assembly (clang, -O2):
<show>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"%d I AM LIB1\0A\00"
define void @show(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%d I AM LIB1\0A\00"
define void @show(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
char *strrchr(char const *, char);
const char *tail(const char *path) {
  const char *slash = strrchr(path, '/');
  if (slash == NULL)
    return path;
  else
    return ++slash;
}


x86 assembly (clang, -O0):
<tail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1146 <tail+0x36>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1156 <tail+0x46>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tail>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @tail(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strrchr(i8* %5, i8 signext 47)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i8*, i8** %3
store i8* %10, i8** %2
br label %14
11: ; preds = %1
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %4
store i8* %13, i8** %2
br label %14
14: ; preds = %11, %9
%15 = load i8*, i8** %2
ret i8* %15
}

LLVM IR (-O2):
define i8* @tail(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
/* Variables and functions */
void *malloc(size_t);
void *memcpy(void *, void const *, size_t);
void *memdup(const void *segment, size_t size) {
  void *r = malloc(size);
  return r == NULL ? NULL : memcpy(r, segment, size);
}


x86 assembly (clang, -O0):
<memdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1153 <memdup+0x33>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    1170 <memdup+0x50>
mov    -0x18(%rbp),%rdi
mov    %rdi,-0x28(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memdup>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1149 <memdup+0x29>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @memdup(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = call i8* @malloc(i64 %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %11
10: ; preds = %2
br label %15
11: ; preds = %2
%12 = load i8*, i8** %5
%13 = load i8*, i8** %3
%14 = load i64, i64* %4
br label %15
15: ; preds = %11, %10
%16 = phi i8* [ null, %10 ], [ %12, %11 ]
ret i8* %16
}

LLVM IR (-O2):
define noalias i8* @memdup(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @malloc(i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %6, label %5
5: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %3, i8* align 1 %0, i64 %1, i1 false)
br label %6
6: ; preds = %2, %5
ret i8* %3
}
const int sign_extend(int val, unsigned bits) {
  return (val << ((8 * sizeof(int)) - bits)) >> ((8 * sizeof(int)) - bits);
}


x86 assembly (clang, -O0):
<sign_extend>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    %ecx,%edx
mov    $0x20,%ecx
sub    %rdx,%rcx
shl    %cl,%eax
mov    -0x8(%rbp),%ecx
mov    %ecx,%edx
mov    $0x20,%ecx
sub    %rdx,%rcx
sar    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sign_extend>:
mov    %esi,%ecx
mov    %edi,%eax
neg    %cl
shl    %cl,%eax
sar    %cl,%eax
ret

LLVM IR (-O0):
define i32 @sign_extend(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = zext i32 %6 to i64
%8 = sub i64 32, %7
%9 = trunc i64 %8 to i32
%10 = shl i32 %5, %9
%11 = load i32, i32* %4
%12 = zext i32 %11 to i64
%13 = sub i64 32, %12
%14 = trunc i64 %13 to i32
%15 = ashr i32 %10, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @sign_extend(i32 %0, i32 %1) {
%3 = sub i32 32, %1
%4 = shl i32 %0, %3
%5 = ashr i32 %4, %3
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ bark();
void tootsie_roll() { bark(); }


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

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

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

LLVM IR (-O2):
define void @tootsie_roll() {
%1 = tail call i32 (...) @bark()
ret void
}
/* Variables and functions */
int sk_send(int, char *, int);
int srv_sendping(int sock, int ssl) {
  return sk_send(
      sock, "<iq type='get' id='1003'><ping xmlns='urn:xmpp:ping'/></iq>", ssl);
}


x86 assembly (clang, -O0):
<srv_sendping>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
lea    0xed5(%rip),%rsi
call   1030 <sk_send@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<srv_sendping>:
mov    %esi,%edx
lea    0xee7(%rip),%rsi
jmp    1030 <sk_send@plt>

LLVM IR (-O0):
@.str = [60 x i8] c"<iq type='get' id='1003'><ping xmlns='urn:xmpp:ping'/></iq>\00"
define i32 @srv_sendping(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @sk_send(i32 %5, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 %7
}

LLVM IR (-O2):
@.str = [60 x i8] c"<iq type='get' id='1003'><ping xmlns='urn:xmpp:ping'/></iq>\00"
define i32 @srv_sendping(i32 %0, i32 %1) {
%3 = tail call i32 @sk_send(i32 %0, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print(int a, char c) { printf("hello world\n"); }


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"hello world\00"
define void @print(i32 %0, i8 signext %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
const char *ls_cost_nm8_name_out(int i) {
  switch (i) {
  case 0:
    return "o0";
  case 1:
    return "o1";
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<ls_cost_nm8_name_out>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     112b <ls_cost_nm8_name_out+0x2b>
jmp    111a <ls_cost_nm8_name_out+0x1a>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     113b <ls_cost_nm8_name_out+0x3b>
jmp    114b <ls_cost_nm8_name_out+0x4b>
lea    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <ls_cost_nm8_name_out+0x53>
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <ls_cost_nm8_name_out+0x53>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_cost_nm8_name_out>:
xor    %ecx,%ecx
cmp    $0x1,%edi
lea    0xef7(%rip),%rax
cmove  %rax,%rcx
test   %edi,%edi
lea    0xee7(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"o0\00"
@.str.1 = [3 x i8] c"o1\00"
define i8* @ls_cost_nm8_name_out(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 0, label %5
i32 1, label %6
]
5: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2
br label %8
6: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %8
7: ; preds = %1
store i8* null, i8** %2
br label %8
8: ; preds = %7, %6, %5
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [3 x i8] c"o0\00"
@.str.1 = [3 x i8] c"o1\00"
define i8* @ls_cost_nm8_name_out(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* null
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ assert(void *);
int strcmp(char const *, char const *);
int dict_key_cmp_string(void *key1, void *key2) {
  assert(key1);
  assert(key2);
  return strcmp((const char *)key1, (const char *)key2);
}


x86 assembly (clang, -O0):
<dict_key_cmp_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dict_key_cmp_string>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <assert@plt>
mov    %r14,%rdi
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @dict_key_cmp_string(i8* %0, i8* %1) {
%3 = tail call i32 @assert(i8* %0)
%4 = tail call i32 @assert(i8* %1)
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %5
}
/* Type definitions */
struct timespec {
  scalar_t__ tv_sec;
  scalar_t__ tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
double MPI_Wtime(void) {
  struct timespec t;
  clock_gettime(CLOCK_REALTIME, &t);
  return (1e-9 * (double)t.tv_nsec + (double)t.tv_sec);
}


x86 assembly (clang, -O0):
<MPI_Wtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
cvtsi2sdq -0x8(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
movsd  0xec2(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MPI_Wtime>:
sub    $0x18,%rsp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
cvtsi2sdq 0x10(%rsp),%xmm0
cvtsi2sdq 0x8(%rsp),%xmm1
mulsd  0xec3(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
@CLOCK_REALTIME = global i32 0
define double @MPI_Wtime() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_REALTIME
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = call double @llvm.fmuladd.f64(double 1.000000e-09, double %6, double %9)
ret double %10
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
@CLOCK_REALTIME = global i32 0
define double @MPI_Wtime() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_REALTIME
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%6 = load i64, i64* %5
%7 = sitofp i64 %6 to double
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%9 = load i64, i64* %8
%10 = sitofp i64 %9 to double
%11 = call double @llvm.fmuladd.f64(double %7, double 1.000000e-09, double %10)
ret double %11
}
int number_of_choice(int *tab) {
  int cpt = 0;
  for (int i = 0; i < 7; i++) {
    if (tab[i] == 1) {
      cpt++;
    }
  }
  return cpt;
}


x86 assembly (clang, -O0):
<number_of_choice>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x7,-0x10(%rbp)
jge    114e <number_of_choice+0x4e>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    113b <number_of_choice+0x3b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1140 <number_of_choice+0x40>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <number_of_choice+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<number_of_choice>:
movdqu (%rdi),%xmm0
xor    %r8d,%r8d
cmpl   $0x1,0x10(%rdi)
sete   %r8b
xor    %edx,%edx
cmpl   $0x1,0x14(%rdi)
sete   %dl
xor    %esi,%esi
cmpl   $0x1,0x18(%rdi)
pcmpeqd 0xeda(%rip),%xmm0
sete   %sil
movmskps %xmm0,%eax
mov    %eax,%ecx
shr    %cl
and    $0x5,%cl
sub    %cl,%al
mov    %eax,%ecx
and    $0x33,%cl
shr    $0x2,%al
and    $0x33,%al
add    %cl,%al
mov    %eax,%ecx
shr    $0x4,%cl
add    %al,%cl
and    $0xf,%cl
movzbl %cl,%eax
add    %r8d,%eax
add    %edx,%eax
add    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @number_of_choice(i32* nocapture %0) {
%2 = bitcast i32* %0 to <4 x i32>*
%3 = load <4 x i32>, <4 x i32>* %2
%4 = icmp eq <4 x i32> %3, <i32 1, i32 1, i32 1, i32 1>
%5 = getelementptr inbounds i32, i32* %0, i64 4
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 1
%8 = zext i1 %7 to i32
%9 = getelementptr inbounds i32, i32* %0, i64 5
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 1
%12 = zext i1 %11 to i32
%13 = getelementptr inbounds i32, i32* %0, i64 6
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 1
%16 = zext i1 %15 to i32
%17 = bitcast <4 x i1> %4 to i4
%18 = call i4 @llvm.ctpop.i4(i4 %17)
%19 = zext i4 %18 to i32
%20 = add nuw nsw i32 %19, %8
%21 = add nuw nsw i32 %20, %12
%22 = add nuw nsw i32 %21, %16
ret i32 %22
}
void deck_swap(struct Card **a, struct Card **b) {
  struct Card *c = *a;
  *a = *b;
  *b = c;
}


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

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

LLVM IR (-O0):
%struct.Card = type opaque
define void @deck_swap(%struct.Card** %0, %struct.Card** %1) {
%3 = alloca %struct.Card**
%4 = alloca %struct.Card**
%5 = alloca %struct.Card*
store %struct.Card** %0, %struct.Card*** %3
store %struct.Card** %1, %struct.Card*** %4
%6 = load %struct.Card**, %struct.Card*** %3
%7 = load %struct.Card*, %struct.Card** %6
store %struct.Card* %7, %struct.Card** %5
%8 = load %struct.Card**, %struct.Card*** %4
%9 = load %struct.Card*, %struct.Card** %8
%10 = load %struct.Card**, %struct.Card*** %3
store %struct.Card* %9, %struct.Card** %10
%11 = load %struct.Card*, %struct.Card** %5
%12 = load %struct.Card**, %struct.Card*** %4
store %struct.Card* %11, %struct.Card** %12
ret void
}

LLVM IR (-O2):
%struct.Card = type opaque
define void @deck_swap(%struct.Card** nocapture %0, %struct.Card** nocapture %1) {
%3 = load %struct.Card*, %struct.Card** %0
%4 = load %struct.Card*, %struct.Card** %1
store %struct.Card* %4, %struct.Card** %0
store %struct.Card* %3, %struct.Card** %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void sigint_handler(int sig) {
  printf("Received SIGINT signal, waiting...\n");
  sleep(5);
  printf("Leaving SIGINT handler\n");
}


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

x86 assembly (clang, -O2):
<sigint_handler>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x5,%edi
call   1040 <sleep@plt>
lea    0xee5(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"Received SIGINT signal, waiting...\0A\00"
@.str.1 = [24 x i8] c"Leaving SIGINT handler\0A\00"
define void @sigint_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @sleep(i32 5)
%5 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [35 x i8] c"Received SIGINT signal, waiting...\00"
@str.2 = [23 x i8] c"Leaving SIGINT handler\00"
define void @sigint_handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @sleep(i32 5)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.2, i64 0, i64 0))
ret void
}
void sdbtMarkDeleted(void *record) { ((char *)record)[0] = ';'; }


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

x86 assembly (clang, -O2):
<sdbtMarkDeleted>:
movb   $0x3b,(%rdi)
ret

LLVM IR (-O0):
define void @sdbtMarkDeleted(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
store i8 59, i8* %4
ret void
}

LLVM IR (-O2):
define void @sdbtMarkDeleted(i8* nocapture writeonly %0) {
store i8 59, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ default_isr();
__attribute__((weak)) void SRC_IN_Handler() { default_isr(); }


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

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

LLVM IR (-O0):
define weak void @SRC_IN_Handler() {
%1 = call i32 (...) @default_isr()
ret void
}

LLVM IR (-O2):
define weak void @SRC_IN_Handler() {
%1 = tail call i32 (...) @default_isr()
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t lsrl63(uint64_t x) { return x >> 63; }


x86 assembly (clang, -O0):
<lsrl63>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3f,%ecx
sar    %cl,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @lsrl63(i32 %0) {
ret i32 poison
}
void trivial() {
  int a[10];
  a[10] = 0;
}


x86 assembly (clang, -O0):
<trivial>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @trivial() {
%1 = alloca [10 x i32]
%2 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 10
store i32 0, i32* %2
ret void
}

LLVM IR (-O2):
define void @trivial() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CILK_MB();
void Cilk_fence(void) { CILK_MB(); }


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

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

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

LLVM IR (-O2):
define void @Cilk_fence() {
%1 = tail call i32 (...) @CILK_MB()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AND_HOST_REG_L(int, int);
int /*<<< orphan*/ addbyte(int);
int TEST_HOST_REG_L(int dst_reg, int src_reg) {
  if (dst_reg & 8) {
    addbyte(0x44);
    addbyte(0x89);
    addbyte(0xc0 | ((dst_reg & 7) << 3) | 2);
    dst_reg = 2;
  }
  AND_HOST_REG_L(dst_reg, src_reg);
  return dst_reg;
}


x86 assembly (clang, -O0):
<TEST_HOST_REG_L>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     116f <TEST_HOST_REG_L+0x4f>
mov    $0x44,%edi
call   1040 <addbyte@plt>
mov    $0x89,%edi
call   1040 <addbyte@plt>
mov    -0x4(%rbp),%edi
and    $0x7,%edi
shl    $0x3,%edi
or     $0xc0,%edi
or     $0x2,%edi
call   1040 <addbyte@plt>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <AND_HOST_REG_L@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TEST_HOST_REG_L>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
test   $0x8,%bpl
je     1158 <TEST_HOST_REG_L+0x38>
mov    $0x44,%edi
call   1040 <addbyte@plt>
mov    $0x89,%edi
call   1040 <addbyte@plt>
shl    $0x3,%ebp
or     $0xc2,%ebp
movzbl %bpl,%edi
call   1040 <addbyte@plt>
mov    $0x2,%ebp
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <AND_HOST_REG_L@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @TEST_HOST_REG_L(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, 8
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %17
8: ; preds = %2
%9 = call i32 @addbyte(i32 68)
%10 = call i32 @addbyte(i32 137)
%11 = load i32, i32* %3
%12 = and i32 %11, 7
%13 = shl i32 %12, 3
%14 = or i32 192, %13
%15 = or i32 %14, 2
%16 = call i32 @addbyte(i32 %15)
store i32 2, i32* %3
br label %17
17: ; preds = %8, %2
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = call i32 @AND_HOST_REG_L(i32 %18, i32 %19)
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @TEST_HOST_REG_L(i32 %0, i32 %1) {
%3 = and i32 %0, 8
%4 = icmp eq i32 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %2
%6 = tail call i32 @addbyte(i32 68)
%7 = tail call i32 @addbyte(i32 137)
%8 = shl i32 %0, 3
%9 = and i32 %8, 56
%10 = or i32 %9, 194
%11 = tail call i32 @addbyte(i32 %10)
br label %12
12: ; preds = %5, %2
%13 = phi i32 [ 2, %5 ], [ %0, %2 ]
%14 = tail call i32 @AND_HOST_REG_L(i32 %13, i32 %1)
ret i32 %13
}
/* Variables and functions */
bool letter(char c) {
  if ((c > 64 && c < 91) || (c > 96 && c < 123))
    return (true);
  else
    return (false);
}


x86 assembly (clang, -O0):
<letter>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x40,%eax
jle    1124 <letter+0x24>
movsbl -0x5(%rbp),%eax
cmp    $0x5b,%eax
jl     113e <letter+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0x60,%eax
jle    114a <letter+0x4a>
movsbl -0x5(%rbp),%eax
cmp    $0x7b,%eax
jge    114a <letter+0x4a>
movl   $0x1,-0x4(%rbp)
jmp    1151 <letter+0x51>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<letter>:
and    $0xdf,%dil
add    $0xbf,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @letter(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sgt i32 %5, 64
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp slt i32 %9, 91
br i1 %10, label %19, label %11
11: ; preds = %7, %1
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = icmp sgt i32 %13, 96
br i1 %14, label %15, label %20
15: ; preds = %11
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = icmp slt i32 %17, 123
br i1 %18, label %19, label %20
19: ; preds = %15, %7
store i32 1, i32* %2
br label %21
20: ; preds = %15, %11
store i32 0, i32* %2
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
define i32 @letter(i8 signext %0) {
%2 = and i8 %0, -33
%3 = add i8 %2, -65
%4 = icmp ult i8 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
long floatBits(float y) { return (*(long *)&(y)); }


x86 assembly (clang, -O0):
<floatBits>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    -0x4(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<floatBits>:
movss  %xmm0,-0x8(%rsp)
mov    -0x8(%rsp),%rax
ret

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

LLVM IR (-O2):
define i64 @floatBits(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = bitcast float* %2 to i64*
%4 = load i64, i64* %3
ret i64 %4
}
int batadv_bla_is_backbone_gw(struct sk_buff *skb,
                              struct batadv_orig_node *orig_node,
                              int hdr_size) {
  return 0;
}


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

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

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

LLVM IR (-O2):
%struct.sk_buff = type opaque
%struct.batadv_orig_node = type opaque
define i32 @batadv_bla_is_backbone_gw(%struct.sk_buff* nocapture readnone %0, %struct.batadv_orig_node* nocapture readnone %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
int /*<<< orphan*/ oom();
char *grab_str(const char *sp, const char *ep) {
  size_t len = ep - sp;
  char *s = malloc(len + 1);
  if (!s)
    oom();
  memcpy(s, sp, len);
  s[len] = '\0';
  return s;
}


x86 assembly (clang, -O0):
<grab_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1172 <grab_str+0x42>
mov    $0x0,%al
call   1030 <oom@plt>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<grab_str>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
sub    %rdi,%rbx
lea    0x1(%rbx),%rdi
call   1050 <malloc@plt>
mov    %rax,%r15
test   %rax,%rax
jne    1156 <grab_str+0x26>
xor    %eax,%eax
call   1030 <oom@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <memcpy@plt>
movb   $0x0,(%r15,%rbx,1)
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @grab_str(i8* %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = ptrtoint i8* %0 to i64
%5 = sub i64 %3, %4
%6 = add i64 %5, 1
%7 = tail call i8* @malloc(i64 %6)
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 (...) @oom()
br label %11
11: ; preds = %9, %2
%12 = tail call i32 @memcpy(i8* %7, i8* %0, i64 %5)
%13 = getelementptr inbounds i8, i8* %7, i64 %5
store i8 0, i8* %13
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdout;
void *myMalloc(int size, int info) {
  void *t = (void *)malloc(size);
  if (!t) {
    printf("\nMemory allocation error [%d]", info);
    fflush(stdout);
    exit(0);
  }
  return t;
}


x86 assembly (clang, -O0):
<myMalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1189 <myMalloc+0x49>
mov    -0x8(%rbp),%esi
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
xor    %edi,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myMalloc>:
push   %rbx
mov    %esi,%ebx
call   1040 <malloc@plt>
test   %rax,%rax
je     114f <myMalloc+0xf>
pop    %rbx
ret
lea    0xeaa(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"\0AMemory allocation error [%d]\00"
@stdout = global i32 0
define i8* @myMalloc(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %17, label %11
11: ; preds = %2
%12 = load i32, i32* %4
%13 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i32, i32* @stdout
%15 = call i32 @fflush(i32 %14)
%16 = call i32 @exit(i32 0)
unreachable
17: ; preds = %2
%18 = load i8*, i8** %5
ret i8* %18
}

LLVM IR (-O2):
@.str = [30 x i8] c"\0AMemory allocation error [%d]\00"
@stdout = global i32 0
define i8* @myMalloc(i32 %0, i32 %1) {
%3 = tail call i64 @malloc(i32 %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %1)
%7 = load i32, i32* @stdout
%8 = tail call i32 @fflush(i32 %7)
%9 = tail call i32 @exit(i32 0)
unreachable
10: ; preds = %2
%11 = inttoptr i64 %3 to i8*
ret i8* %11
}
float clamp(float min, float value, float max) {
  if (value <= min) {
    return min;
  }
  if (value >= max) {
    return max;
  }
  return value;
}


x86 assembly (clang, -O0):
<clamp>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  -0xc(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     1135 <clamp+0x35>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    115d <clamp+0x5d>
movss  -0xc(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jb     1153 <clamp+0x53>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    115d <clamp+0x5d>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp>:
movaps %xmm2,%xmm3
cmpless %xmm1,%xmm3
andps  %xmm3,%xmm2
andnps %xmm1,%xmm3
orps   %xmm2,%xmm3
cmpnless %xmm0,%xmm1
andps  %xmm1,%xmm3
andnps %xmm0,%xmm1
orps   %xmm1,%xmm3
movaps %xmm3,%xmm0
ret

LLVM IR (-O0):
define float @clamp(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
%8 = load float, float* %6
%9 = load float, float* %5
%10 = fcmp ole float %8, %9
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = load float, float* %5
store float %12, float* %4
br label %21
13: ; preds = %3
%14 = load float, float* %6
%15 = load float, float* %7
%16 = fcmp oge float %14, %15
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = load float, float* %7
store float %18, float* %4
br label %21
19: ; preds = %13
%20 = load float, float* %6
store float %20, float* %4
br label %21
21: ; preds = %19, %17, %11
%22 = load float, float* %4
ret float %22
}

LLVM IR (-O2):
define float @clamp(float %0, float %1, float %2) {
%4 = fcmp ugt float %1, %0
%5 = fcmp oge float %1, %2
%6 = select i1 %5, float %2, float %1
%7 = select i1 %4, float %6, float %0
ret float %7
}
/* Variables and functions */
int rtl_imsgRemoveToType(void *, void *, int, int);
int rtl_imsgRemoveTo(void *piq, void *to) {
  return rtl_imsgRemoveToType(piq, to, -1, -1);
}


x86 assembly (clang, -O0):
<rtl_imsgRemoveTo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0xffffffff,%ecx
mov    %ecx,%edx
call   1030 <rtl_imsgRemoveToType@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtl_imsgRemoveTo>:
mov    $0xffffffff,%edx
mov    $0xffffffff,%ecx
jmp    1030 <rtl_imsgRemoveToType@plt>

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

LLVM IR (-O2):
define i32 @rtl_imsgRemoveTo(i8* %0, i8* %1) {
%3 = tail call i32 @rtl_imsgRemoveToType(i8* %0, i8* %1, i32 -1, i32 -1)
ret i32 %3
}