xunge/DecIR huggingface dataset:
/* Variables and functions */
int is_prime(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a, rez;
  scanf("%d", &a);
  rez = is_prime(a);
  printf("%d", rez);
  return rez;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1040 <is_prime@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <is_prime@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @is_prime(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ nullf(char *);
int /*<<< orphan*/ output_byte(int);
void emit_fsqrt() {
  nullf("fsqrt\n");
  output_byte(0xd9);
  output_byte(0xfa);
}


x86 assembly (clang, -O0):
<emit_fsqrt>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <nullf@plt>
mov    $0xd9,%edi
call   1040 <output_byte@plt>
mov    $0xfa,%edi
call   1040 <output_byte@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_fsqrt>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <nullf@plt>
mov    $0xd9,%edi
call   1040 <output_byte@plt>
mov    $0xfa,%edi
pop    %rax
jmp    1040 <output_byte@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"fsqrt\0A\00"
define void @emit_fsqrt() {
%1 = call i32 @nullf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @output_byte(i32 217)
%3 = call i32 @output_byte(i32 250)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"fsqrt\0A\00"
define void @emit_fsqrt() {
%1 = tail call i32 @nullf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @output_byte(i32 217)
%3 = tail call i32 @output_byte(i32 250)
ret void
}
int bitadd(int a, int b) { return (b ? bitadd(a ^ b, (a & b) << 1) : a); }


x86 assembly (clang, -O0):
<bitadd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1144 <bitadd+0x34>
mov    -0x4(%rbp),%edi
xor    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
and    -0x8(%rbp),%esi
shl    $0x1,%esi
call   1030 <bitadd@plt>
mov    %eax,-0xc(%rbp)
jmp    114a <bitadd+0x3a>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitadd>:
test   %esi,%esi
je     111d <bitadd+0x1d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %esi,%eax
xor    %edi,%eax
and    %edi,%esi
mov    %eax,%edi
add    %esi,%esi
jne    1110 <bitadd+0x10>
ret
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @bitadd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %2
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = xor i32 %8, %9
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = and i32 %11, %12
%14 = shl i32 %13, 1
%15 = call i32 @bitadd(i32 %10, i32 %14)
br label %18
16: ; preds = %2
%17 = load i32, i32* %3
br label %18
18: ; preds = %16, %7
%19 = phi i32 [ %15, %7 ], [ %17, %16 ]
ret i32 %19
}

LLVM IR (-O2):
define i32 @bitadd(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %11, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %9, %4 ], [ %1, %2 ]
%6 = phi i32 [ %7, %4 ], [ %0, %2 ]
%7 = xor i32 %5, %6
%8 = and i32 %5, %6
%9 = shl i32 %8, 1
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %2
%12 = phi i32 [ %0, %2 ], [ %7, %4 ]
ret i32 %12
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int crc32_no_comp(int, unsigned char const *, unsigned int);
uint32_t crc32(uint32_t crc, const unsigned char *p, unsigned int len) {
  return crc32_no_comp(crc ^ 0xffffffffL, p, len) ^ 0xffffffffL;
}


x86 assembly (clang, -O0):
<crc32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movslq -0x4(%rbp),%rax
movabs $0xffffffff,%rcx
xor    %rcx,%rax
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <crc32_no_comp@plt>
cltq
movabs $0xffffffff,%rcx
xor    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crc32>:
push   %rax
not    %edi
call   1030 <crc32_no_comp@plt>
not    %eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @crc32(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = xor i64 %8, 4294967295
%10 = trunc i64 %9 to i32
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = call i32 @crc32_no_comp(i32 %10, i8* %11, i32 %12)
%14 = sext i32 %13 to i64
%15 = xor i64 %14, 4294967295
%16 = trunc i64 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @crc32(i32 %0, i8* %1, i32 %2) {
%4 = xor i32 %0, -1
%5 = tail call i32 @crc32_no_comp(i32 %4, i8* %1, i32 %2)
%6 = xor i32 %5, -1
ret i32 %6
}
void rop3_9_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = *D ^ S;
  stk1 = T | stk2;
  stk1 = ~stk1;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


x86 assembly (clang, -O0):
<rop3_9_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0x9(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
movzbl -0xa(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0xa(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_9_1_1>:
mov    (%rdi),%al
mov    %eax,%ecx
xor    %sil,%cl
or     %esi,%edx
or     %dl,%cl
not    %cl
and    %dl,%al
or     %cl,%al
mov    %al,(%rdi)
ret

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

LLVM IR (-O2):
define void @rop3_9_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = xor i8 %4, %1
%6 = or i8 %2, %1
%7 = or i8 %6, %5
%8 = xor i8 %7, -1
%9 = and i8 %4, %6
%10 = or i8 %9, %8
store i8 %10, i8* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int sd_bus_creds_get_gid(void *c,
                                                                gid_t *gid) {
  return -EINVAL;
}


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

x86 assembly (clang, -O2):
<sd_bus_creds_get_gid>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_bus_creds_get_gid(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = load i32, i32* @EINVAL
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_bus_creds_get_gid(i8* nocapture readnone %0, i32* nocapture readnone %1) {
%3 = load i32, i32* @EINVAL
%4 = sub nsw i32 0, %3
ret i32 %4
}
/* Variables and functions */
float expl(float);
float expf(float x) { return expl(x); }


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

x86 assembly (clang, -O2):
<expf>:
jmp    1030 <expl@plt>

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

LLVM IR (-O2):
define float @expf(float %0) {
%2 = tail call float @expl(float %0)
ret float %2
}
void rop3_155_0_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = T | S;
  stk2 = *D & stk3;
  stk1 = S ^ stk2;
  stk1 = ~stk1;
  *D = (stk1 & S) | (stk1 & (~T)) | (T & (~S) & *D);
}


x86 assembly (clang, -O0):
<rop3_155_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0x9(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xd(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
movzbl -0xb(%rbp),%ecx
movzbl -0xa(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
movzbl -0xa(%rbp),%ecx
movzbl -0x9(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
mov    -0x8(%rbp),%rdx
movzbl (%rdx),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_155_0_1>:
mov    %edx,%eax
or     %sil,%al
and    (%rdi),%al
xor    %al,%sil
or     %dl,%sil
not    %sil
or     %al,%sil
mov    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_155_0_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8, i8* %6
%11 = zext i8 %10 to i32
%12 = load i8, i8* %5
%13 = zext i8 %12 to i32
%14 = or i32 %11, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %9
%16 = load i8*, i8** %4
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = load i8, i8* %9
%20 = zext i8 %19 to i32
%21 = and i32 %18, %20
%22 = trunc i32 %21 to i8
store i8 %22, i8* %8
%23 = load i8, i8* %5
%24 = zext i8 %23 to i32
%25 = load i8, i8* %8
%26 = zext i8 %25 to i32
%27 = xor i32 %24, %26
%28 = trunc i32 %27 to i8
store i8 %28, i8* %7
%29 = load i8, i8* %7
%30 = zext i8 %29 to i32
%31 = xor i32 %30, -1
%32 = trunc i32 %31 to i8
store i8 %32, i8* %7
%33 = load i8, i8* %7
%34 = zext i8 %33 to i32
%35 = load i8, i8* %5
%36 = zext i8 %35 to i32
%37 = and i32 %34, %36
%38 = load i8, i8* %7
%39 = zext i8 %38 to i32
%40 = load i8, i8* %6
%41 = zext i8 %40 to i32
%42 = xor i32 %41, -1
%43 = and i32 %39, %42
%44 = or i32 %37, %43
%45 = load i8, i8* %6
%46 = zext i8 %45 to i32
%47 = load i8, i8* %5
%48 = zext i8 %47 to i32
%49 = xor i32 %48, -1
%50 = and i32 %46, %49
%51 = load i8*, i8** %4
%52 = load i8, i8* %51
%53 = zext i8 %52 to i32
%54 = and i32 %50, %53
%55 = or i32 %44, %54
%56 = trunc i32 %55 to i8
%57 = load i8*, i8** %4
store i8 %56, i8* %57
ret void
}

LLVM IR (-O2):
define void @rop3_155_0_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = or i8 %2, %1
%5 = load i8, i8* %0
%6 = and i8 %5, %4
%7 = xor i8 %6, %1
%8 = or i8 %7, %2
%9 = xor i8 %8, -1
%10 = or i8 %6, %9
store i8 %10, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ENOMEM;
scalar_t__ WOMallocShouldFail();
int /*<<< orphan*/ errno;
void *valloc(size_t);
void *WOValloc(size_t size) {
  if (WOMallocShouldFail()) {
    errno = ENOMEM;
    return NULL;
  }
  return valloc(size);
}


x86 assembly (clang, -O0):
<WOValloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <WOMallocShouldFail@plt>
cmp    $0x0,%rax
je     115c <WOValloc+0x3c>
mov    0x2e9c(%rip),%rax
mov    (%rax),%ecx
mov    0x2e8b(%rip),%rax
mov    %ecx,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    1169 <WOValloc+0x49>
mov    -0x10(%rbp),%rdi
call   1040 <valloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WOValloc>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <WOMallocShouldFail@plt>
test   %rax,%rax
je     1146 <WOValloc+0x26>
mov    0x2ea9(%rip),%rax
mov    (%rax),%eax
mov    0x2e98(%rip),%rcx
mov    %eax,(%rcx)
xor    %eax,%eax
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <valloc@plt>

LLVM IR (-O0):
@ENOMEM = global i32 0
@errno = global i32 0
define i8* @WOValloc(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
store i64 %0, i64* %3
%4 = call i64 (...) @WOMallocShouldFail()
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i32, i32* @ENOMEM
store i32 %7, i32* @errno
store i8* null, i8** %2
br label %11
8: ; preds = %1
%9 = load i64, i64* %3
%10 = call i8* @valloc(i64 %9)
store i8* %10, i8** %2
br label %11
11: ; preds = %8, %6
%12 = load i8*, i8** %2
ret i8* %12
}

LLVM IR (-O2):
@ENOMEM = global i32 0
@errno = global i32 0
define noalias i8* @WOValloc(i64 %0) {
%2 = tail call i64 (...) @WOMallocShouldFail()
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = load i32, i32* @ENOMEM
store i32 %5, i32* @errno
br label %8
6: ; preds = %1
%7 = tail call i8* @valloc(i64 %0)
br label %8
8: ; preds = %6, %4
%9 = phi i8* [ null, %4 ], [ %7, %6 ]
ret i8* %9
}
/* Variables and functions */
int extern_const(int);
int foo1(int a) { return extern_const(a); }


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

x86 assembly (clang, -O2):
<foo1>:
jmp    1030 <extern_const@plt>

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

LLVM IR (-O2):
define i32 @foo1(i32 %0) {
%2 = tail call i32 @extern_const(i32 %0)
ret i32 %2
}
int wakeop_arg_extend(int x) {
  if (x >= 0x800) {
    return 0xfffff000 | x;
  }
  return x;
}


x86 assembly (clang, -O0):
<wakeop_arg_extend>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x800,-0x8(%rbp)
jl     1124 <wakeop_arg_extend+0x24>
mov    -0x8(%rbp),%eax
or     $0xfffff000,%eax
mov    %eax,-0x4(%rbp)
jmp    112a <wakeop_arg_extend+0x2a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wakeop_arg_extend>:
mov    %edi,%eax
or     $0xfffff000,%eax
cmp    $0x800,%edi
cmovl  %edi,%eax
ret

LLVM IR (-O0):
define i32 @wakeop_arg_extend(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 2048
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %3
%8 = or i32 -4096, %7
store i32 %8, i32* %2
br label %11
9: ; preds = %1
%10 = load i32, i32* %3
store i32 %10, i32* %2
br label %11
11: ; preds = %9, %6
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @wakeop_arg_extend(i32 %0) {
%2 = icmp sgt i32 %0, 2047
%3 = or i32 %0, -4096
%4 = select i1 %2, i32 %3, i32 %0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *argv0) {
  fprintf(stderr, "usage: %s [ -t ] [ -p <port> ]\n", argv0);
}


x86 assembly (clang, -O0):
<usage>:
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):
<usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"usage: %s [ -t ] [ -p <port> ]\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"usage: %s [ -t ] [ -p <port> ]\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_ljmp();
void test_proc(void) { test_ljmp(); }


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

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

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

LLVM IR (-O2):
define void @test_proc() {
%1 = tail call i32 (...) @test_ljmp()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ savefile(char *, char *, int);
void sclCreate(char *path) {
  char data[] = {'S', 'I',  'N',  'C',  'L',  'A', 'I',
                 'R', 0x00, 0x55, 0x02, 0x00, 0x00};
  savefile(path, data, 13);
}


x86 assembly (clang, -O0):
<sclCreate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0xedd(%rip),%rax
mov    %rax,-0x15(%rbp)
mov    0xedb(%rip),%eax
mov    %eax,-0xd(%rbp)
mov    0xed6(%rip),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x15(%rbp),%rsi
mov    $0xd,%edx
call   1030 <savefile@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sclCreate>:
sub    $0x18,%rsp
movabs $0x25500524941,%rax
mov    %rax,0xd(%rsp)
movabs $0x5249414c434e4953,%rax
41 49 52
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    $0xd,%edx
call   1030 <savefile@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.sclCreate.data = [13 x i8] c"SINCLAIR\00U\02\00\00"
define void @sclCreate(i8* %0) {
%2 = alloca i8*
%3 = alloca [13 x i8]
store i8* %0, i8** %2
%4 = bitcast [13 x i8]* %3 to i8*
%5 = load i8*, i8** %2
%6 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 0
%7 = call i32 @savefile(i8* %5, i8* %6, i32 13)
ret void
}

LLVM IR (-O2):
@__const.sclCreate.data = [13 x i8] c"SINCLAIR\00U\02\00\00"
define void @sclCreate(i8* %0) {
%2 = alloca [13 x i8]
%3 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%4 = call i32 @savefile(i8* %0, i8* %3, i32 13)
ret void
}
/* Variables and functions */
void *malloc(size_t);
void *OICMalloc(size_t size) {
  if (0 == size) {
    return NULL;
  }
  return malloc(size);
}


x86 assembly (clang, -O0):
<OICMalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    1135 <OICMalloc+0x25>
movq   $0x0,-0x8(%rbp)
jmp    1142 <OICMalloc+0x32>
mov    -0x10(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OICMalloc>:
test   %rdi,%rdi
je     111a <OICMalloc+0xa>
jmp    1030 <malloc@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define noalias i8* @OICMalloc(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i8* @malloc(i64 %0)
br label %5
5: ; preds = %1, %3
%6 = phi i8* [ %4, %3 ], [ null, %1 ]
ret i8* %6
}
/* Type definitions */
struct hsearch_data {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ hdestroy1_r(struct hsearch_data *, int /*<<< orphan*/ *,
                               int /*<<< orphan*/ *);
void hdestroy_r(struct hsearch_data *head) { hdestroy1_r(head, NULL, NULL); }


x86 assembly (clang, -O0):
<hdestroy_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1030 <hdestroy1_r@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hdestroy_r>:
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <hdestroy1_r@plt>

LLVM IR (-O0):
%struct.hsearch_data = type { i32 }
define void @hdestroy_r(%struct.hsearch_data* %0) {
%2 = alloca %struct.hsearch_data*
store %struct.hsearch_data* %0, %struct.hsearch_data** %2
%3 = load %struct.hsearch_data*, %struct.hsearch_data** %2
%4 = call i32 @hdestroy1_r(%struct.hsearch_data* %3, i32* null, i32* null)
ret void
}

LLVM IR (-O2):
%struct.hsearch_data = type { i32 }
define void @hdestroy_r(%struct.hsearch_data* %0) {
%2 = tail call i32 @hdestroy1_r(%struct.hsearch_data* %0, i32* null, i32* null)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_format_info_is_pcm() {
  printf("NOT IMPLEMENTED:"
         "pa_format_info_is_pcm"
         "\n");
}


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

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

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

LLVM IR (-O2):
@str = [38 x i8] c"NOT IMPLEMENTED:pa_format_info_is_pcm\00"
define i32 @pa_format_info_is_pcm() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void u(char *line) {
  fputs(line, stderr);
  fputs("\n", stderr);
}


x86 assembly (clang, -O0):
<u>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%esi
lea    0xec2(%rip),%rdi
call   1030 <fputs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<u>:
push   %rbx
mov    0x2ec8(%rip),%rbx
mov    (%rbx),%esi
call   1030 <fputs@plt>
mov    (%rbx),%esi
lea    0xed8(%rip),%rdi
pop    %rbx
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [2 x i8] c"\0A\00"
define void @u(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @stderr
%5 = call i32 @fputs(i8* %3, i32 %4)
%6 = load i32, i32* @stderr
%7 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [2 x i8] c"\0A\00"
define void @u(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fputs(i8* %0, i32 %2)
%4 = load i32, i32* @stderr
%5 = tail call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
int main() {
  int i = 1;
  return i % 2 == 0 ? -i : i;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1133 <main+0x33>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1139 <main+0x39>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ _patch_op_imm(unsigned int *, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ invalidate_icache(unsigned int *, int);
void patch_op_imm(unsigned int *p_insn, uint16_t imm, int sh, int len) {
  _patch_op_imm(p_insn, imm, sh, len);
  invalidate_icache(p_insn, 4);
}


x86 assembly (clang, -O0):
<patch_op_imm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1040 <_patch_op_imm@plt>
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
call   1030 <invalidate_icache@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<patch_op_imm>:
push   %rbx
mov    %rdi,%rbx
call   1040 <_patch_op_imm@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
pop    %rbx
jmp    1030 <invalidate_icache@plt>

LLVM IR (-O0):
define void @patch_op_imm(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32*, i32** %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @_patch_op_imm(i32* %9, i32 %10, i32 %11, i32 %12)
%14 = load i32*, i32** %5
%15 = call i32 @invalidate_icache(i32* %14, i32 4)
ret void
}

LLVM IR (-O2):
define void @patch_op_imm(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @_patch_op_imm(i32* %0, i32 %1, i32 %2, i32 %3)
%6 = tail call i32 @invalidate_icache(i32* %0, i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ swp(int /*<<< orphan*/, int /*<<< orphan*/);
void rev(char *s1, char *s2) {
  char *a = s1;
  char *b = s2;
  while (a < b)
    swp(a++, b--);
}


x86 assembly (clang, -O0):
<rev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    116a <rev+0x5a>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    %eax,%edi
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x20(%rbp)
mov    %eax,%esi
call   1030 <swp@plt>
jmp    1130 <rev+0x20>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rev>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %rsi,%rdi
jae    114f <rev+0x3f>
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x1(%rdi),%r15
mov    %r14d,%ebp
nopl   0x0(%rax)
add    $0xffffffffffffffff,%r14
mov    %ebx,%edi
mov    %ebp,%esi
call   1030 <swp@plt>
add    $0xffffffff,%ebp
lea    0x1(%r15),%rax
add    $0x1,%ebx
cmp    %r14,%r15
mov    %rax,%r15
jb     1130 <rev+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @rev(i8* %0, i8* %1) {
%3 = icmp ult i8* %0, %1
br i1 %3, label %4, label %15
4: ; preds = %2, %4
%5 = phi i8* [ %10, %4 ], [ %1, %2 ]
%6 = phi i8* [ %7, %4 ], [ %0, %2 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = ptrtoint i8* %6 to i64
%9 = trunc i64 %8 to i32
%10 = getelementptr inbounds i8, i8* %5, i64 -1
%11 = ptrtoint i8* %5 to i64
%12 = trunc i64 %11 to i32
%13 = tail call i32 @swp(i32 %9, i32 %12)
%14 = icmp ult i8* %7, %10
br i1 %14, label %4, label %15
15: ; preds = %4, %2
ret void
}
int readInt(int pos, unsigned char *cmddata) {
  return (cmddata[pos + 0] << 24) | (cmddata[pos + 1] << 16) |
         (cmddata[pos + 2] << 8) | (cmddata[pos + 3]);
}


x86 assembly (clang, -O0):
<readInt>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
shl    $0x18,%eax
mov    -0x10(%rbp),%rcx
mov    -0x4(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    -0x4(%rbp),%edx
add    $0x2,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    -0x4(%rbp),%edx
add    $0x3,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<readInt>:
movslq %edi,%rax
mov    (%rsi,%rax,1),%eax
bswap  %eax
ret

LLVM IR (-O0):
define i32 @readInt(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 0
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %5, i64 %8
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 24
%13 = load i8*, i8** %4
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %13, i64 %16
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = shl i32 %19, 16
%21 = or i32 %12, %20
%22 = load i8*, i8** %4
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %22, i64 %25
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = shl i32 %28, 8
%30 = or i32 %21, %29
%31 = load i8*, i8** %4
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %31, i64 %34
%36 = load i8, i8* %35
%37 = zext i8 %36 to i32
%38 = or i32 %30, %37
ret i32 %38
}

LLVM IR (-O2):
define i32 @readInt(i32 %0, i8* nocapture %1) {
%3 = sext i32 %0 to i64
%4 = getelementptr inbounds i8, i8* %1, i64 %3
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl nuw i32 %6, 24
%8 = add nsw i32 %0, 1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl nuw nsw i32 %12, 16
%14 = or i32 %13, %7
%15 = add nsw i32 %0, 2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %1, i64 %16
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = shl nuw nsw i32 %19, 8
%21 = or i32 %14, %20
%22 = add nsw i32 %0, 3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %1, i64 %23
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = or i32 %21, %26
ret i32 %27
}
/* Variables and functions */
int /*<<< orphan*/ pushNarray(char *, int);
void pushpointer_(char *ppp) { pushNarray(ppp, 4); }


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

x86 assembly (clang, -O2):
<pushpointer_>:
mov    $0x4,%esi
jmp    1030 <pushNarray@plt>

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

LLVM IR (-O2):
define void @pushpointer_(i8* %0) {
%2 = tail call i32 @pushNarray(i8* %0, i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, float);
int main(void) {
  float a, b;
  b = 2.0e12 + 1.0;
  a = b - 2.0e12;
  printf("%f\n", a);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xed1(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb3(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedc(%rip),%rdi
movss  0xed0(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
store float 0x427D1A94A0000000, float* %3
%4 = load float, float* %3
%5 = fpext float %4 to double
%6 = fsub double %5, 2.000000e+12
%7 = fptrunc double %6 to float
store float %7, float* %2
%8 = load float, float* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %8)
%10 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float -8.192000e+03)
%2 = tail call i32 (...) @getchar()
ret i32 0
}
int lib$ichar(const struct dsc$descriptor_s *input_descriptor) {
  short word_integer_length;
  char *data_address;
  long result = 0;
  unsigned long status;
  status =
      lib$analyze_sdesc(input_descriptor, &word_integer_length, &data_address);
  if (word_integer_length >= 1) {
    result = *data_address - '0';
  }
  return result;
}


x86 assembly (clang, -O0):
<lib$ichar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xa(%rbp),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1030 <lib$analyze_sdesc@plt>
cltq
mov    %rax,-0x28(%rbp)
movswl -0xa(%rbp),%eax
cmp    $0x1,%eax
jl     115a <lib$ichar+0x4a>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
cltq
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lib$ichar>:
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
lea    0x6(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1030 <lib$analyze_sdesc@plt>
cmpw   $0x0,0x6(%rsp)
jle    113b <lib$ichar+0x2b>
mov    0x8(%rsp),%rax
movsbl (%rax),%ebx
add    $0xffffffd0,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%"struct.dsc$descriptor_s" = type opaque
define i32 @"lib$ichar"(%"struct.dsc$descriptor_s"* %0) {
%2 = alloca %"struct.dsc$descriptor_s"*
%3 = alloca i16
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store %"struct.dsc$descriptor_s"* %0, %"struct.dsc$descriptor_s"** %2
store i64 0, i64* %5
%7 = load %"struct.dsc$descriptor_s"*, %"struct.dsc$descriptor_s"** %2
%8 = call i32 (%"struct.dsc$descriptor_s"*, i16*, i8**, ...) bitcast (i32 (...)* @"lib$analyze_sdesc" to i32 (%"struct.dsc$descriptor_s"*, i16*, i8**, ...)*)(%"struct.dsc$descriptor_s"* %7, i16* %3, i8** %4)
%9 = sext i32 %8 to i64
store i64 %9, i64* %6
%10 = load i16, i16* %3
%11 = sext i16 %10 to i32
%12 = icmp sge i32 %11, 1
br i1 %12, label %13, label %19
13: ; preds = %1
%14 = load i8*, i8** %4
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = sub nsw i32 %16, 48
%18 = sext i32 %17 to i64
store i64 %18, i64* %5
br label %19
19: ; preds = %13, %1
%20 = load i64, i64* %5
%21 = trunc i64 %20 to i32
ret i32 %21
}

LLVM IR (-O2):
%"struct.dsc$descriptor_s" = type opaque
define i32 @"lib$ichar"(%"struct.dsc$descriptor_s"* %0) {
%2 = alloca i16
%3 = alloca i8*
%4 = bitcast i16* %2 to i8*
%5 = bitcast i8** %3 to i8*
%6 = call i32 (%"struct.dsc$descriptor_s"*, i16*, i8**, ...) bitcast (i32 (...)* @"lib$analyze_sdesc" to i32 (%"struct.dsc$descriptor_s"*, i16*, i8**, ...)*)(%"struct.dsc$descriptor_s"* %0, i16* %2, i8** %3)
%7 = load i16, i16* %2
%8 = icmp sgt i16 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = add nsw i32 %12, -48
br label %14
14: ; preds = %9, %1
%15 = phi i32 [ %13, %9 ], [ 0, %1 ]
ret i32 %15
}
/* Variables and functions */
int mainHelper(int, char **);
int main(int argc, char *argv[]) { return mainHelper(argc, argv); }


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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <mainHelper@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1030 <mainHelper@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @mainHelper(i32 %0, i8** %1)
ret i32 %3
}
/* Variables and functions */
int fabs(double);
double cut300(double x) { return fabs(x) >= 1e-300 ? x : 0.0; }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xecd(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     114c <cut300+0x3c>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1159 <cut300+0x49>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1159 <cut300+0x49>
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <fabs@plt>
movsd  (%rsp),%xmm0
test   %eax,%eax
jg     1127 <cut300+0x17>
xorps  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @cut300(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @fabs(double %3)
%5 = sitofp i32 %4 to double
%6 = fcmp oge double %5, 1.000000e-300
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load double, double* %2
br label %10
9: ; preds = %1
br label %10
10: ; preds = %9, %7
%11 = phi double [ %8, %7 ], [ 0.000000e+00, %9 ]
ret double %11
}

LLVM IR (-O2):
define double @cut300(double %0) {
%2 = tail call i32 @fabs(double %0)
%3 = icmp sgt i32 %2, 0
%4 = select i1 %3, double %0, double 0.000000e+00
ret double %4
}
/* Variables and functions */
short int px_get_short_le_s(const char *cp) {
  short int ret;
  unsigned char *source = (unsigned char *)cp;
  if (NULL == cp)
    return 0;
  ret = *source++;
  ret += ((*source++) << 8);
  return ret;
}


x86 assembly (clang, -O0):
<px_get_short_le_s>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    1127 <px_get_short_le_s+0x27>
movw   $0x0,-0x2(%rbp)
jmp    1164 <px_get_short_le_s+0x64>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movzbl (%rax),%eax
mov    %ax,-0x12(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movzbl (%rax),%ecx
shl    $0x8,%ecx
movswl -0x12(%rbp),%eax
add    %ecx,%eax
mov    %ax,-0x12(%rbp)
mov    -0x12(%rbp),%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<px_get_short_le_s>:
test   %rdi,%rdi
je     1109 <px_get_short_le_s+0x9>
movzwl (%rdi),%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define signext i16 @px_get_short_le_s(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %0
%6 = load i8, i8* %4
%7 = zext i8 %6 to i16
%8 = shl nuw i16 %7, 8
%9 = zext i8 %5 to i16
%10 = or i16 %8, %9
br label %11
11: ; preds = %1, %3
%12 = phi i16 [ %10, %3 ], [ 0, %1 ]
ret i16 %12
}
long lmax(long a, long b) { return a > b ? a : b; }


x86 assembly (clang, -O0):
<lmax>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    1127 <lmax+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <lmax+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lmax>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovg  %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @lmax(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
long string_length(string)
char string[];
{
  int count;
  for (count = 0; string[count] != '\0'; ++count) {
  }
  return (count);
}


x86 assembly (clang, -O0):
<string_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1137 <string_length+0x37>
jmp    1129 <string_length+0x29>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <string_length+0xf>
movslq -0xc(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_length>:
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <string_length+0x10>
mov    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @string_length(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = and i64 %3, 4294967295
ret i64 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void *thread_1(void *argv) {
  while (1) {
    sleep(1);
    printf("I am thread_1\n");
  }
}


x86 assembly (clang, -O0):
<thread_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
call   1040 <sleep@plt>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
jmp    112c <thread_1+0xc>

x86 assembly (clang, -O2):
<thread_1>:
push   %rbx
lea    0xed8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
jmp    1130 <thread_1+0x10>

LLVM IR (-O0):
@.str = [15 x i8] c"I am thread_1\0A\00"
define i8* @thread_1(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1, %3
%4 = call i32 @sleep(i32 1)
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %3
}

LLVM IR (-O2):
@str = [14 x i8] c"I am thread_1\00"
define noalias i8* @thread_1(i8* nocapture readnone %0) {
br label %2
2: ; preds = %1, %2
%3 = tail call i32 @sleep(i32 1)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %2
}
/* Variables and functions */
int test1(int, int);
int entrypoint() {
  return test1(0xf00dbeef, 0xbeeff00d) == 0x12345678 ? 0xf00d : 0xdead;
}


x86 assembly (clang, -O0):
<entrypoint>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf00dbeef,%edi
mov    $0xbeeff00d,%esi
call   1030 <test1@plt>
mov    %eax,%edx
mov    $0xdead,%eax
mov    $0xf00d,%ecx
cmp    $0x12345678,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<entrypoint>:
push   %rax
mov    $0xf00dbeef,%edi
mov    $0xbeeff00d,%esi
call   1030 <test1@plt>
cmp    $0x12345678,%eax
mov    $0xf00d,%ecx
mov    $0xdead,%eax
cmove  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @entrypoint() {
%1 = call i32 @test1(i32 -267534609, i32 -1091571699)
%2 = icmp eq i32 %1, 305419896
%3 = zext i1 %2 to i64
%4 = select i1 %2, i32 61453, i32 57005
ret i32 %4
}

LLVM IR (-O2):
define i32 @entrypoint() {
%1 = tail call i32 @test1(i32 -267534609, i32 -1091571699)
%2 = icmp eq i32 %1, 305419896
%3 = select i1 %2, i32 61453, i32 57005
ret i32 %3
}
void gtk_rc_style_new() {}


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

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

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

LLVM IR (-O2):
define void @gtk_rc_style_new() {
ret void
}