xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
size_t fwrite(void const *, size_t, size_t, int /*<<< orphan*/ *);
size_t pst_debug_fwrite(const void *ptr, size_t size, size_t nitems,
                        FILE *stream) {
  return fwrite(ptr, size, nitems, stream);
}


x86 assembly (clang, -O0):
<pst_debug_fwrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <fwrite@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pst_debug_fwrite>:
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
define i64 @pst_debug_fwrite(i8* %0, i64 %1, i64 %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i32* %3, i32** %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i64, i64* %7
%12 = load i32*, i32** %8
%13 = call i64 @fwrite(i8* %9, i64 %10, i64 %11, i32* %12)
ret i64 %13
}

LLVM IR (-O2):
define i64 @pst_debug_fwrite(i8* nocapture %0, i64 %1, i64 %2, i32* nocapture %3) {
%5 = tail call i64 @fwrite(i8* %0, i64 %1, i64 %2, i32* %3)
ret i64 %5
}
int isxdigit(const int c) {
  return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
         (c >= 'A' && c <= 'F');
}


x86 assembly (clang, -O0):
<isxdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x30,-0x4(%rbp)
jl     1120 <isxdigit+0x20>
mov    $0x1,%al
cmpl   $0x39,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    1158 <isxdigit+0x58>
cmpl   $0x61,-0x4(%rbp)
jl     1139 <isxdigit+0x39>
mov    $0x1,%al
cmpl   $0x66,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    1158 <isxdigit+0x58>
xor    %eax,%eax
cmpl   $0x41,-0x4(%rbp)
mov    %al,-0x6(%rbp)
jl     1152 <isxdigit+0x52>
cmpl   $0x46,-0x4(%rbp)
setle  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isxdigit>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%eax
setb   %al
and    $0xffffffdf,%edi
add    $0xffffffbf,%edi
cmp    $0x6,%edi
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @isxdigit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 48
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 57
br i1 %7, label %22, label %8
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = icmp sge i32 %9, 97
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp sle i32 %12, 102
br i1 %13, label %22, label %14
14: ; preds = %11, %8
%15 = load i32, i32* %2
%16 = icmp sge i32 %15, 65
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* %2
%19 = icmp sle i32 %18, 70
br label %20
20: ; preds = %17, %14
%21 = phi i1 [ false, %14 ], [ %19, %17 ]
br label %22
22: ; preds = %20, %11, %5
%23 = phi i1 [ true, %11 ], [ true, %5 ], [ %21, %20 ]
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @isxdigit(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = and i32 %0, -33
%5 = add i32 %4, -65
%6 = icmp ult i32 %5, 6
%7 = or i1 %3, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
long double test_remainderl(long double x, long double y) {
  return __builtin_remainderl(x, y);
}


x86 assembly (clang, -O0):
<test_remainderl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
fldt   -0x10(%rbp)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
call   1030 <remainderl@plt>
fld    %st(0)
fstp   %st(0)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_remainderl>:
jmp    1030 <remainderl@plt>

LLVM IR (-O0):
define x86_fp80 @test_remainderl(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %3
store x86_fp80 %1, x86_fp80* %4
%5 = load x86_fp80, x86_fp80* %3
%6 = load x86_fp80, x86_fp80* %4
%7 = call x86_fp80 @remainderl(x86_fp80 %5, x86_fp80 %6)
ret x86_fp80 %7
}

LLVM IR (-O2):
define x86_fp80 @test_remainderl(x86_fp80 %0, x86_fp80 %1) {
%3 = tail call x86_fp80 @remainderl(x86_fp80 %0, x86_fp80 %1)
ret x86_fp80 %3
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  long quot;
  long rem;
};
typedef TYPE_1__ ldiv_t;

/* Variables and functions */
ldiv_t ldiv(long numer, long denom) {
  ldiv_t result;
  result.quot = numer / denom;
  result.rem = numer - (result.quot * denom);
  return (result);
}


x86 assembly (clang, -O0):
<ldiv>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rdx
imul   %rdx,%rcx
sub    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldiv>:
mov    %rdi,%rax
mov    %rdi,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
je     1115 <ldiv+0x15>
cqto
idiv   %rsi
ret
xor    %edx,%edx
div    %esi
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64, i64 }
define { i64, i64 } @ldiv(i64 %0, i64 %1) {
%3 = alloca %struct.TYPE_3__
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%6 = load i64, i64* %4
%7 = load i64, i64* %5
%8 = sdiv i64 %6, %7
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 0
store i64 %8, i64* %9
%10 = load i64, i64* %4
%11 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 0
%12 = load i64, i64* %11
%13 = load i64, i64* %5
%14 = mul nsw i64 %12, %13
%15 = sub nsw i64 %10, %14
%16 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 1
store i64 %15, i64* %16
%17 = bitcast %struct.TYPE_3__* %3 to { i64, i64 }*
%18 = load { i64, i64 }, { i64, i64 }* %17
ret { i64, i64 } %18
}

LLVM IR (-O2):
define { i64, i64 } @ldiv(i64 %0, i64 %1) {
%3 = sdiv i64 %0, %1
%4 = mul nsw i64 %3, %1
%5 = srem i64 %0, %1
%6 = insertvalue { i64, i64 } poison, i64 %3, 0
%7 = insertvalue { i64, i64 } %6, i64 %5, 1
ret { i64, i64 } %7
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stdout;
void t_settitle(const char *title) { fprintf(stdout, "\033]0;%s\007", title); }


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

x86 assembly (clang, -O2):
<t_settitle>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [8 x i8] c"\1B]0;%s\07\00"
define void @t_settitle(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stdout
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [8 x i8] c"\1B]0;%s\07\00"
define void @t_settitle(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
unsigned xrop3_226_0_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = T ^ D;
  stk2 = S & stk3;
  stk1 = D ^ stk2;
  return (stk1 & S) | (stk1 & (~T)) | (T & (~S) & D);
}


x86 assembly (clang, -O0):
<xrop3_226_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
and    -0x8(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_226_0_1>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
mov    %esi,%ecx
shl    $0x8,%ecx
or     %esi,%ecx
mov    %ecx,%edx
xor    $0xff,%edx
and    %eax,%edx
mov    %edx,%r8d
xor    $0xff,%r8d
xor    %edi,%edx
not    %ecx
and    %r8d,%ecx
not    %eax
and    %esi,%eax
or     %edx,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_226_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = load i32, i32* %5
%25 = xor i32 %23, %24
store i32 %25, i32* %10
%26 = load i32, i32* %6
%27 = load i32, i32* %10
%28 = and i32 %26, %27
store i32 %28, i32* %9
%29 = load i32, i32* %5
%30 = load i32, i32* %9
%31 = xor i32 %29, %30
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = load i32, i32* %6
%34 = and i32 %32, %33
%35 = load i32, i32* %8
%36 = load i32, i32* %7
%37 = xor i32 %36, -1
%38 = and i32 %35, %37
%39 = or i32 %34, %38
%40 = load i32, i32* %7
%41 = load i32, i32* %6
%42 = xor i32 %41, -1
%43 = and i32 %40, %42
%44 = load i32, i32* %5
%45 = and i32 %43, %44
%46 = or i32 %39, %45
ret i32 %46
}

LLVM IR (-O2):
define i32 @xrop3_226_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = xor i32 %6, 255
%8 = and i32 %7, %4
%9 = xor i32 %8, 255
%10 = xor i32 %8, %3
%11 = xor i32 %6, -1
%12 = and i32 %9, %11
%13 = xor i32 %4, -1
%14 = and i32 %13, %5
%15 = or i32 %10, %14
%16 = or i32 %15, %12
ret i32 %16
}
unsigned short safe_53(int short ui1, int short ui2) { return ui1 - ui2; }


x86 assembly (clang, -O0):
<safe_53>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movswl -0x2(%rbp),%eax
movswl -0x4(%rbp),%ecx
sub    %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i16 @safe_53(i16 signext %0, i16 signext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = sext i16 %5 to i32
%7 = load i16, i16* %4
%8 = sext i16 %7 to i32
%9 = sub nsw i32 %6, %8
%10 = trunc i32 %9 to i16
ret i16 %10
}

LLVM IR (-O2):
define zeroext i16 @safe_53(i16 signext %0, i16 signext %1) {
%3 = sub i16 %0, %1
ret i16 %3
}
void Tshutdown(void) {}


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

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

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

LLVM IR (-O2):
define void @Tshutdown() {
ret void
}
int f(int *ptrParam) {
  *ptrParam = 10;
  return 5;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0xa,(%rax)
mov    $0x5,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movl   $0xa,(%rdi)
mov    $0x5,%eax
ret

LLVM IR (-O0):
define i32 @f(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
store i32 10, i32* %3
ret i32 5
}

LLVM IR (-O2):
define i32 @f(i32* nocapture writeonly %0) {
store i32 10, i32* %0
ret i32 5
}
/* Variables and functions */
void Default_IPC_IRQHandler(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<Default_IPC_IRQHandler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <Default_IPC_IRQHandler+0x9>
jmp    1109 <Default_IPC_IRQHandler+0x9>

x86 assembly (clang, -O2):
<Default_IPC_IRQHandler>:
jmp    1100 <Default_IPC_IRQHandler>

LLVM IR (-O0):
define void @Default_IPC_IRQHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @Default_IPC_IRQHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int *ptr = NULL;
  if (ptr != NULL)
    printf("%d\n", *ptr);
  if (ptr)
    printf("%d\n", *ptr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1144 <main+0x34>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
cmpq   $0x0,-0x10(%rbp)
je     1161 <main+0x51>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
typedef int uint32_t;
typedef int int32_t;

/* Variables and functions */
int32_t rand(void) {
  static uint32_t x = 0xfeb13;
  x ^= x << 13;
  x ^= x >> 17;
  x ^= x << 5;
  return x;
}


x86 assembly (clang, -O0):
<rand>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f16(%rip),%eax
shl    $0xd,%eax
xor    0x2f0d(%rip),%eax
mov    %eax,0x2f07(%rip)
mov    0x2f01(%rip),%eax
sar    $0x11,%eax
xor    0x2ef8(%rip),%eax
mov    %eax,0x2ef2(%rip)
mov    0x2eec(%rip),%eax
shl    $0x5,%eax
xor    0x2ee3(%rip),%eax
mov    %eax,0x2edd(%rip)
mov    0x2ed7(%rip),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand>:
mov    0x2f1a(%rip),%eax
mov    %eax,%ecx
shl    $0xd,%ecx
xor    %eax,%ecx
mov    %ecx,%edx
sar    $0x11,%edx
xor    %ecx,%edx
mov    %edx,%eax
shl    $0x5,%eax
xor    %edx,%eax
mov    %eax,0x2eff(%rip)
ret

LLVM IR (-O0):
@rand.x = internal global i32 1043219
define i32 @rand() {
%1 = load i32, i32* @rand.x
%2 = shl i32 %1, 13
%3 = load i32, i32* @rand.x
%4 = xor i32 %3, %2
store i32 %4, i32* @rand.x
%5 = load i32, i32* @rand.x
%6 = ashr i32 %5, 17
%7 = load i32, i32* @rand.x
%8 = xor i32 %7, %6
store i32 %8, i32* @rand.x
%9 = load i32, i32* @rand.x
%10 = shl i32 %9, 5
%11 = load i32, i32* @rand.x
%12 = xor i32 %11, %10
store i32 %12, i32* @rand.x
%13 = load i32, i32* @rand.x
ret i32 %13
}

LLVM IR (-O2):
@rand.x = internal unnamed_addr global i32 1043219
define i32 @rand() {
%1 = load i32, i32* @rand.x
%2 = shl i32 %1, 13
%3 = xor i32 %2, %1
%4 = ashr i32 %3, 17
%5 = xor i32 %4, %3
%6 = shl i32 %5, 5
%7 = xor i32 %6, %5
store i32 %7, i32* @rand.x
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ pr_info(char *);
int myinit(void) {
  pr_info("init buildroot\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<myinit>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <pr_info@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"init buildroot\0A\00"
define i32 @myinit() {
%1 = call i32 @pr_info(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"init buildroot\0A\00"
define i32 @myinit() {
%1 = tail call i32 @pr_info(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
scalar_t__ isnan(double);
double fmax2(double x, double y) {
  if (isnan(x) || isnan(y))
    return x + y;
  return (x < y) ? y : x;
}


x86 assembly (clang, -O0):
<fmax2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <isnan@plt>
cmp    $0x0,%rax
jne    114a <fmax2+0x3a>
movsd  -0x18(%rbp),%xmm0
call   1030 <isnan@plt>
cmp    $0x0,%rax
je     115e <fmax2+0x4e>
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1195 <fmax2+0x85>
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1181 <fmax2+0x71>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    118b <fmax2+0x7b>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmax2>:
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
call   1030 <isnan@plt>
test   %rax,%rax
jne    113a <fmax2+0x2a>
movsd  0x8(%rsp),%xmm0
call   1030 <isnan@plt>
test   %rax,%rax
je     114b <fmax2+0x3b>
movsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret
movsd  0x8(%rsp),%xmm0
maxsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @fmax2(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = call i64 @isnan(double %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = load double, double* %5
%11 = call i64 @isnan(double %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %9, %2
%14 = load double, double* %4
%15 = load double, double* %5
%16 = fadd double %14, %15
store double %16, double* %3
br label %27
17: ; preds = %9
%18 = load double, double* %4
%19 = load double, double* %5
%20 = fcmp olt double %18, %19
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = load double, double* %5
br label %25
23: ; preds = %17
%24 = load double, double* %4
br label %25
25: ; preds = %23, %21
%26 = phi double [ %22, %21 ], [ %24, %23 ]
store double %26, double* %3
br label %27
27: ; preds = %25, %13
%28 = load double, double* %3
ret double %28
}

LLVM IR (-O2):
define double @fmax2(double %0, double %1) {
%3 = tail call i64 @isnan(double %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i64 @isnan(double %1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5, %2
%9 = fadd double %0, %1
br label %13
10: ; preds = %5
%11 = fcmp olt double %0, %1
%12 = select i1 %11, double %1, double %0
br label %13
13: ; preds = %10, %8
%14 = phi double [ %9, %8 ], [ %12, %10 ]
ret double %14
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ jenkins_hash_int32(int /*<<< orphan*/);
uint32_t hash_var(int32_t x) { return jenkins_hash_int32(x); }


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

x86 assembly (clang, -O2):
<hash_var>:
jmp    1030 <jenkins_hash_int32@plt>

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

LLVM IR (-O2):
define i32 @hash_var(i32 %0) {
%2 = tail call i32 @jenkins_hash_int32(i32 %0)
ret i32 %2
}
int foo(int bar) {
  bar -= 3;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
ret i32 0
}
other_func(booo) { echo("other_func", booo); }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"other_func\00"
define i32 @other_func(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @echo to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
@.str = [11 x i8] c"other_func\00"
define i32 @other_func(i32 %0) {
%2 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @echo to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 undef
}
int func0(void) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @func0() {
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
int genBitCount_uint64_t(uint64_t v) {
  unsigned c;
  for (c = 0; v; c++)
    v &= v - 1;
  return c;
}


x86 assembly (clang, -O0):
<genBitCount_uint64_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1138 <genBitCount_uint64_t+0x38>
mov    -0x8(%rbp),%rax
sub    $0x1,%rax
and    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <genBitCount_uint64_t+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<genBitCount_uint64_t>:
xor    %eax,%eax
test   %rdi,%rdi
je     111c <genBitCount_uint64_t+0x1c>
nopw   0x0(%rax,%rax,1)
lea    -0x1(%rdi),%rcx
add    $0x1,%eax
and    %rcx,%rdi
jne    1110 <genBitCount_uint64_t+0x10>
ret

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

LLVM IR (-O2):
define i32 @genBitCount_uint64_t(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = phi i64 [ %7, %3 ], [ %0, %1 ]
%6 = add nsw i64 %5, -1
%7 = and i64 %6, %5
%8 = add i32 %4, 1
%9 = icmp eq i64 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %11
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int clear_multprec_tracker(void) {
  int fail, *a, *b;
  double *c;
  fail = _ada_use_c2phc(515, a, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<clear_multprec_tracker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x203,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_multprec_tracker>:
mov    $0x203,%edi
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @clear_multprec_tracker() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca double*
%5 = load i32*, i32** %2
%6 = load i32*, i32** %3
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc(i32 515, i32* %5, i32* %6, double* %7)
store i32 %8, i32* %1
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
define i32 @clear_multprec_tracker() {
%1 = tail call i32 @_ada_use_c2phc(i32 515, i32* undef, i32* undef, double* undef)
ret i32 %1
}
int map_init(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @map_init() {
ret i32 0
}
void machine_callstack(unsigned long *buf, int callstack_max) {}


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

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

LLVM IR (-O0):
define void @machine_callstack(i64* %0, i32 %1) {
%3 = alloca i64*
%4 = alloca i32
store i64* %0, i64** %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @machine_callstack(i64* nocapture %0, i32 %1) {
ret void
}
void f(char *a) {
  int *a1 = (int *)a;
  if (*a == 0)
    asm("" : "=m"(*a1));
  if (*a == 0)
    link_error();
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1138 <f+0x28>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    114f <f+0x3f>
mov    $0x0,%al
call   1030 <link_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
cmpb   $0x0,(%rdi)
jne    111a <f+0xa>
cmpb   $0x0,(%rdi)
je     111b <f+0xb>
ret
xor    %eax,%eax
jmp    1030 <link_error@plt>

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

LLVM IR (-O2):
define void @f(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %10
4: ; preds = %1
%5 = bitcast i8* %0 to i32*
tail call void asm "", "=*m,~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %5)
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 (...) @link_error()
br label %10
10: ; preds = %1, %8, %4
ret void
}
/* Variables and functions */
int collatz(int /*<<< orphan*/);
int /*<<< orphan*/ getchar(char *);
int main() { return collatz(getchar(">")); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1040 <getchar@plt>
mov    %eax,%edi
call   1030 <collatz@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <getchar@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <collatz@plt>

LLVM IR (-O0):
@.str = [2 x i8] c">\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @getchar(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @collatz(i32 %2)
ret i32 %3
}

LLVM IR (-O2):
@.str = [2 x i8] c">\00"
define i32 @main() {
%1 = tail call i32 @getchar(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @collatz(i32 %1)
ret i32 %2
}
void ary_2d_set_at(unsigned long *ary, unsigned long ridx, unsigned long cidx,
                   unsigned long ncols, unsigned long val) {
  ary[(ridx * ncols) + cidx] = val;
}


x86 assembly (clang, -O0):
<ary_2d_set_at>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x28(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
imul   -0x20(%rbp),%rcx
add    -0x18(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ary_2d_set_at>:
imul   %rcx,%rsi
add    %rdx,%rsi
mov    %r8,(%rdi,%rsi,8)
ret

LLVM IR (-O0):
define void @ary_2d_set_at(i64* %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca i64*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i64* %0, i64** %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i64 %4, i64* %10
%11 = load i64, i64* %10
%12 = load i64*, i64** %6
%13 = load i64, i64* %7
%14 = load i64, i64* %9
%15 = mul i64 %13, %14
%16 = load i64, i64* %8
%17 = add i64 %15, %16
%18 = getelementptr inbounds i64, i64* %12, i64 %17
store i64 %11, i64* %18
ret void
}

LLVM IR (-O2):
define void @ary_2d_set_at(i64* nocapture writeonly %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = mul i64 %3, %1
%7 = add i64 %6, %2
%8 = getelementptr inbounds i64, i64* %0, i64 %7
store i64 %4, i64* %8
ret void
}
void *git___compare_and_swap(volatile void **ptr, void *oldval, void *newval) {
  if (*ptr == oldval)
    *ptr = newval;
  else
    oldval = newval;
  return oldval;
}


x86 assembly (clang, -O0):
<git___compare_and_swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
cmp    -0x10(%rbp),%rax
jne    1131 <git___compare_and_swap+0x31>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
jmp    1139 <git___compare_and_swap+0x39>
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<git___compare_and_swap>:
cmp    %rsi,(%rdi)
je     1109 <git___compare_and_swap+0x9>
mov    %rdx,%rax
ret
mov    %rsi,%rax
mov    %rdx,(%rdi)
ret

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

LLVM IR (-O2):
define i8* @git___compare_and_swap(i8** nocapture %0, i8* readnone %1, i8* %2) {
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, %1
br i1 %5, label %6, label %7
6: ; preds = %3
store i8* %2, i8** %0
br label %7
7: ; preds = %3, %6
%8 = phi i8* [ %1, %6 ], [ %2, %3 ]
ret i8* %8
}
int larger1(int x, int y) {
  if (y > x)
    return y;
  return x;
}


x86 assembly (clang, -O0):
<larger1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <larger1+0x21>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <larger1+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @larger1(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* %5
%7 = load i32, i32* %4
%8 = icmp sgt i32 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32, i32* %5
store i32 %10, i32* %3
br label %13
11: ; preds = %2
%12 = load i32, i32* %4
store i32 %12, i32* %3
br label %13
13: ; preds = %11, %9
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @larger1(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, %0
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
int foo(volatile int a) { return (char)a; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %edi,-0x4(%rsp)
mov    -0x4(%rsp),%eax
movsbl %al,%eax
ret

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
store volatile i32 %0, i32* %2
%3 = load volatile i32, i32* %2
%4 = trunc i32 %3 to i8
%5 = sext i8 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = alloca i32
store volatile i32 %0, i32* %2
%3 = load volatile i32, i32* %2
%4 = shl i32 %3, 24
%5 = ashr exact i32 %4, 24
ret i32 %5
}
/* Type definitions */
typedef char *uint64_t;

/* Variables and functions */
uint64_t cpu_read_rflags() {
  uint64_t rflags;
  __asm__ __volatile__("pushfq;"
                       "movq (%%rsp), %0;"
                       "addq  $8, %%rsp;"
                       : "=a"(rflags)
                       :);
  return rflags;
}


x86 assembly (clang, -O0):
<cpu_read_rflags>:
push   %rbp
mov    %rsp,%rbp
pushf
mov    (%rsp),%rax
add    $0x8,%rsp
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_read_rflags>:
pushf
mov    (%rsp),%rax
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i8* @cpu_read_rflags() {
%1 = alloca i8*
%2 = call i8* asm sideeffect "pushfq;movq (%rsp), $0;addq $$8, %rsp;", "={ax},~{dirflag},~{fpsr},~{flags}"()
store i8* %2, i8** %1
%3 = load i8*, i8** %1
ret i8* %3
}

LLVM IR (-O2):
define i8* @cpu_read_rflags() {
%1 = tail call i8* asm sideeffect "pushfq;movq (%rsp), $0;addq $$8, %rsp;", "={ax},~{dirflag},~{fpsr},~{flags}"()
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ free(double *);
void md_free_double(double *fld) {
  free(fld);
  fld = NULL;
}


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

x86 assembly (clang, -O2):
<md_free_double>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @md_free_double(double* nocapture %0) {
%2 = tail call i32 @free(double* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int ENOSYS;
int sigwait(const sigset_t *set, int *sig) { return ENOSYS; }


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

x86 assembly (clang, -O2):
<sigwait>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @sigwait(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32, i32* @ENOSYS
ret i32 %5
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @sigwait(i32* nocapture readnone %0, i32* nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
ret i32 %3
}
unsigned long readVAC(unsigned long add) {
  return (
      (*((unsigned long *)((((0xFFFD0000 | (add << 8)) >> 2) | 0xB0000000))) >>
       16));
}


x86 assembly (clang, -O0):
<readVAC>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x8,%rax
movabs $0xfffd0000,%rcx
or     %rcx,%rax
shr    $0x2,%rax
movabs $0xb0000000,%rcx
or     %rcx,%rax
mov    (%rax),%rax
shr    $0x10,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<readVAC>:
shl    $0x6,%rdi
movabs $0x3fffffff4000bfc0,%rax
ff ff 3f
and    %rdi,%rax
mov    $0xbfff4000,%ecx
mov    (%rax,%rcx,1),%rax
shr    $0x10,%rax
ret

LLVM IR (-O0):
define i64 @readVAC(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = shl i64 %3, 8
%5 = or i64 4294770688, %4
%6 = lshr i64 %5, 2
%7 = or i64 %6, 2952790016
%8 = inttoptr i64 %7 to i64*
%9 = load i64, i64* %8
%10 = lshr i64 %9, 16
ret i64 %10
}

LLVM IR (-O2):
define i64 @readVAC(i64 %0) {
%2 = shl i64 %0, 6
%3 = and i64 %2, 4611686015206211520
%4 = or i64 %3, 3221176320
%5 = inttoptr i64 %4 to i64*
%6 = load i64, i64* %5
%7 = lshr i64 %6, 16
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ rot13_test();
int main() {
  printf("ROT-13 tests: %s\n", rot13_test() ? "SUCCEEDED" : "FAILED");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <rot13_test@plt>
mov    %rax,%rcx
lea    0xedc(%rip),%rsi
lea    0xecb(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <rot13_test@plt>
test   %rax,%rax
lea    0xeea(%rip),%rax
lea    0xed9(%rip),%rsi
cmove  %rax,%rsi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"ROT-13 tests: %s\0A\00"
@.str.1 = [10 x i8] c"SUCCEEDED\00"
@.str.2 = [7 x i8] c"FAILED\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 (...) @rot13_test()
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i64
%5 = select i1 %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0)
%6 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"ROT-13 tests: %s\0A\00"
@.str.1 = [10 x i8] c"SUCCEEDED\00"
@.str.2 = [7 x i8] c"FAILED\00"
define i32 @main() {
%1 = tail call i64 (...) @rot13_test()
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
void print_float(float f) { printf("%.2f", f); }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"%.2f\00"
define void @print_float(float %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void out_of_memory() {
  fprintf(stderr, "Fatal error: Out of memory for malloc.\n");
  exit(1);
}


x86 assembly (clang, -O0):
<out_of_memory>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<out_of_memory>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [40 x i8] c"Fatal error: Out of memory for malloc.\0A\00"
define void @out_of_memory() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [40 x i8] c"Fatal error: Out of memory for malloc.\0A\00"
define void @out_of_memory() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ foo(int, int, int, int, int);
int main() {
  if (foo(2, 3, 1, 1, 1) == 0)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2,%edi
mov    $0x3,%esi
mov    $0x1,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1040 <foo@plt>
cmp    $0x0,%rax
jne    115b <main+0x3b>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
mov    $0x3,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
mov    $0x1,%r8d
call   1040 <foo@plt>
test   %rax,%rax
je     1149 <main+0x29>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @foo(i32 2, i32 3, i32 1, i32 1, i32 1)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @foo(i32 2, i32 3, i32 1, i32 1, i32 1)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
ret i32 0
}
int bit_isset(unsigned char *set, unsigned bit) {
  return set[bit / 8] & (1 << (bit % 8));
}


x86 assembly (clang, -O0):
<bit_isset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shr    $0x3,%ecx
mov    %ecx,%ecx
movzbl (%rax,%rcx,1),%eax
mov    -0xc(%rbp),%ecx
and    $0x7,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_isset>:
mov    %esi,%ecx
mov    %esi,%eax
shr    $0x3,%rax
movzbl (%rdi,%rax,1),%edx
and    $0x7,%cl
mov    $0x1,%eax
shl    %cl,%eax
and    %edx,%eax
ret

LLVM IR (-O0):
define i32 @bit_isset(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 = udiv i32 %6, 8
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %5, i64 %8
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = load i32, i32* %4
%13 = urem i32 %12, 8
%14 = shl i32 1, %13
%15 = and i32 %11, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @bit_isset(i8* nocapture %0, i32 %1) {
%3 = lshr i32 %1, 3
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = and i32 %1, 7
%9 = shl nuw nsw i32 1, %8
%10 = and i32 %9, %7
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Hello, World!\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"Hello, World!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [14 x i8] c"Hello, World!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int, char, double);
int main(void) {
  printf("%10s%10d%10c%10f\n\n", "hello", 7, 'a', 1.23);
  printf("%-10s%-10d%-10c%-10f\n", "hello", 7, 'a', 1.23);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee2(%rip),%rdi
lea    0xeee(%rip),%rsi
mov    $0x7,%edx
mov    $0x61,%ecx
movsd  0xec1(%rip),%xmm0
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
lea    0xec9(%rip),%rsi
mov    $0x7,%edx
mov    $0x61,%ecx
movsd  0xe9c(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xef0(%rip),%rdi
lea    0xefc(%rip),%rbx
movsd  0xed9(%rip),%xmm0
mov    %rbx,%rsi
mov    $0x7,%edx
mov    $0x61,%ecx
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
mov    %rbx,%rsi
mov    $0x7,%edx
mov    $0x61,%ecx
movsd  0xeab(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"%10s%10d%10c%10f\0A\0A\00"
@.str.1 = [6 x i8] c"hello\00"
@.str.2 = [22 x i8] c"%-10s%-10d%-10c%-10f\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 7, i8 signext 97, double 1.230000e+00)
%3 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 7, i8 signext 97, double 1.230000e+00)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"%10s%10d%10c%10f\0A\0A\00"
@.str.1 = [6 x i8] c"hello\00"
@.str.2 = [22 x i8] c"%-10s%-10d%-10c%-10f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 7, i8 signext 97, double 1.230000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 7, i8 signext 97, double 1.230000e+00)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ wCreateNumConst(char *, int);
void wInitConsts() {
  wCreateNumConst("True", !0);
  wCreateNumConst("False", 0);
  wCreateNumConst("NULL", 0);
}


x86 assembly (clang, -O0):
<wInitConsts>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x1,%esi
call   1030 <wCreateNumConst@plt>
lea    0xed9(%rip),%rdi
xor    %esi,%esi
call   1030 <wCreateNumConst@plt>
lea    0xed1(%rip),%rdi
xor    %esi,%esi
call   1030 <wCreateNumConst@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<wInitConsts>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x1,%esi
call   1030 <wCreateNumConst@plt>
lea    0xedc(%rip),%rdi
xor    %esi,%esi
call   1030 <wCreateNumConst@plt>
lea    0xed4(%rip),%rdi
xor    %esi,%esi
pop    %rax
jmp    1030 <wCreateNumConst@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"True\00"
@.str.1 = [6 x i8] c"False\00"
@.str.2 = [5 x i8] c"NULL\00"
define void @wInitConsts() {
%1 = call i32 @wCreateNumConst(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = call i32 @wCreateNumConst(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 0)
%3 = call i32 @wCreateNumConst(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"True\00"
@.str.1 = [6 x i8] c"False\00"
@.str.2 = [5 x i8] c"NULL\00"
define void @wInitConsts() {
%1 = tail call i32 @wCreateNumConst(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = tail call i32 @wCreateNumConst(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 0)
%3 = tail call i32 @wCreateNumConst(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ put8(int);
void cdq() { put8(0x99); }


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

x86 assembly (clang, -O2):
<cdq>:
mov    $0x99,%edi
jmp    1030 <put8@plt>

LLVM IR (-O0):
define void @cdq() {
%1 = call i32 @put8(i32 153)
ret void
}

LLVM IR (-O2):
define void @cdq() {
%1 = tail call i32 @put8(i32 153)
ret void
}