xunge/DecIR huggingface dataset:
int mdt_hsm_coordinator_update(struct mdt_thread_info *info,
                               struct hsm_progress_kernel *pgs) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.mdt_thread_info = type opaque
%struct.hsm_progress_kernel = type opaque
define i32 @mdt_hsm_coordinator_update(%struct.mdt_thread_info* %0, %struct.hsm_progress_kernel* %1) {
%3 = alloca %struct.mdt_thread_info*
%4 = alloca %struct.hsm_progress_kernel*
store %struct.mdt_thread_info* %0, %struct.mdt_thread_info** %3
store %struct.hsm_progress_kernel* %1, %struct.hsm_progress_kernel** %4
ret i32 0
}

LLVM IR (-O2):
%struct.mdt_thread_info = type opaque
%struct.hsm_progress_kernel = type opaque
define i32 @mdt_hsm_coordinator_update(%struct.mdt_thread_info* nocapture readnone %0, %struct.hsm_progress_kernel* nocapture readnone %1) {
ret i32 0
}
int f(int x) {
  if (x)
    return f(x + 1);
  else
    return x;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1138 <f+0x28>
mov    -0x8(%rbp),%edi
add    $0x1,%edi
call   1030 <f@plt>
mov    %eax,-0x4(%rbp)
jmp    113e <f+0x2e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @f(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
char *valor(float);
main() {
  float dimdim;
  printf("Insira um valor limitado a 999milhoes, insira os centavos com 2 "
         "casas de precisao: ");
  scanf("%f", &dimdim);
  printf("Voce inseriu o valor de:\n%s\n\n", valor(dimdim));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf07(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x4(%rbp),%xmm0
call   1050 <valor@plt>
mov    %rax,%rsi
lea    0xeed(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf0e(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
call   1050 <valor@plt>
lea    0xef5(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [84 x i8] c"Insira um valor limitado a 999milhoes, insira os centavos com 2 casas de precisao: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [30 x i8] c"Voce inseriu o valor de:\0A%s\0A\0A\00"
define i32 @main() {
%1 = alloca float
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%4 = load float, float* %1
%5 = call i8* @valor(float %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [84 x i8] c"Insira um valor limitado a 999milhoes, insira os centavos com 2 casas de precisao: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [30 x i8] c"Voce inseriu o valor de:\0A%s\0A\0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = call i8* @valor(float %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %6)
ret i32 0
}
/* Type definitions */
struct dbuf_s {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int dbuf_prepend(struct dbuf_s *, char const *, size_t);
size_t strlen(char const *);
int dbuf_prepend_str(struct dbuf_s *dbuf, const char *str) {
  size_t len;
  assert(str != NULL);
  len = strlen(str);
  return (dbuf_prepend(dbuf, str, len));
}


x86 assembly (clang, -O0):
<dbuf_prepend_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <dbuf_prepend@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbuf_prepend_str>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %edi,%edi
test   %rsi,%rsi
setne  %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <dbuf_prepend@plt>

LLVM IR (-O0):
%struct.dbuf_s = type { i32 }
define i32 @dbuf_prepend_str(%struct.dbuf_s* %0, i8* %1) {
%3 = alloca %struct.dbuf_s*
%4 = alloca i8*
%5 = alloca i64
store %struct.dbuf_s* %0, %struct.dbuf_s** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = icmp ne i8* %6, null
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i8*, i8** %4
%11 = call i64 @strlen(i8* %10)
store i64 %11, i64* %5
%12 = load %struct.dbuf_s*, %struct.dbuf_s** %3
%13 = load i8*, i8** %4
%14 = load i64, i64* %5
%15 = call i32 @dbuf_prepend(%struct.dbuf_s* %12, i8* %13, i64 %14)
ret i32 %15
}

LLVM IR (-O2):
%struct.dbuf_s = type { i32 }
define i32 @dbuf_prepend_str(%struct.dbuf_s* %0, i8* %1) {
%3 = icmp ne i8* %1, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%7 = tail call i32 @dbuf_prepend(%struct.dbuf_s* %0, i8* %1, i64 %6)
ret i32 %7
}
/* Variables and functions */
int inner(int);
int outer(int a) { return inner(a); }


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

x86 assembly (clang, -O2):
<outer>:
jmp    1030 <inner@plt>

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

LLVM IR (-O2):
define i32 @outer(i32 %0) {
%2 = tail call i32 @inner(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ F_RDLCK;
int /*<<< orphan*/ F_SETLKW;
int _fd_get_lock(int, int /*<<< orphan*/, int /*<<< orphan*/);
int fd_get_readw_lock(int fd) { return (_fd_get_lock(fd, F_SETLKW, F_RDLCK)); }


x86 assembly (clang, -O0):
<fd_get_readw_lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ec3(%rip),%rax
mov    (%rax),%esi
mov    0x2ea2(%rip),%rax
mov    (%rax),%edx
call   1030 <_fd_get_lock@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fd_get_readw_lock>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
mov    0x2eb0(%rip),%rax
mov    (%rax),%edx
jmp    1030 <_fd_get_lock@plt>

LLVM IR (-O0):
@F_SETLKW = global i32 0
@F_RDLCK = global i32 0
define i32 @fd_get_readw_lock(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @F_SETLKW
%5 = load i32, i32* @F_RDLCK
%6 = call i32 @_fd_get_lock(i32 %3, i32 %4, i32 %5)
ret i32 %6
}

LLVM IR (-O2):
@F_SETLKW = global i32 0
@F_RDLCK = global i32 0
define i32 @fd_get_readw_lock(i32 %0) {
%2 = load i32, i32* @F_SETLKW
%3 = load i32, i32* @F_RDLCK
%4 = tail call i32 @_fd_get_lock(i32 %0, i32 %2, i32 %3)
ret i32 %4
}
int calParentIndex(int index) { return ((index - 1) / 2); }


x86 assembly (clang, -O0):
<calParentIndex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<calParentIndex>:
mov    %edi,%eax
add    $0xffffffff,%eax
shr    $0x1f,%eax
add    %edi,%eax
add    $0xffffffff,%eax
sar    %eax
ret

LLVM IR (-O0):
define i32 @calParentIndex(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 1
%5 = sdiv i32 %4, 2
ret i32 %5
}

LLVM IR (-O2):
define i32 @calParentIndex(i32 %0) {
%2 = add nsw i32 %0, -1
%3 = sdiv i32 %2, 2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ drop_privs();
int /*<<< orphan*/ print_privs(char *);
void destroy_privs(void) {
  drop_privs();
  print_privs("destroy_privs, no uid should be zero  ");
}


x86 assembly (clang, -O0):
<destroy_privs>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <drop_privs@plt>
lea    0xece(%rip),%rdi
call   1040 <print_privs@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<destroy_privs>:
push   %rax
xor    %eax,%eax
call   1030 <drop_privs@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1040 <print_privs@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"destroy_privs, no uid should be zero \00"
define void @destroy_privs() {
%1 = call i32 (...) @drop_privs()
%2 = call i32 @print_privs(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [39 x i8] c"destroy_privs, no uid should be zero \00"
define void @destroy_privs() {
%1 = tail call i32 (...) @drop_privs()
%2 = tail call i32 @print_privs(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t gcd_r(uint64_t dividend, uint64_t divisor) {
  uint64_t rest;
  rest = dividend % divisor;
  if (rest == 0)
    return divisor;
  gcd_r(divisor, rest);
  return rest;
}


x86 assembly (clang, -O0):
<gcd_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    113d <gcd_r+0x2d>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114e <gcd_r+0x3e>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <gcd_r@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd_r>:
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     111f <gcd_r+0x1f>
mov    %edx,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edx,%edi
mov    %esi,%eax
cltd
idiv   %edi
mov    %edi,%esi
test   %edx,%edx
jne    1110 <gcd_r+0x10>
mov    %ecx,%esi
mov    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @gcd_r(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
%4 = icmp eq i32 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %2, %5
%6 = phi i32 [ %8, %5 ], [ %3, %2 ]
%7 = phi i32 [ %6, %5 ], [ %1, %2 ]
%8 = srem i32 %7, %6
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %5
10: ; preds = %5, %2
%11 = phi i32 [ %1, %2 ], [ %3, %5 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ use_buffer(char *, int);
void down1(int i) {
  char buf[10 * i];
  if (i > 0) {
    use_buffer(buf, 10 * i);
    down1(i - 1);
  }
}


x86 assembly (clang, -O0):
<down1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
add    %ecx,%ecx
mov    %ecx,%eax
lea    (%rax,%rax,4),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    117a <down1+0x5a>
mov    -0x20(%rbp),%rdi
imul   $0xa,-0x4(%rbp),%esi
call   1030 <use_buffer@plt>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1040 <down1@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<down1>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
push   %rax
mov    %edi,%ebx
lea    (%rbx,%rbx,1),%eax
lea    (%rax,%rax,4),%esi
lea    0xf(%rsi),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rdi
sub    %rax,%rdi
mov    %rdi,%rsp
test   %ebx,%ebx
jle    1152 <down1+0x32>
call   1030 <use_buffer@plt>
add    $0xffffffff,%ebx
mov    %ebx,%edi
call   1040 <down1@plt>
lea    -0x8(%rbp),%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @down1(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = mul nsw i32 10, %5
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %3
%9 = alloca i8, i64 %7
store i64 %7, i64* %4
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %1
%13 = load i32, i32* %2
%14 = mul nsw i32 10, %13
%15 = call i32 @use_buffer(i8* %9, i32 %14)
%16 = load i32, i32* %2
%17 = sub nsw i32 %16, 1
br label %18
18: ; preds = %12, %1
%19 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
define void @down1(i32 %0) {
%2 = mul nsw i32 %0, 10
%3 = zext i32 %2 to i64
%4 = alloca i8, i64 %3
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = call i32 @use_buffer(i8* %4, i32 %2)
%8 = add nsw i32 %0, -1
br label %9
9: ; preds = %6, %1
ret void
}
/* Type definitions */
struct dirent {
  int dummy;
};
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
scalar_t__ errno;
struct dirent *readdir(int /*<<< orphan*/ *const);
struct dirent *readdir2(DIR *const dirp) {
  errno = 0;
  return readdir(dirp);
}


x86 assembly (clang, -O0):
<readdir2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <readdir@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readdir2>:
mov    0x2ec9(%rip),%rax
movq   $0x0,(%rax)
jmp    1030 <readdir@plt>

LLVM IR (-O0):
%struct.dirent = type { i32 }
@errno = global i64 0
define %struct.dirent* @readdir2(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
store i64 0, i64* @errno
%3 = load i32*, i32** %2
%4 = call %struct.dirent* @readdir(i32* %3)
ret %struct.dirent* %4
}

LLVM IR (-O2):
%struct.dirent = type { i32 }
@errno = global i64 0
define %struct.dirent* @readdir2(i32* %0) {
store i64 0, i64* @errno
%2 = tail call %struct.dirent* @readdir(i32* %0)
ret %struct.dirent* %2
}
int main() {
  int a = 8;
  int *b = a;
  char *c = a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x8,-0x4(%rbp)
movslq -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
movslq -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ putchar(int /*<<< orphan*/);
void puts(unsigned char *buff) {
  while (*buff)
    putchar(*buff++);
}


x86 assembly (clang, -O0):
<puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <puts+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%edi
call   1030 <putchar@plt>
jmp    111c <puts+0xc>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @puts(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = zext i8 %5 to i32
%9 = tail call i32 @putchar(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
char *StrUtil_strReplChr(char *str, char fromCh, char toCh) {
  char *ChP;
  for (ChP = str; *ChP != '\0'; ChP++) {
    if (*ChP == fromCh) {
      *ChP = toCh;
    }
  }
  return str;
}


x86 assembly (clang, -O0):
<StrUtil_strReplChr>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115d <StrUtil_strReplChr+0x5d>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1147 <StrUtil_strReplChr+0x47>
mov    -0xa(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
jmp    114c <StrUtil_strReplChr+0x4c>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    111b <StrUtil_strReplChr+0x1b>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<StrUtil_strReplChr>:
mov    %rdi,%rax
mov    (%rdi),%cl
test   %cl,%cl
je     1125 <StrUtil_strReplChr+0x25>
lea    0x1(%rax),%rdi
jmp    111b <StrUtil_strReplChr+0x1b>
nop
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
je     1125 <StrUtil_strReplChr+0x25>
cmp    %sil,%cl
jne    1110 <StrUtil_strReplChr+0x10>
mov    %dl,-0x1(%rdi)
jmp    1110 <StrUtil_strReplChr+0x10>
ret

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

LLVM IR (-O2):
define i8* @StrUtil_strReplChr(i8* returned %0, i8 signext %1, i8 signext %2) {
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %3, %11
%7 = phi i8 [ %13, %11 ], [ %4, %3 ]
%8 = phi i8* [ %12, %11 ], [ %0, %3 ]
%9 = icmp eq i8 %7, %1
br i1 %9, label %10, label %11
10: ; preds = %6
store i8 %2, i8* %8
br label %11
11: ; preds = %6, %10
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %6
15: ; preds = %11, %3
ret i8* %0
}
void test_assemble_all(void) {}


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

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

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

LLVM IR (-O2):
define void @test_assemble_all() {
ret void
}
int ReverseBits(int input, int numOfBits) {
  register int reversed = 0;
  for (input |= numOfBits; input > 1; input >>= 1)
    reversed = (reversed << 1) | (input & 1);
  return reversed;
}


x86 assembly (clang, -O0):
<ReverseBits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    1143 <ReverseBits+0x43>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    -0x4(%rbp),%ecx
and    $0x1,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111a <ReverseBits+0x1a>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReverseBits>:
or     %esi,%edi
xor    %eax,%eax
cmp    $0x2,%edi
jl     1121 <ReverseBits+0x21>
xor    %eax,%eax
mov    %edi,%ecx
nopl   (%rax)
mov    %edi,%edx
and    $0x1,%edx
lea    (%rdx,%rax,2),%eax
shr    %ecx
cmp    $0x3,%edi
mov    %ecx,%edi
ja     1110 <ReverseBits+0x10>
ret

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

LLVM IR (-O2):
define i32 @ReverseBits(i32 %0, i32 %1) {
%3 = or i32 %1, %0
%4 = icmp sgt i32 %3, 1
br i1 %4, label %5, label %13
5: ; preds = %2, %5
%6 = phi i32 [ %10, %5 ], [ 0, %2 ]
%7 = phi i32 [ %11, %5 ], [ %3, %2 ]
%8 = shl i32 %6, 1
%9 = and i32 %7, 1
%10 = or i32 %8, %9
%11 = lshr i32 %7, 1
%12 = icmp ugt i32 %7, 3
br i1 %12, label %5, label %13
13: ; preds = %5, %2
%14 = phi i32 [ 0, %2 ], [ %10, %5 ]
ret i32 %14
}
void __kern_mempageset(unsigned int __pagereg, unsigned char __pageno) {
  char *pagereg = (char *)__pagereg;
  *pagereg = __pageno;
}


x86 assembly (clang, -O0):
<__kern_mempageset>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
mov    -0x5(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @__kern_mempageset(i32 %0, i8 zeroext %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8*
store i32 %0, i32* %3
store i8 %1, i8* %4
%6 = load i32, i32* %3
%7 = zext i32 %6 to i64
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %5
%9 = load i8, i8* %4
%10 = load i8*, i8** %5
store i8 %9, i8* %10
ret void
}

LLVM IR (-O2):
define void @__kern_mempageset(i32 %0, i8 zeroext %1) {
%3 = zext i32 %0 to i64
%4 = inttoptr i64 %3 to i8*
store i8 %1, i8* %4
ret void
}
/* Variables and functions */
char *strdup(char const *);
char *PFC_strdup(const char *string) { return strdup(string); }


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

x86 assembly (clang, -O2):
<PFC_strdup>:
jmp    1030 <strdup@plt>

LLVM IR (-O0):
define i8* @PFC_strdup(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @strdup(i8* %3)
ret i8* %4
}

LLVM IR (-O2):
define noalias i8* @PFC_strdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
ret i8* %2
}
/* Variables and functions */
int u8_uctomb_aux(unsigned char *, unsigned int, int);
int u8_uctomb(unsigned char *s, unsigned int uc, int n) {
  if (uc < 0x80 && n > 0) {
    s[0] = uc;
    return 1;
  } else
    return u8_uctomb_aux(s, uc, n);
}


x86 assembly (clang, -O0):
<u8_uctomb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
cmpl   $0x80,-0x14(%rbp)
jae    1150 <u8_uctomb+0x40>
cmpl   $0x0,-0x18(%rbp)
jle    1150 <u8_uctomb+0x40>
mov    -0x14(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1162 <u8_uctomb+0x52>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <u8_uctomb_aux@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<u8_uctomb>:
cmp    $0x7f,%esi
ja     1122 <u8_uctomb+0x12>
test   %edx,%edx
jle    1122 <u8_uctomb+0x12>
mov    %sil,(%rdi)
mov    $0x1,%eax
ret
jmp    1030 <u8_uctomb_aux@plt>

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

LLVM IR (-O2):
define i32 @u8_uctomb(i8* %0, i32 %1, i32 %2) {
%4 = icmp ult i32 %1, 128
%5 = icmp sgt i32 %2, 0
%6 = and i1 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = trunc i32 %1 to i8
store i8 %8, i8* %0
br label %11
9: ; preds = %3
%10 = tail call i32 @u8_uctomb_aux(i8* %0, i32 %1, i32 %2)
br label %11
11: ; preds = %9, %7
%12 = phi i32 [ 1, %7 ], [ %10, %9 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ say_hello_to_jenkins();
int /*<<< orphan*/ say_hello_to_jenkins_again();
int main(int argc, char *argv[]) {
  say_hello_to_jenkins();
  say_hello_to_jenkins_again();
  return 0;
}


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    $0x0,%al
call   1030 <say_hello_to_jenkins@plt>
mov    $0x0,%al
call   1040 <say_hello_to_jenkins_again@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
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 (...) @say_hello_to_jenkins()
%7 = call i32 (...) @say_hello_to_jenkins_again()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @say_hello_to_jenkins()
%4 = tail call i32 (...) @say_hello_to_jenkins_again()
ret i32 0
}
/* Variables and functions */
int fminf(double, double);
void test(int a, float *b, int n) {
  if (n < 10) {
    *b = a * fminf(0.0, 1.0 * a);
  }
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    115f <test+0x4f>
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xec1(%rip),%xmm1
mulsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
call   1030 <fminf@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
imul   %ecx,%eax
cvtsi2ss %eax,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
cmp    $0x9,%edx
jg     113d <test+0x2d>
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
cvtsi2sd %edi,%xmm1
xorps  %xmm0,%xmm0
call   1030 <fminf@plt>
imul   %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @test(i32 %0, float* %1, i32 %2) {
%4 = alloca i32
%5 = alloca float*
%6 = alloca i32
store i32 %0, i32* %4
store float* %1, float** %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %18
9: ; preds = %3
%10 = load i32, i32* %4
%11 = load i32, i32* %4
%12 = sitofp i32 %11 to double
%13 = fmul double 1.000000e+00, %12
%14 = call i32 @fminf(double 0.000000e+00, double %13)
%15 = mul nsw i32 %10, %14
%16 = sitofp i32 %15 to float
%17 = load float*, float** %5
store float %16, float* %17
br label %18
18: ; preds = %9, %3
ret void
}

LLVM IR (-O2):
define void @test(i32 %0, float* nocapture writeonly %1, i32 %2) {
%4 = icmp slt i32 %2, 10
br i1 %4, label %5, label %10
5: ; preds = %3
%6 = sitofp i32 %0 to double
%7 = tail call i32 @fminf(double 0.000000e+00, double %6)
%8 = mul nsw i32 %7, %0
%9 = sitofp i32 %8 to float
store float %9, float* %1
br label %10
10: ; preds = %5, %3
ret void
}
unsigned int tseRead(void) {
  unsigned int temperature =
      (*((volatile unsigned int *const)(0x40010000 + 0x1040)));
  return temperature;
}


x86 assembly (clang, -O0):
<tseRead>:
push   %rbp
mov    %rsp,%rbp
mov    $0x40011040,%eax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tseRead>:
mov    0x40011040,%eax
ret

LLVM IR (-O0):
define i32 @tseRead() {
%1 = alloca i32
%2 = load volatile i32, i32* inttoptr (i64 1073811520 to i32*)
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @tseRead() {
%1 = load volatile i32, i32* inttoptr (i64 1073811520 to i32*)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ SHUT_RDWR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ shutdown(int, int /*<<< orphan*/);
void ht_close(int s) {
  shutdown(s, SHUT_RDWR);
  close(s);
}


x86 assembly (clang, -O0):
<ht_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
call   1030 <shutdown@plt>
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ht_close>:
push   %rbx
mov    %edi,%ebx
mov    0x2ec6(%rip),%rax
mov    (%rax),%esi
call   1030 <shutdown@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <close@plt>

LLVM IR (-O0):
@SHUT_RDWR = global i32 0
define void @ht_close(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SHUT_RDWR
%5 = call i32 @shutdown(i32 %3, i32 %4)
%6 = load i32, i32* %2
%7 = call i32 @close(i32 %6)
ret void
}

LLVM IR (-O2):
@SHUT_RDWR = global i32 0
define void @ht_close(i32 %0) {
%2 = load i32, i32* @SHUT_RDWR
%3 = tail call i32 @shutdown(i32 %0, i32 %2)
%4 = tail call i32 @close(i32 %0)
ret void
}
int isPowerOfTwo(int u) { return u && !(u & (u - 1)); }


x86 assembly (clang, -O0):
<isPowerOfTwo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     112c <isPowerOfTwo+0x2c>
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPowerOfTwo>:
test   %edi,%edi
je     110f <isPowerOfTwo+0xf>
lea    -0x1(%rdi),%ecx
xor    %eax,%eax
test   %ecx,%edi
sete   %al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @isPowerOfTwo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = load i32, i32* %2
%7 = load i32, i32* %2
%8 = sub nsw i32 %7, 1
%9 = and i32 %6, %8
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
br label %12
12: ; preds = %5, %1
%13 = phi i1 [ false, %1 ], [ %11, %5 ]
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @isPowerOfTwo(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i32 @llvm.ctpop.i32(i32 %0)
%5 = icmp ult i32 %4, 2
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %1
%8 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %8
}
int main() {
  short int a;
  unsigned int b;
  int i, j, k;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i16
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int decr(int x) { return x - 1; }


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

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

LLVM IR (-O0):
define i32 @decr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 1
ret i32 %4
}

LLVM IR (-O2):
define i32 @decr(i32 %0) {
%2 = add nsw i32 %0, -1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ SPI_SD_DisableRxInt();
int /*<<< orphan*/ SPI_SD_DisableTxInt();
void SPI_SD_DisableInt(void) {
  SPI_SD_DisableTxInt();
  SPI_SD_DisableRxInt();
}


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

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

LLVM IR (-O0):
define void @SPI_SD_DisableInt() {
%1 = call i32 (...) @SPI_SD_DisableTxInt()
%2 = call i32 (...) @SPI_SD_DisableRxInt()
ret void
}

LLVM IR (-O2):
define void @SPI_SD_DisableInt() {
%1 = tail call i32 (...) @SPI_SD_DisableTxInt()
%2 = tail call i32 (...) @SPI_SD_DisableRxInt()
ret void
}
/* Variables and functions */
int get_string(char *, int);
int igets_(int iterm, char *string, int length) {
  return (get_string(string, length));
}


x86 assembly (clang, -O0):
<igets_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <get_string@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<igets_>:
mov    %rsi,%rdi
mov    %edx,%esi
jmp    1030 <get_string@plt>

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

LLVM IR (-O2):
define i32 @igets_(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @get_string(i8* %1, i32 %2)
ret i32 %4
}
void ARGBSetRow_X86() {}


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

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

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

LLVM IR (-O2):
define void @ARGBSetRow_X86() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usg(char *str) { printf("%s", str); }


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @usg(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
double exp(double);
double exp_interp(double x, double lx, double ux, double ly, double uy) {
  return (uy + (ly - uy) * exp(-(x - lx) / ux));
}


x86 assembly (clang, -O0):
<exp_interp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x18(%rbp),%xmm0
call   1030 <exp@plt>
movsd  -0x38(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exp_interp>:
sub    $0x18,%rsp
movsd  %xmm4,0x10(%rsp)
subsd  %xmm4,%xmm3
movsd  %xmm3,0x8(%rsp)
subsd  %xmm1,%xmm0
xorpd  0xed0(%rip),%xmm0
divsd  %xmm2,%xmm0
call   1030 <exp@plt>
mulsd  0x8(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @exp_interp(double %0, double %1, double %2, double %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%11 = load double, double* %10
%12 = load double, double* %9
%13 = load double, double* %10
%14 = fsub double %12, %13
%15 = load double, double* %6
%16 = load double, double* %7
%17 = fsub double %15, %16
%18 = fneg double %17
%19 = load double, double* %8
%20 = fdiv double %18, %19
%21 = call double @exp(double %20)
%22 = call double @llvm.fmuladd.f64(double %14, double %21, double %11)
ret double %22
}

LLVM IR (-O2):
define double @exp_interp(double %0, double %1, double %2, double %3, double %4) {
%6 = fsub double %3, %4
%7 = fsub double %0, %1
%8 = fneg double %7
%9 = fdiv double %8, %2
%10 = tail call double @exp(double %9)
%11 = tail call double @llvm.fmuladd.f64(double %6, double %10, double %4)
ret double %11
}
/* Variables and functions */
void *aligned_alloc(size_t, size_t);
void *__attribute__((weak))
__libnx_aligned_alloc(size_t alignment, size_t size) {
  size = (size + alignment - 1) & ~(alignment - 1);
  return aligned_alloc(alignment, size);
}


x86 assembly (clang, -O0):
<__libnx_aligned_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    -0x8(%rbp),%rax
sub    $0x1,%rax
mov    -0x8(%rbp),%rcx
sub    $0x1,%rcx
xor    $0xffffffffffffffff,%rcx
and    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <aligned_alloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__libnx_aligned_alloc>:
lea    (%rdi,%rsi,1),%rax
add    $0xffffffffffffffff,%rax
mov    %rdi,%rsi
neg    %rsi
and    %rax,%rsi
jmp    1030 <aligned_alloc@plt>

LLVM IR (-O0):
define weak i8* @__libnx_aligned_alloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* %3
%7 = add i64 %5, %6
%8 = sub i64 %7, 1
%9 = load i64, i64* %3
%10 = sub i64 %9, 1
%11 = xor i64 %10, -1
%12 = and i64 %8, %11
store i64 %12, i64* %4
%13 = load i64, i64* %3
%14 = load i64, i64* %4
%15 = call i8* @aligned_alloc(i64 %13, i64 %14)
ret i8* %15
}

LLVM IR (-O2):
define weak i8* @__libnx_aligned_alloc(i64 %0, i64 %1) {
%3 = add i64 %0, -1
%4 = add i64 %3, %1
%5 = sub i64 0, %0
%6 = and i64 %4, %5
%7 = tail call i8* @aligned_alloc(i64 %0, i64 %6)
ret i8* %7
}
void raise() {}


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

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

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

LLVM IR (-O2):
define void @raise() {
ret void
}
int ispowerof2(int n) {
  int pwr = 2;
  while (n > pwr)
    pwr *= 2;
  return n == pwr;
}


x86 assembly (clang, -O0):
<ispowerof2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1128 <ispowerof2+0x28>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <ispowerof2+0xe>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ispowerof2>:
mov    $0x2,%eax
cs nopw 0x0(%rax,%rax,1)
nop
lea    (%rax,%rax,1),%ecx
cmp    %edi,%eax
mov    %ecx,%eax
jl     1110 <ispowerof2+0x10>
sete   %al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @ispowerof2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 2, i32* %3
br label %4
4: ; preds = %8, %1
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = icmp sgt i32 %5, %6
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = load i32, i32* %3
%10 = mul nsw i32 %9, 2
store i32 %10, i32* %3
br label %4
11: ; preds = %4
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = icmp eq i32 %12, %13
%15 = zext i1 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
define i32 @ispowerof2(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 2, %1 ], [ %5, %2 ]
%4 = icmp slt i32 %3, %0
%5 = shl nsw i32 %3, 1
br i1 %4, label %2, label %6
6: ; preds = %2
%7 = icmp eq i32 %3, %0
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Type definitions */
typedef int uint8_t;
typedef int uint64_t;
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, size_t, char *, char *, int, int, int);
void keydir(char *buffer, size_t length, uint64_t _keyid, char *basepath) {
  uint64_t keyid = _keyid << 32;
  snprintf(buffer, length, "%s/key/%02X/%02X/%08X", basepath,
           (uint8_t)((keyid >> 56) & 0xFF), (uint8_t)((keyid >> 48) & 0xFF),
           (uint32_t)(keyid >> 32));
}


x86 assembly (clang, -O0):
<keydir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x20,%ecx
shl    %cl,%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%r8d
mov    $0x38,%ecx
sar    %cl,%r8d
and    $0xff,%r8d
mov    -0x24(%rbp),%r9d
mov    $0x30,%ecx
sar    %cl,%r9d
and    $0xff,%r9d
mov    -0x24(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
mov    -0x30(%rbp),%rcx
lea    0xe81(%rip),%rdx
mov    %eax,(%rsp)
call   1030 <snprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<keydir>:
push   %rax
lea    0xee8(%rip),%rdx
call   1030 <snprintf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [22 x i8] c"%s/key/%02X/%02X/%08X\00"
define void @keydir(i8* %0, i64 %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%10 = load i32, i32* %7
%11 = shl i32 %10, 32
store i32 %11, i32* %9
%12 = load i8*, i8** %5
%13 = load i64, i64* %6
%14 = load i8*, i8** %8
%15 = load i32, i32* %9
%16 = ashr i32 %15, 56
%17 = and i32 %16, 255
%18 = load i32, i32* %9
%19 = ashr i32 %18, 48
%20 = and i32 %19, 255
%21 = load i32, i32* %9
%22 = ashr i32 %21, 32
%23 = call i32 @snprintf(i8* %12, i64 %13, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %14, i32 %17, i32 %20, i32 %22)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"%s/key/%02X/%02X/%08X\00"
define void @keydir(i8* %0, i64 %1, i32 %2, i8* %3) {
%5 = tail call i32 @snprintf(i8* %0, i64 %1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %3, i32 poison, i32 poison, i32 poison)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf2(char *);
void GenEndAsciiString(void) { printf2(")\n"); }


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c")\0A\00"
define void @GenEndAsciiString() {
%1 = tail call i32 @printf2(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;
struct LR35902 {
  int dummy;
};

/* Variables and functions */
void NOP_00(struct LR35902 *machine, uint16_t code) {}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
ret

LLVM IR (-O0):
%struct.LR35902 = type { i32 }
define void @NOP_00(%struct.LR35902* %0, i32 %1) {
%3 = alloca %struct.LR35902*
%4 = alloca i32
store %struct.LR35902* %0, %struct.LR35902** %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
%struct.LR35902 = type { i32 }
define void @NOP_00(%struct.LR35902* nocapture %0, i32 %1) {
ret void
}
_Bool F3(_Bool B1, _Bool B2) {
  _Bool R = 0;
  if (B1 && B2)
    R = 1;
  return R;
}


x86 assembly (clang, -O0):
<F3>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
and    $0x1,%cl
mov    %cl,-0x1(%rbp)
and    $0x1,%al
mov    %al,-0x2(%rbp)
movb   $0x0,-0x3(%rbp)
testb  $0x1,-0x1(%rbp)
je     1131 <F3+0x31>
testb  $0x1,-0x2(%rbp)
je     1131 <F3+0x31>
movb   $0x1,-0x3(%rbp)
mov    -0x3(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i1 @F3(i1 zeroext %0, i1 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = zext i1 %0 to i8
store i8 %6, i8* %3
%7 = zext i1 %1 to i8
store i8 %7, i8* %4
store i8 0, i8* %5
%8 = load i8, i8* %3
%9 = trunc i8 %8 to i1
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i8, i8* %4
%12 = trunc i8 %11 to i1
br i1 %12, label %13, label %14
13: ; preds = %10
store i8 1, i8* %5
br label %14
14: ; preds = %13, %10, %2
%15 = load i8, i8* %5
%16 = trunc i8 %15 to i1
ret i1 %16
}

LLVM IR (-O2):
define zeroext i1 @F3(i1 zeroext %0, i1 zeroext %1) {
%3 = and i1 %0, %1
ret i1 %3
}
void select_chip() { (*(volatile unsigned long *)0x4E000004) &= ~(1 << 1); }


x86 assembly (clang, -O0):
<select_chip>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4e000004,%eax
mov    (%rax),%rcx
and    $0xfffffffffffffffd,%rcx
mov    $0x4e000004,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<select_chip>:
andq   $0xfffffffffffffffd,0x4e000004
4e fd
ret

LLVM IR (-O0):
define void @select_chip() {
%1 = load volatile i64, i64* inttoptr (i64 1308622852 to i64*)
%2 = and i64 %1, -3
store volatile i64 %2, i64* inttoptr (i64 1308622852 to i64*)
ret void
}

LLVM IR (-O2):
define void @select_chip() {
%1 = load volatile i64, i64* inttoptr (i64 1308622852 to i64*)
%2 = and i64 %1, -3
store volatile i64 %2, i64* inttoptr (i64 1308622852 to i64*)
ret void
}