xunge/DecIR huggingface dataset:
int *process_colors(unsigned char bits) {
  static int a[4];
  for (int i = 0; i < 4; ++i) {
    a[i] = (bits >> (2 * (3 - i))) & 0x3;
  }
  return a;
}


x86 assembly (clang, -O0):
<process_colors>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    114b <process_colors+0x4b>
movzbl -0x1(%rbp),%edx
mov    $0x3,%ecx
sub    -0x8(%rbp),%ecx
shl    $0x1,%ecx
sar    %cl,%edx
and    $0x3,%edx
movslq -0x8(%rbp),%rcx
lea    0x2ef6(%rip),%rax
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1111 <process_colors+0x11>
lea    0x2ede(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_colors>:
mov    %edi,%eax
shr    $0x6,%eax
mov    %eax,0x2f25(%rip)
lea    0x2f1e(%rip),%rax
mov    %edi,%ecx
shr    $0x4,%ecx
and    $0x3,%ecx
mov    %ecx,0x2f14(%rip)
mov    %edi,%ecx
shr    $0x2,%ecx
and    $0x3,%ecx
mov    %ecx,0x2f0a(%rip)
and    $0x3,%edi
mov    %edi,0x2f05(%rip)
ret

LLVM IR (-O0):
@process_colors.a = internal global [4 x i32] zeroinitializer
define i32* @process_colors(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 0, i32* %3
br label %4
4: ; preds = %18, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 4
br i1 %6, label %7, label %21
7: ; preds = %4
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = load i32, i32* %3
%11 = sub nsw i32 3, %10
%12 = mul nsw i32 2, %11
%13 = ashr i32 %9, %12
%14 = and i32 %13, 3
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [4 x i32], [4 x i32]* @process_colors.a, i64 0, i64 %16
store i32 %14, i32* %17
br label %18
18: ; preds = %7
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %4
21: ; preds = %4
ret i32* getelementptr inbounds ([4 x i32], [4 x i32]* @process_colors.a, i64 0, i64 0)
}

LLVM IR (-O2):
@process_colors.a = internal global [4 x i32] zeroinitializer
define i32* @process_colors(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = lshr i32 %2, 6
store i32 %3, i32* getelementptr inbounds ([4 x i32], [4 x i32]* @process_colors.a, i64 0, i64 0)
%4 = lshr i32 %2, 4
%5 = and i32 %4, 3
store i32 %5, i32* getelementptr inbounds ([4 x i32], [4 x i32]* @process_colors.a, i64 0, i64 1)
%6 = lshr i32 %2, 2
%7 = and i32 %6, 3
store i32 %7, i32* getelementptr inbounds ([4 x i32], [4 x i32]* @process_colors.a, i64 0, i64 2)
%8 = and i32 %2, 3
store i32 %8, i32* getelementptr inbounds ([4 x i32], [4 x i32]* @process_colors.a, i64 0, i64 3)
ret i32* getelementptr inbounds ([4 x i32], [4 x i32]* @process_colors.a, i64 0, i64 0)
}
void Unicode_to_JIS(void) {}


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

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

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

LLVM IR (-O2):
define void @Unicode_to_JIS() {
ret void
}
int gcd(int a, int b) {
  if (a == 0) {
    return b;
  } else if (b == 0) {
    return a;
  } else if (a > b) {
    return gcd(a - b, b);
  } else {
    return gcd(b - a, a);
  }
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1133 <gcd+0x23>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117b <gcd+0x6b>
cmpl   $0x0,-0xc(%rbp)
jne    1148 <gcd+0x38>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117b <gcd+0x6b>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    116a <gcd+0x5a>
mov    -0x8(%rbp),%edi
sub    -0xc(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <gcd@plt>
mov    %eax,-0x4(%rbp)
jmp    117b <gcd+0x6b>
mov    -0xc(%rbp),%edi
sub    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <gcd@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
test   %edi,%edi
je     1129 <gcd+0x29>
mov    %edi,%eax
cs nopw 0x0(%rax,%rax,1)
test   %esi,%esi
je     112c <gcd+0x2c>
mov    %eax,%ecx
sub    %esi,%ecx
jle    1120 <gcd+0x20>
mov    %ecx,%eax
jne    1110 <gcd+0x10>
jmp    1129 <gcd+0x29>
mov    %esi,%edi
mov    %eax,%esi
sub    %eax,%edi
jne    1104 <gcd+0x4>
ret
mov    %esi,%eax
ret
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %18, label %4
4: ; preds = %2, %15
%5 = phi i32 [ %9, %15 ], [ %1, %2 ]
%6 = phi i32 [ %16, %15 ], [ %0, %2 ]
%7 = icmp eq i32 %5, 0
br label %8
8: ; preds = %4, %12
%9 = phi i32 [ %6, %4 ], [ %13, %12 ]
br i1 %7, label %18, label %10
10: ; preds = %8
%11 = icmp sgt i32 %9, %5
br i1 %11, label %12, label %15
12: ; preds = %10
%13 = sub nsw i32 %9, %5
%14 = icmp eq i32 %13, 0
br i1 %14, label %18, label %8
15: ; preds = %10
%16 = sub nsw i32 %5, %9
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %4
18: ; preds = %15, %12, %8, %2
%19 = phi i32 [ %1, %2 ], [ %6, %8 ], [ %5, %12 ], [ %9, %15 ]
ret i32 %19
}
/* Variables and functions */
void *dlmemalign(size_t, size_t);
void *dlpvalloc(size_t bytes) {
  size_t pagesize = (4096);
  return dlmemalign(pagesize, (bytes + pagesize - 1) & ~(pagesize - 1));
}


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

x86 assembly (clang, -O2):
<dlpvalloc>:
lea    0xfff(%rdi),%rsi
and    $0xfffffffffffff000,%rsi
mov    $0x1000,%edi
jmp    1030 <dlmemalign@plt>

LLVM IR (-O0):
define i8* @dlpvalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
store i64 4096, i64* %3
%4 = load i64, i64* %3
%5 = load i64, i64* %2
%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
%13 = call i8* @dlmemalign(i64 %4, i64 %12)
ret i8* %13
}

LLVM IR (-O2):
define i8* @dlpvalloc(i64 %0) {
%2 = add i64 %0, 4095
%3 = and i64 %2, -4096
%4 = tail call i8* @dlmemalign(i64 4096, i64 %3)
ret i8* %4
}
/* Variables and functions */
int printf(char *, int, int, int, int, int);
int main(void) {
  return printf("%lu, %ld, %ld, %u, %ld\n", 0xF2C889DD98AE1F63, 0xFFD2086BDu,
                0xFFD2086BD, 0xFFFFFFFF, 4294967295);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x98ae1f63,%esi
mov    $0xfd2086bd,%ecx
mov    $0xffffffff,%r9d
mov    %ecx,%edx
mov    %r9d,%r8d
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
lea    0xee9(%rip),%rdi
mov    $0x98ae1f63,%esi
mov    $0xfd2086bd,%edx
mov    $0xfd2086bd,%ecx
mov    $0xffffffff,%r8d
mov    $0xffffffff,%r9d
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"%lu, %ld, %ld, %u, %ld\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 -1733419165, i32 -48200003, i32 -48200003, i32 -1, i32 -1)
ret i32 %2
}

LLVM IR (-O2):
@.str = [24 x i8] c"%lu, %ld, %ld, %u, %ld\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 -1733419165, i32 -48200003, i32 -48200003, i32 -1, i32 -1)
ret i32 %1
}
void device_pm_add(struct device *dev) {}


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

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

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

LLVM IR (-O2):
%struct.device = type opaque
define void @device_pm_add(%struct.device* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
void free_s32(int32_t *val) {}


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

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

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

LLVM IR (-O2):
define void @free_s32(i32* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ factor();
void term() { factor(); }


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

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

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

LLVM IR (-O2):
define void @term() {
%1 = tail call i32 (...) @factor()
ret void
}
int s_pipe_posix_init(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @s_pipe_posix_init() {
ret i32 0
}
void keyspaceEventsFlagsToString(void) {
  _serverPanic("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/"
               "heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c",
               81, "Function '%s' is disabled.", __func__);
}


x86 assembly (clang, -O0):
<keyspaceEventsFlagsToString>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x51,%esi
lea    0xf79(%rip),%rdx
lea    0xf8d(%rip),%rcx
mov    $0x0,%al
call   1030 <_serverPanic@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<keyspaceEventsFlagsToString>:
lea    0xee9(%rip),%rdi
lea    0xf82(%rip),%rdx
lea    0xf96(%rip),%rcx
mov    $0x51,%esi
xor    %eax,%eax
jmp    1030 <_serverPanic@plt>

LLVM IR (-O0):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c\00"
@.str.1 = [27 x i8] c"Function '%s' is disabled.\00"
@__func__.keyspaceEventsFlagsToString = [28 x i8] c"keyspaceEventsFlagsToString\00"
define void @keyspaceEventsFlagsToString() {
%1 = call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @_serverPanic to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 81, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @__func__.keyspaceEventsFlagsToString, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c\00"
@.str.1 = [27 x i8] c"Function '%s' is disabled.\00"
@__func__.keyspaceEventsFlagsToString = [28 x i8] c"keyspaceEventsFlagsToString\00"
define void @keyspaceEventsFlagsToString() {
%1 = tail call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @_serverPanic to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 81, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @__func__.keyspaceEventsFlagsToString, i64 0, i64 0))
ret void
}
/* Variables and functions */
int unlock_common(char const *, int);
int maillock_read_unlock(const char *filename, int fd) {
  return unlock_common(filename, fd);
}


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

x86 assembly (clang, -O2):
<maillock_read_unlock>:
jmp    1030 <unlock_common@plt>

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

LLVM IR (-O2):
define i32 @maillock_read_unlock(i8* %0, i32 %1) {
%3 = tail call i32 @unlock_common(i8* %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ rotate(char *, int, int, int);
int main() {
  char str[] = "Hello, world. This is an example.";
  rotate(str, 4, 11, 33);
  printf("%s\n", str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x22,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0x4,%esi
mov    $0xb,%edx
mov    $0x21,%ecx
call   1050 <rotate@plt>
lea    -0x30(%rbp),%rsi
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,(%rsp)
movw   $0x2e,0x20(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0xb,%edx
mov    $0x21,%ecx
call   1040 <rotate@plt>
lea    0xebe(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str = [34 x i8] c"Hello, world. This is an example.\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [34 x i8]
store i32 0, i32* %1
%3 = bitcast [34 x i8]* %2 to i8*
%4 = getelementptr inbounds [34 x i8], [34 x i8]* %2, i64 0, i64 0
%5 = call i32 @rotate(i8* %4, i32 4, i32 11, i32 33)
%6 = getelementptr inbounds [34 x i8], [34 x i8]* %2, i64 0, i64 0
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [34 x i8] c"Hello, world. This is an example.\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [34 x i8]
%2 = getelementptr inbounds [34 x i8], [34 x i8]* %1, i64 0, i64 0
%3 = call i32 @rotate(i8* %2, i32 4, i32 11, i32 33)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ lCurDir;

/* Variables and functions */
char *getcwd(char *, int);
char *getCurDir(void) {
  static char lCurDir[1024];
  return getcwd(lCurDir, sizeof(lCurDir));
}


x86 assembly (clang, -O0):
<getCurDir>:
push   %rbp
mov    %rsp,%rbp
lea    0x2f25(%rip),%rdi
mov    $0x400,%esi
call   1030 <getcwd@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCurDir>:
lea    0x2f29(%rip),%rdi
mov    $0x400,%esi
jmp    1030 <getcwd@plt>

LLVM IR (-O0):
@getCurDir.lCurDir = internal global [1024 x i8] zeroinitializer
define i8* @getCurDir() {
%1 = call i8* @getcwd(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @getCurDir.lCurDir, i64 0, i64 0), i32 1024)
ret i8* %1
}

LLVM IR (-O2):
@getCurDir.lCurDir = internal global [1024 x i8] zeroinitializer
define i8* @getCurDir() {
%1 = tail call i8* @getcwd(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @getCurDir.lCurDir, i64 0, i64 0), i32 1024)
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ m_alloc_init();
int /*<<< orphan*/ strpool_init();
void __user_init(void) {
  m_alloc_init();
  strpool_init();
}


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

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

LLVM IR (-O0):
define void @__user_init() {
%1 = call i32 (...) @m_alloc_init()
%2 = call i32 (...) @strpool_init()
ret void
}

LLVM IR (-O2):
define void @__user_init() {
%1 = tail call i32 (...) @m_alloc_init()
%2 = tail call i32 (...) @strpool_init()
ret void
}
unsigned usum1(unsigned a, unsigned b) { return a + b; }


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

x86 assembly (clang, -O2):
<usum1>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @usum1(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 = add i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @usum1(i32 %0, i32 %1) {
%3 = add i32 %1, %0
ret i32 %3
}
/* Variables and functions */
size_t hashfn(void *value) { return (*(long *)value) % 8; }


x86 assembly (clang, -O0):
<hashfn>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    $0x8,%ecx
cqto
idiv   %rcx
mov    %rdx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashfn>:
mov    (%rdi),%rax
lea    0x7(%rax),%rcx
test   %rax,%rax
cmovns %rax,%rcx
and    $0xfffffffffffffff8,%rcx
sub    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @hashfn(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i64*
%5 = load i64, i64* %4
%6 = srem i64 %5, 8
ret i64 %6
}

LLVM IR (-O2):
define i64 @hashfn(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = srem i64 %3, 8
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ fetestexcept(int);
void uninitvar_fetestexcept(void) {
  int i;
  (void)fetestexcept(i);
}


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

x86 assembly (clang, -O2):
<uninitvar_fetestexcept>:
jmp    1030 <fetestexcept@plt>

LLVM IR (-O0):
define void @uninitvar_fetestexcept() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = call i32 @fetestexcept(i32 %2)
ret void
}

LLVM IR (-O2):
define void @uninitvar_fetestexcept() {
%1 = tail call i32 @fetestexcept(i32 undef)
ret void
}
/* Variables and functions */
int strlen(char *);
void replaceString(char source[], char s1[], char s2[]) {
  int findString(const char source[], const char destination[]);
  void removeString(char source[], int start, int count);
  void insertString(char source[], char insert[], int start);
  int start = findString(source, s1);
  if (-1 == start)
    return;
  removeString(source, start, strlen(s1));
  insertString(source, s2, start);
}


x86 assembly (clang, -O0):
<replaceString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <findString@plt>
mov    %eax,-0x1c(%rbp)
mov    $0xffffffff,%eax
cmp    -0x1c(%rbp),%eax
jne    1177 <replaceString+0x37>
jmp    11ac <replaceString+0x6c>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    %eax,%edx
call   1060 <removeString@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1050 <insertString@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<replaceString>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <findString@plt>
cmp    $0xffffffff,%eax
je     1187 <replaceString+0x47>
mov    %eax,%ebp
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1060 <removeString@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <insertString@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @replaceString(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @findString(i8* %0, i8* %1)
%5 = icmp eq i32 %4, -1
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @strlen(i8* %1)
tail call void @removeString(i8* %0, i32 %4, i32 %7)
tail call void @insertString(i8* %0, i8* %2, i32 %4)
br label %8
8: ; preds = %3, %6
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ array;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
void array_len_test(void) {
  int array[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  assert((sizeof(array) / sizeof((array)[0])) == 10);
}


x86 assembly (clang, -O0):
<array_len_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_len_test>:
mov    $0x1,%edi
jmp    1030 <assert@plt>

LLVM IR (-O0):
@__const.array_len_test.array = [10 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10]
define void @array_len_test() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = call i32 @assert(i32 1)
ret void
}

LLVM IR (-O2):
define void @array_len_test() {
%1 = tail call i32 @assert(i32 1)
ret void
}
void test_isspace_macro(void) {
  int i, j;
  for (i = -127; i < 256;)
    j = i, printf("%s: %d -> %d\n", __FUNCTION__, j, isspace(i++) ? 1 : 0);
}


x86 assembly (clang, -O0):
<test_isspace_macro>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffff81,-0x4(%rbp)
cmpl   $0x100,-0x4(%rbp)
jge    1184 <test_isspace_macro+0x64>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
call   1040 <isspace@plt>
mov    -0xc(%rbp),%edx
mov    %eax,%esi
xor    %ecx,%ecx
mov    $0x1,%eax
cmp    $0x0,%esi
cmovne %eax,%ecx
lea    0xe8f(%rip),%rdi
lea    0xe96(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    112f <test_isspace_macro+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_isspace_macro>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0xffffff81,%ebx
lea    0xecd(%rip),%r14
lea    0xed4(%rip),%r15
nopw   0x0(%rax,%rax,1)
lea    0x1(%rbx),%ebp
mov    %ebx,%edi
call   1040 <isspace@plt>
xor    %ecx,%ecx
test   %eax,%eax
setne  %cl
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebp,%ebx
cmp    $0x100,%ebp
jne    1140 <test_isspace_macro+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%s: %d -> %d\0A\00"
@__FUNCTION__.test_isspace_macro = [19 x i8] c"test_isspace_macro\00"
define void @test_isspace_macro() {
%1 = alloca i32
%2 = alloca i32
store i32 -127, i32* %1
br label %3
3: ; preds = %6, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 256
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = load i32, i32* %1
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = load i32, i32* %1
%10 = add nsw i32 %9, 1
store i32 %10, i32* %1
%11 = call i32 @isspace(i32 %9)
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 1, i32 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__FUNCTION__.test_isspace_macro, i64 0, i64 0), i32 %8, i32 %14)
br label %3
16: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%s: %d -> %d\0A\00"
@__FUNCTION__.test_isspace_macro = [19 x i8] c"test_isspace_macro\00"
define void @test_isspace_macro() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ -127, %0 ], [ %3, %1 ]
%3 = add nsw i32 %2, 1
%4 = tail call i32 @isspace(i32 %2)
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__FUNCTION__.test_isspace_macro, i64 0, i64 0), i32 %2, i32 %6)
%8 = icmp eq i32 %3, 256
br i1 %8, label %9, label %1
9: ; preds = %1
ret void
}
int is_operator(char op) {
  return op == '+' || op == '-' || op == '*' || op == '/' || op == '^';
}


x86 assembly (clang, -O0):
<is_operator>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2b,%ecx
mov    %al,-0x2(%rbp)
je     115f <is_operator+0x5f>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2d,%ecx
mov    %al,-0x2(%rbp)
je     115f <is_operator+0x5f>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2a,%ecx
mov    %al,-0x2(%rbp)
je     115f <is_operator+0x5f>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2f,%ecx
mov    %al,-0x2(%rbp)
je     115f <is_operator+0x5f>
movsbl -0x1(%rbp),%eax
cmp    $0x5e,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_operator>:
lea    -0x2a(%rdi),%eax
cmp    $0x6,%al
jae    1119 <is_operator+0x19>
movzbl %al,%ecx
mov    $0x1,%eax
mov    $0x2b,%edx
bt     %ecx,%edx
jb     1122 <is_operator+0x22>
xor    %eax,%eax
cmp    $0x5e,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @is_operator(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 43
br i1 %5, label %22, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 45
br i1 %9, label %22, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 42
br i1 %13, label %22, label %14
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 47
br i1 %17, label %22, label %18
18: ; preds = %14
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 94
br label %22
22: ; preds = %18, %14, %10, %6, %1
%23 = phi i1 [ true, %14 ], [ true, %10 ], [ true, %6 ], [ true, %1 ], [ %21, %18 ]
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @is_operator(i8 signext %0) {
%2 = add i8 %0, -42
%3 = icmp ult i8 %2, 6
br i1 %3, label %7, label %4
4: ; preds = %7, %1
%5 = icmp eq i8 %0, 94
%6 = zext i1 %5 to i32
br label %11
7: ; preds = %1
%8 = lshr i8 43, %2
%9 = and i8 %8, 1
%10 = icmp eq i8 %9, 0
br i1 %10, label %4, label %11
11: ; preds = %7, %4
%12 = phi i32 [ %6, %4 ], [ 1, %7 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int *);
int /*<<< orphan*/ stderr;
void sig_handler(int sig) {
  int var;
  fprintf(stderr, "caught signal, local var is on %p\n", &var);
}


x86 assembly (clang, -O0):
<sig_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
lea    0xed5(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_handler>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <fprintf@plt>
pop    %rax
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"caught signal, local var is on %p\0A\00"
define void @sig_handler(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* @stderr
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32* %3)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"caught signal, local var is on %p\0A\00"
define void @sig_handler(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @stderr
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32* %2)
ret void
}
int test_imm_D4int16_reg(short val) {
  return ((val) & (0xD4 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_D4int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xd4,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_D4int16_reg>:
test   $0xd4,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_D4int16_reg(i16 signext %0) {
%2 = and i16 %0, 212
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int test_imm_BDint8_mem(signed char *val) {
  return ((*val) & (0xBD << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_BDint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0xbd,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_BDint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, 189
%7 = icmp ne i32 %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_BDint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -67
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int Re(int /*<<< orphan*/);
int /*<<< orphan*/ T();
int /*<<< orphan*/ printf(char *);
int E() {
  printf("E->TRe\n");
  return Re(T());
}


x86 assembly (clang, -O0):
<E>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <T@plt>
mov    %eax,%edi
call   1050 <Re@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<E>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <T@plt>
mov    %eax,%edi
pop    %rax
jmp    1050 <Re@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"E->TRe\0A\00"
define i32 @E() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @T()
%3 = call i32 @Re(i32 %2)
ret i32 %3
}

LLVM IR (-O2):
@str = [7 x i8] c"E->TRe\00"
define i32 @E() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @T()
%3 = tail call i32 @Re(i32 %2)
ret i32 %3
}
/* Variables and functions */
void suspend_power_down(void) {}


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

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

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

LLVM IR (-O2):
define void @suspend_power_down() {
ret void
}
double(atan2)(double y, double x) { return 0.0; }


x86 assembly (clang, -O0):
<atan2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
xorps  %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<atan2>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @atan2(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @atan2(double %0, double %1) {
ret double 0.000000e+00
}
float sqrtf(float x __attribute__((unused))) { return 0.0; }


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

x86 assembly (clang, -O2):
<sqrtf>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @sqrtf(float %0) {
%2 = alloca float
store float %0, float* %2
ret float 0.000000e+00
}

LLVM IR (-O2):
define float @sqrtf(float %0) {
ret float 0.000000e+00
}
/* Variables and functions */
int /*<<< orphan*/ i();
int /*<<< orphan*/ j();
int rand();
void h() {
  if (rand() % 2 == 0)
    i();
  else
    j();
}


x86 assembly (clang, -O0):
<h>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1158 <h+0x28>
mov    $0x0,%al
call   1040 <i@plt>
jmp    115f <h+0x2f>
mov    $0x0,%al
call   1030 <j@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<h>:
push   %rax
xor    %eax,%eax
call   1050 <rand@plt>
test   $0x1,%al
jne    1144 <h+0x14>
xor    %eax,%eax
pop    %rcx
jmp    1040 <i@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <j@plt>

LLVM IR (-O0):
define void @h() {
%1 = call i32 (...) @rand()
%2 = srem i32 %1, 2
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @i()
br label %8
6: ; preds = %0
%7 = call i32 (...) @j()
br label %8
8: ; preds = %6, %4
ret void
}

LLVM IR (-O2):
define void @h() {
%1 = tail call i32 (...) @rand()
%2 = and i32 %1, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 (...) @i()
br label %8
6: ; preds = %0
%7 = tail call i32 (...) @j()
br label %8
8: ; preds = %6, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ power(int, int);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main(int argc, const char *argv[]) {
  printf("%lf\n", power(2, 3));
  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    $0x2,%edi
mov    $0x3,%esi
call   1030 <power@plt>
mov    %eax,%esi
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"%lf\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @power(i32 2, i32 3)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
scalar_t__ isalpha(char const);
int is_alpha_or_num(const char ch) {
  if (isalpha(ch) || (ch >= '0' && ch <= '9')) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_alpha_or_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%edi
call   1030 <isalpha@plt>
cmp    $0x0,%rax
jne    114b <is_alpha_or_num+0x3b>
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1157 <is_alpha_or_num+0x47>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1157 <is_alpha_or_num+0x47>
movl   $0x1,-0x4(%rbp)
jmp    115e <is_alpha_or_num+0x4e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_alpha_or_num>:
push   %rbx
mov    %edi,%ebx
call   1030 <isalpha@plt>
test   %rax,%rax
setne  %al
lea    -0x30(%rbx),%ecx
cmp    $0xa,%cl
setb   %cl
or     %al,%cl
movzbl %cl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_alpha_or_num(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = call i64 @isalpha(i8 signext %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sge i32 %9, 48
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = icmp sle i32 %13, 57
br i1 %14, label %15, label %16
15: ; preds = %11, %1
store i32 1, i32* %2
br label %17
16: ; preds = %11, %7
store i32 0, i32* %2
br label %17
17: ; preds = %16, %15
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @is_alpha_or_num(i8 signext %0) {
%2 = tail call i64 @isalpha(i8 signext %0)
%3 = icmp ne i64 %2, 0
%4 = add i8 %0, -48
%5 = icmp ult i8 %4, 10
%6 = or i1 %5, %3
%7 = zext i1 %6 to i32
ret i32 %7
}
int sort_string(s1, s2) const void *s1, *s2;
{ return strcmp(*(char *const *)s1, *(char *const *)s2); }


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

x86 assembly (clang, -O2):
<sort_string>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @sort_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 = bitcast i8* %5 to i8**
%7 = load i8*, i8** %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i8**
%10 = load i8*, i8** %9
%11 = call i32 @strcmp(i8* %7, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @sort_string(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ clear_io_bit(int, int);
void TOSH_CLR_CC_FIFOP_PIN() { clear_io_bit(-4, 1); }


x86 assembly (clang, -O0):
<TOSH_CLR_CC_FIFOP_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffffffc,%edi
mov    $0x1,%esi
call   1030 <clear_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_CLR_CC_FIFOP_PIN>:
mov    $0xfffffffc,%edi
mov    $0x1,%esi
jmp    1030 <clear_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_CLR_CC_FIFOP_PIN() {
%1 = call i32 @clear_io_bit(i32 -4, i32 1)
ret void
}

LLVM IR (-O2):
define void @TOSH_CLR_CC_FIFOP_PIN() {
%1 = tail call i32 @clear_io_bit(i32 -4, i32 1)
ret void
}
int rtc_add_groups(struct rtc_device *rtc,
                   const struct attribute_group **grps) {
  return 0;
}


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

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

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

LLVM IR (-O2):
%struct.rtc_device = type opaque
%struct.attribute_group = type opaque
define i32 @rtc_add_groups(%struct.rtc_device* nocapture readnone %0, %struct.attribute_group** nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
char *malloc(size_t);
char *emalloc(size_t size) {
  char *p = malloc(size);
  if (p == NULL)
    error("Insufficient memory");
  return p;
}


x86 assembly (clang, -O0):
<emalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1150 <emalloc+0x30>
lea    0xeb5(%rip),%rdi
call   1040 <error@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emalloc>:
push   %rbx
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <emalloc+0x1a>
lea    0xecb(%rip),%rdi
call   1040 <error@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [20 x i8] c"Insufficient memory\00"
define noalias i8* @emalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Type definitions */
struct termios {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ TCSAFLUSH;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ tcsetattr(int, int /*<<< orphan*/, struct termios *);
void tty_close(int fd, struct termios *sv_tios) {
  tcsetattr(fd, TCSAFLUSH, sv_tios);
  close(fd);
}


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

x86 assembly (clang, -O2):
<tty_close>:
push   %rbx
mov    %rsi,%rdx
mov    %edi,%ebx
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
call   1040 <tcsetattr@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <close@plt>

LLVM IR (-O0):
%struct.termios = type { i32 }
@TCSAFLUSH = global i32 0
define void @tty_close(i32 %0, %struct.termios* %1) {
%3 = alloca i32
%4 = alloca %struct.termios*
store i32 %0, i32* %3
store %struct.termios* %1, %struct.termios** %4
%5 = load i32, i32* %3
%6 = load i32, i32* @TCSAFLUSH
%7 = load %struct.termios*, %struct.termios** %4
%8 = call i32 @tcsetattr(i32 %5, i32 %6, %struct.termios* %7)
%9 = load i32, i32* %3
%10 = call i32 @close(i32 %9)
ret void
}

LLVM IR (-O2):
%struct.termios = type { i32 }
@TCSAFLUSH = global i32 0
define void @tty_close(i32 %0, %struct.termios* %1) {
%3 = load i32, i32* @TCSAFLUSH
%4 = tail call i32 @tcsetattr(i32 %0, i32 %3, %struct.termios* %1)
%5 = tail call i32 @close(i32 %0)
ret void
}
int min3(int a, int b, int c) {
  int r;
  r = a;
  if (b < r)
    r = b;
  if (c < r)
    r = c;
  return r;
}


x86 assembly (clang, -O0):
<min3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1125 <min3+0x25>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1137 <min3+0x37>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min3>:
mov    %edi,%eax
cmp    %edi,%esi
cmovl  %esi,%eax
cmp    %edx,%eax
cmovg  %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @min3(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %0
%5 = select i1 %4, i32 %1, i32 %0
%6 = icmp sgt i32 %5, %2
%7 = select i1 %6, i32 %2, i32 %5
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ emit_movimm(int, int);
void do_preload_rhash(int r) { emit_movimm(0x1f0, r); }


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

x86 assembly (clang, -O2):
<do_preload_rhash>:
mov    %edi,%esi
mov    $0x1f0,%edi
jmp    1030 <emit_movimm@plt>

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

LLVM IR (-O2):
define void @do_preload_rhash(i32 %0) {
%2 = tail call i32 @emit_movimm(i32 496, i32 %0)
ret void
}