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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fwrite(int *, int /*<<< orphan*/, int, int /*<<< orphan*/ *);
int main02() {
  FILE *p = fopen("D:\\temp\\a.dat", "wb");
  int a = 0x12345678;
  fwrite(&a, 0, 4, p);
  fclose(p);
  return 0;
}


x86 assembly (clang, -O0):
<main02>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xec8(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x8(%rbp)
movl   $0x12345678,-0xc(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0xc(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1050 <fwrite@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main02>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xedf(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"D:\\temp\\a.dat\00"
@.str.1 = [3 x i8] c"wb\00"
define i32 @main02() {
%1 = alloca i32*
%2 = alloca i32
%3 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %1
store i32 305419896, i32* %2
%4 = load i32*, i32** %1
%5 = call i32 @fwrite(i32* %2, i32 0, i32 4, i32* %4)
%6 = load i32*, i32** %1
%7 = call i32 @fclose(i32* %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"D:\\temp\\a.dat\00"
@.str.1 = [3 x i8] c"wb\00"
define i32 @main02() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @fclose(i32* %1)
ret i32 0
}
void assert(_Bool b) {
  if (!b) {
    void abort(void);
    abort();
  }
}


x86 assembly (clang, -O0):
<assert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
and    $0x1,%al
mov    %al,-0x1(%rbp)
testb  $0x1,-0x1(%rbp)
jne    112f <assert+0x1f>
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert>:
test   %edi,%edi
je     1115 <assert+0x5>
ret
push   %rax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @assert(i1 zeroext %0) {
%2 = alloca i8
%3 = zext i1 %0 to i8
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = trunc i8 %4 to i1
br i1 %5, label %7, label %6
6: ; preds = %1
unreachable
7: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @assert(i1 zeroext %0) {
br i1 %0, label %3, label %2
2: ; preds = %1
tail call void @abort()
unreachable
3: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void custom_logger(const char *msg) { fprintf(stderr, "LOG: %s", msg); }


x86 assembly (clang, -O0):
<custom_logger>:
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):
<custom_logger>:
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 = [8 x i8] c"LOG: %s\00"
define void @custom_logger(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 ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [8 x i8] c"LOG: %s\00"
define void @custom_logger(i8* %0) {
%2 = load i32, i32* @stderr
%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
}
double obd_convert_05(int a, int b) { return a - 40; }


x86 assembly (clang, -O0):
<obd_convert_05>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x28,%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<obd_convert_05>:
add    $0xffffffd8,%edi
cvtsi2sd %edi,%xmm0
ret

LLVM IR (-O0):
define double @obd_convert_05(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = sub nsw i32 %5, 40
%7 = sitofp i32 %6 to double
ret double %7
}

LLVM IR (-O2):
define double @obd_convert_05(i32 %0, i32 %1) {
%3 = add nsw i32 %0, -40
%4 = sitofp i32 %3 to double
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ get_terminal_size();
void sig_winch(int signo) { get_terminal_size(); }


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

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

LLVM IR (-O0):
define void @sig_winch(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @get_terminal_size()
ret void
}

LLVM IR (-O2):
define void @sig_winch(i32 %0) {
%2 = tail call i32 (...) @get_terminal_size()
ret void
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t UInt32GetBE(const void *b4) {
  return (((uint32_t)((const uint8_t *)b4)[0] << 24) |
          ((uint32_t)((const uint8_t *)b4)[1] << 16) |
          ((uint32_t)((const uint8_t *)b4)[2] << 8) |
          ((uint32_t)((const uint8_t *)b4)[3]));
}


x86 assembly (clang, -O0):
<UInt32GetBE>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%rcx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x10(%rcx),%rcx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x18(%rcx),%rcx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<UInt32GetBE>:
mov    (%rdi),%eax
mov    0x8(%rdi),%ecx
shl    $0x18,%eax
shl    $0x10,%ecx
or     %eax,%ecx
mov    0x10(%rdi),%eax
shl    $0x8,%eax
or     %ecx,%eax
or     0x18(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @UInt32GetBE(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = shl i32 %4, 24
%6 = getelementptr inbounds i8, i8* %0, i64 8
%7 = bitcast i8* %6 to i64*
%8 = load i64, i64* %7
%9 = trunc i64 %8 to i32
%10 = shl i32 %9, 16
%11 = or i32 %10, %5
%12 = getelementptr inbounds i8, i8* %0, i64 16
%13 = bitcast i8* %12 to i64*
%14 = load i64, i64* %13
%15 = trunc i64 %14 to i32
%16 = shl i32 %15, 8
%17 = or i32 %11, %16
%18 = getelementptr inbounds i8, i8* %0, i64 24
%19 = bitcast i8* %18 to i64*
%20 = load i64, i64* %19
%21 = trunc i64 %20 to i32
%22 = or i32 %17, %21
ret i32 %22
}
void g_DUMMY_popup_set_label(int cont_id, int item_id, char *label) {
  cont_id = cont_id;
  item_id = item_id;
  label = label;
}


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

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

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

LLVM IR (-O2):
define void @g_DUMMY_popup_set_label(i32 %0, i32 %1, i8* nocapture %2) {
ret void
}
void conv(dest, value) register char *dest;
register int value;
{
  register short int i;
  i = value / 10;
  dest[0] = i + '0';
  dest[1] = value - i * 10 + '0';
}


x86 assembly (clang, -O0):
<conv>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %ax,-0xe(%rbp)
movswl -0xe(%rbp),%eax
add    $0x30,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
movswl -0xe(%rbp),%ecx
imul   $0xa,%ecx,%ecx
sub    %ecx,%eax
add    $0x30,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<conv>:
movslq %esi,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
lea    0x30(%rcx),%edx
mov    %dl,(%rdi)
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x30,%al
mov    %al,0x1(%rdi)
ret

LLVM IR (-O0):
define void @conv(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i16
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = sdiv i32 %6, 10
%8 = trunc i32 %7 to i16
store i16 %8, i16* %5
%9 = load i16, i16* %5
%10 = sext i16 %9 to i32
%11 = add nsw i32 %10, 48
%12 = trunc i32 %11 to i8
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 0
store i8 %12, i8* %14
%15 = load i32, i32* %4
%16 = load i16, i16* %5
%17 = sext i16 %16 to i32
%18 = mul nsw i32 %17, 10
%19 = sub nsw i32 %15, %18
%20 = add nsw i32 %19, 48
%21 = trunc i32 %20 to i8
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i64 1
store i8 %21, i8* %23
ret void
}

LLVM IR (-O2):
define void @conv(i8* nocapture writeonly %0, i32 %1) {
%3 = sdiv i32 %1, 10
%4 = shl i32 %3, 16
%5 = ashr exact i32 %4, 16
%6 = trunc i32 %3 to i8
%7 = add i8 %6, 48
store i8 %7, i8* %0
%8 = mul nsw i32 %5, -10
%9 = add i32 %8, %1
%10 = trunc i32 %9 to i8
%11 = add i8 %10, 48
%12 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %11, i8* %12
ret void
}
void pRawDllMain() {}


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

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

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

LLVM IR (-O2):
define void @pRawDllMain() {
ret void
}
/* Variables and functions */
int __syscall(int, int);
int errno;
int _isatty(int fd) {
  int err;
  err = __syscall(21, fd);
  if (err < 0) {
    errno = -err;
    return -1;
  }
  return err;
}


x86 assembly (clang, -O0):
<_isatty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    $0x15,%edi
call   1030 <__syscall@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    114f <_isatty+0x3f>
xor    %ecx,%ecx
sub    -0xc(%rbp),%ecx
mov    0x2e9f(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    1155 <_isatty+0x45>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_isatty>:
push   %rax
mov    %edi,%esi
mov    $0x15,%edi
call   1030 <__syscall@plt>
test   %eax,%eax
js     1123 <_isatty+0x13>
pop    %rcx
ret
neg    %eax
mov    0x2eb4(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @_isatty(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @__syscall(i32 21, i32 %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* %4
%11 = sub nsw i32 0, %10
store i32 %11, i32* @errno
store i32 -1, i32* %2
br label %14
12: ; preds = %1
%13 = load i32, i32* %4
store i32 %13, i32* %2
br label %14
14: ; preds = %12, %9
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @_isatty(i32 %0) {
%2 = tail call i32 @__syscall(i32 21, i32 %0)
%3 = icmp slt i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = sub nsw i32 0, %2
store i32 %5, i32* @errno
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ -1, %4 ], [ %2, %1 ]
ret i32 %7
}
int test_imm_D5uint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0xD5 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_D5uint64_highword_reg>:
movabs $0xd500000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_D5uint64_highword_reg(i64 %0) {
%2 = and i64 %0, 914828034048
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int uint32_t;
struct can_frame {
  scalar_t__ *data;
};

/* Variables and functions */
uint32_t data32(struct can_frame frame) {
  return (uint32_t)frame.data[7] << 24 | (uint32_t)frame.data[6] << 16 |
         (uint32_t)frame.data[5] << 8 | (uint32_t)frame.data[4] << 0;
}


x86 assembly (clang, -O0):
<data32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x38(%rax),%rax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
mov    0x30(%rcx),%rcx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x28(%rcx),%rcx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x20(%rcx),%rcx
shl    $0x0,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<data32>:
mov    0x38(%rdi),%ecx
shl    $0x18,%ecx
mov    0x28(%rdi),%eax
mov    0x30(%rdi),%edx
shl    $0x10,%edx
or     %ecx,%edx
shl    $0x8,%eax
or     %edx,%eax
or     0x20(%rdi),%eax
ret

LLVM IR (-O0):
%struct.can_frame = type { i64* }
define i32 @data32(i64* %0) {
%2 = alloca %struct.can_frame
%3 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %2, i32 0, i32 0
store i64* %0, i64** %3
%4 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %2, i32 0, i32 0
%5 = load i64*, i64** %4
%6 = getelementptr inbounds i64, i64* %5, i64 7
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
%9 = shl i32 %8, 24
%10 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %2, i32 0, i32 0
%11 = load i64*, i64** %10
%12 = getelementptr inbounds i64, i64* %11, i64 6
%13 = load i64, i64* %12
%14 = trunc i64 %13 to i32
%15 = shl i32 %14, 16
%16 = or i32 %9, %15
%17 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %2, i32 0, i32 0
%18 = load i64*, i64** %17
%19 = getelementptr inbounds i64, i64* %18, i64 5
%20 = load i64, i64* %19
%21 = trunc i64 %20 to i32
%22 = shl i32 %21, 8
%23 = or i32 %16, %22
%24 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %2, i32 0, i32 0
%25 = load i64*, i64** %24
%26 = getelementptr inbounds i64, i64* %25, i64 4
%27 = load i64, i64* %26
%28 = trunc i64 %27 to i32
%29 = shl i32 %28, 0
%30 = or i32 %23, %29
ret i32 %30
}

LLVM IR (-O2):
define i32 @data32(i64* nocapture %0) {
%2 = getelementptr inbounds i64, i64* %0, i64 7
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = shl i32 %4, 24
%6 = getelementptr inbounds i64, i64* %0, i64 6
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
%9 = shl i32 %8, 16
%10 = or i32 %9, %5
%11 = getelementptr inbounds i64, i64* %0, i64 5
%12 = load i64, i64* %11
%13 = trunc i64 %12 to i32
%14 = shl i32 %13, 8
%15 = or i32 %10, %14
%16 = getelementptr inbounds i64, i64* %0, i64 4
%17 = load i64, i64* %16
%18 = trunc i64 %17 to i32
%19 = or i32 %15, %18
ret i32 %19
}
/* Variables and functions */
int android_dlclose(void *);
int hybris_dlclose(void *handle) { return android_dlclose(handle); }


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

x86 assembly (clang, -O2):
<hybris_dlclose>:
jmp    1030 <android_dlclose@plt>

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

LLVM IR (-O2):
define i32 @hybris_dlclose(i8* %0) {
%2 = tail call i32 @android_dlclose(i8* %0)
ret i32 %2
}
void foo(int argx) {
  int varx = argx;
  __asm__ volatile("nop");
  __asm__ volatile("nop" : : "g"(varx));
}


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

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

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

LLVM IR (-O2):
define void @foo(i32 %0) {
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "imr,~{dirflag},~{fpsr},~{flags}"(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
void printNum(double num) { printf("%.10e\n", num); }


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

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"%.10e\0A\00"
define void @printNum(double %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %0)
ret void
}
int OpPrec(char op) {
  switch (op) {
  case '*':
    return 4;
  case '/':
    return 3;
  case '+':
    return 2;
  case '-':
    return 1;
  case '(':
    return 0;
  default:
    return -1;
  }
}


x86 assembly (clang, -O0):
<OpPrec>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffd8,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x7,%eax
ja     1170 <OpPrec+0x70>
mov    -0x10(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x4,-0x4(%rbp)
jmp    1177 <OpPrec+0x77>
movl   $0x3,-0x4(%rbp)
jmp    1177 <OpPrec+0x77>
movl   $0x2,-0x4(%rbp)
jmp    1177 <OpPrec+0x77>
movl   $0x1,-0x4(%rbp)
jmp    1177 <OpPrec+0x77>
movl   $0x0,-0x4(%rbp)
jmp    1177 <OpPrec+0x77>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<OpPrec>:
add    $0xffffffd8,%edi
mov    $0xffffffff,%eax
cmp    $0x7,%edi
ja     111a <OpPrec+0x1a>
movslq %edi,%rax
lea    0xee9(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @OpPrec(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %11 [
i32 42, label %6
i32 47, label %7
i32 43, label %8
i32 45, label %9
i32 40, label %10
]
6: ; preds = %1
store i32 4, i32* %2
br label %12
7: ; preds = %1
store i32 3, i32* %2
br label %12
8: ; preds = %1
store i32 2, i32* %2
br label %12
9: ; preds = %1
store i32 1, i32* %2
br label %12
10: ; preds = %1
store i32 0, i32* %2
br label %12
11: ; preds = %1
store i32 -1, i32* %2
br label %12
12: ; preds = %11, %10, %9, %8, %7, %6
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@switch.table.OpPrec = [8 x i32] [i32 0, i32 -1, i32 4, i32 2, i32 -1, i32 1, i32 -1, i32 3]
define i32 @OpPrec(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -40
%4 = icmp ult i32 %3, 8
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds [8 x i32], [8 x i32]* @switch.table.OpPrec, i64 0, i64 %6
%8 = load i32, i32* %7
br label %9
9: ; preds = %1, %5
%10 = phi i32 [ %8, %5 ], [ -1, %1 ]
ret i32 %10
}
int strcmp(const char *s1, const char *s2) {
  int diff = 0;
  for (; !(diff = *s2 - *s1) && *s1; s1++, s2++)
    ;
  return diff;
}


x86 assembly (clang, -O0):
<strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    %eax,%ecx
mov    %ecx,-0x14(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x15(%rbp)
jne    1144 <strcmp+0x44>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1154 <strcmp+0x54>
jmp    1176 <strcmp+0x76>
jmp    1159 <strcmp+0x59>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1113 <strcmp+0x13>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp>:
movsbl (%rsi),%eax
movsbl (%rdi),%ecx
sub    %ecx,%eax
jne    1134 <strcmp+0x34>
test   %cl,%cl
je     1134 <strcmp+0x34>
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl (%rsi,%rcx,1),%eax
movsbl (%rdi,%rcx,1),%edx
sub    %edx,%eax
jne    1134 <strcmp+0x34>
add    $0x1,%rcx
test   %dl,%dl
jne    1120 <strcmp+0x20>
ret

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

LLVM IR (-O2):
define i32 @strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = sext i8 %3 to i32
%5 = load i8, i8* %0
%6 = sext i8 %5 to i32
%7 = sub nsw i32 %4, %6
%8 = icmp ne i32 %7, 0
%9 = icmp eq i8 %5, 0
%10 = select i1 %8, i1 true, i1 %9
br i1 %10, label %24, label %11
11: ; preds = %2, %11
%12 = phi i8* [ %15, %11 ], [ %1, %2 ]
%13 = phi i8* [ %14, %11 ], [ %0, %2 ]
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = getelementptr inbounds i8, i8* %12, i64 1
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = load i8, i8* %14
%19 = sext i8 %18 to i32
%20 = sub nsw i32 %17, %19
%21 = icmp ne i32 %20, 0
%22 = icmp eq i8 %18, 0
%23 = select i1 %21, i1 true, i1 %22
br i1 %23, label %24, label %11
24: ; preds = %11, %2
%25 = phi i32 [ %7, %2 ], [ %20, %11 ]
ret i32 %25
}
int CmpPrc(const void *a, const void *b) {
  unsigned long long *pa = (unsigned long long *)a,
                     *pb = (unsigned long long *)b;
  if (*pa > *pb)
    return (1);
  else
    return (-1);
}


x86 assembly (clang, -O0):
<CmpPrc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%rax
jbe    113c <CmpPrc+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    1143 <CmpPrc+0x43>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CmpPrc>:
mov    (%rdi),%rax
xor    %ecx,%ecx
cmp    (%rsi),%rax
seta   %cl
lea    (%rcx,%rcx,1),%eax
add    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @CmpPrc(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = bitcast i8* %1 to i64*
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp ugt i64 %5, %6
%8 = select i1 %7, i32 1, i32 -1
ret i32 %8
}
char itoa(int i) {
  if (i >= 0 && i <= 9)
    return i + '0';
  else if (i >= 0xA && i <= 0xF)
    return i - 0xA + 'A';
  else
    return '0';
}


x86 assembly (clang, -O0):
<itoa>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1129 <itoa+0x29>
cmpl   $0x9,-0x8(%rbp)
jg     1129 <itoa+0x29>
mov    -0x8(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x1(%rbp)
jmp    1152 <itoa+0x52>
cmpl   $0xa,-0x8(%rbp)
jl     114e <itoa+0x4e>
cmpl   $0xf,-0x8(%rbp)
jg     114e <itoa+0x4e>
mov    -0x8(%rbp),%eax
sub    $0xa,%eax
add    $0x41,%eax
mov    %al,-0x1(%rbp)
jmp    1152 <itoa+0x52>
movb   $0x30,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<itoa>:
cmp    $0x9,%edi
ja     110b <itoa+0xb>
add    $0x30,%dil
jmp    1119 <itoa+0x19>
lea    -0xa(%rdi),%ecx
mov    $0x30,%al
cmp    $0x5,%ecx
ja     111b <itoa+0x1b>
add    $0x37,%dil
mov    %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @itoa(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 9
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 48
%12 = trunc i32 %11 to i8
store i8 %12, i8* %2
br label %25
13: ; preds = %6, %1
%14 = load i32, i32* %3
%15 = icmp sge i32 %14, 10
br i1 %15, label %16, label %24
16: ; preds = %13
%17 = load i32, i32* %3
%18 = icmp sle i32 %17, 15
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = load i32, i32* %3
%21 = sub nsw i32 %20, 10
%22 = add nsw i32 %21, 65
%23 = trunc i32 %22 to i8
store i8 %23, i8* %2
br label %25
24: ; preds = %16, %13
store i8 48, i8* %2
br label %25
25: ; preds = %24, %19, %9
%26 = load i8, i8* %2
ret i8 %26
}

LLVM IR (-O2):
define signext i8 @itoa(i32 %0) {
%2 = icmp ult i32 %0, 10
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = trunc i32 %0 to i8
%5 = add nuw nsw i8 %4, 48
br label %12
6: ; preds = %1
%7 = add i32 %0, -10
%8 = icmp ult i32 %7, 6
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = trunc i32 %0 to i8
%11 = add nuw nsw i8 %10, 55
br label %12
12: ; preds = %6, %9, %3
%13 = phi i8 [ %5, %3 ], [ %11, %9 ], [ 48, %6 ]
ret i8 %13
}
double r7(void *x) { return *(double *)(x + 32761); }


x86 assembly (clang, -O0):
<r7>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x7ff9(%rax),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<r7>:
movsd  0x7ff9(%rdi),%xmm0
ret

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

LLVM IR (-O2):
define double @r7(i8* nocapture %0) {
%2 = getelementptr i8, i8* %0, i64 32761
%3 = bitcast i8* %2 to double*
%4 = load double, double* %3
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ UnityPrint(char *);
void UnityPrintOk(void) { UnityPrint("OK"); }


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"OK\00"
define void @UnityPrintOk() {
%1 = tail call i32 @UnityPrint(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}
void no_auth_shadow_support(void) { return; }


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

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

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

LLVM IR (-O2):
define void @no_auth_shadow_support() {
ret void
}
/* Type definitions */
struct LRMI_regs {
  int dummy;
};

/* Variables and functions */
int real_call(struct LRMI_regs *);
int LRMI_call(struct LRMI_regs *registers) { return real_call(registers); }


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

x86 assembly (clang, -O2):
<LRMI_call>:
jmp    1030 <real_call@plt>

LLVM IR (-O0):
%struct.LRMI_regs = type { i32 }
define i32 @LRMI_call(%struct.LRMI_regs* %0) {
%2 = alloca %struct.LRMI_regs*
store %struct.LRMI_regs* %0, %struct.LRMI_regs** %2
%3 = load %struct.LRMI_regs*, %struct.LRMI_regs** %2
%4 = call i32 @real_call(%struct.LRMI_regs* %3)
ret i32 %4
}

LLVM IR (-O2):
%struct.LRMI_regs = type { i32 }
define i32 @LRMI_call(%struct.LRMI_regs* %0) {
%2 = tail call i32 @real_call(%struct.LRMI_regs* %0)
ret i32 %2
}
/* Variables and functions */
float quadratic_out(float, float, float);
float quadratic_f_out(float step, float max_steps, float max_val) {
  return quadratic_out(step, max_steps, max_val);
}


x86 assembly (clang, -O0):
<quadratic_f_out>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
call   1030 <quadratic_out@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quadratic_f_out>:
jmp    1030 <quadratic_out@plt>

LLVM IR (-O0):
define float @quadratic_f_out(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = load float, float* %6
%10 = call float @quadratic_out(float %7, float %8, float %9)
ret float %10
}

LLVM IR (-O2):
define float @quadratic_f_out(float %0, float %1, float %2) {
%4 = tail call float @quadratic_out(float %0, float %1, float %2)
ret float %4
}
sfill(str, cnt) {
  register char *cp;
  register int i;
  cp = str;
  i = cnt;
  do
    *cp++ = ' ';
  while (--i);
}


x86 assembly (clang, -O0):
<sfill>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movslq -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x20,(%rax)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
jne    1118 <sfill+0x18>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sfill>:
push   %rax
movslq %edi,%rdi
lea    -0x1(%rsi),%edx
add    $0x1,%rdx
mov    $0x20,%esi
call   1030 <memset@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @sfill(i32 %0, i32 %1) {
%3 = sext i32 %0 to i64
%4 = inttoptr i64 %3 to i8*
%5 = add i32 %1, -1
%6 = zext i32 %5 to i64
%7 = add nuw nsw i64 %6, 1
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ SCOTCHFNUMSIZEOF(int *const);
void scotchfnumsizeof_(int *const sizeptr) { SCOTCHFNUMSIZEOF(sizeptr); }


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

x86 assembly (clang, -O2):
<scotchfnumsizeof_>:
jmp    1030 <SCOTCHFNUMSIZEOF@plt>

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

LLVM IR (-O2):
define void @scotchfnumsizeof_(i32* %0) {
%2 = tail call i32 @SCOTCHFNUMSIZEOF(i32* %0)
ret void
}
void _exit(int status) { _Exit(status); }


x86 assembly (clang, -O0):
<_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <_Exit@plt>

x86 assembly (clang, -O2):
<_exit>:
push   %rax
call   1030 <_Exit@plt>

LLVM IR (-O0):
define void @_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
unreachable
}

LLVM IR (-O2):
define void @_exit(i32 %0) {
tail call void @_Exit(i32 %0)
unreachable
}
int test_imm_79int16_reg(short val) {
  return ((val) & (-0x79 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_79int16_reg>:
test   $0xff87,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_79int16_reg(i16 signext %0) {
%2 = and i16 %0, -121
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int tor_version_as_new_as(char const *, char *);
int tor_version_supports_microdescriptors(const char *platform) {
  return tor_version_as_new_as(platform, "0.2.3.1-alpha");
}


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

x86 assembly (clang, -O2):
<tor_version_supports_microdescriptors>:
lea    0xee9(%rip),%rsi
jmp    1030 <tor_version_as_new_as@plt>

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

LLVM IR (-O2):
@.str = [14 x i8] c"0.2.3.1-alpha\00"
define i32 @tor_version_supports_microdescriptors(i8* %0) {
%2 = tail call i32 @tor_version_as_new_as(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
/* Variables and functions */
void *Mem_Alloc(int);
scalar_t__ Mem_Free(void *);
scalar_t__ Mem_Init(int);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int main() {
  assert(Mem_Init(4096) == 0);
  void *ptr = Mem_Alloc(8);
  assert(ptr != NULL);
  assert(Mem_Free(ptr) == 0);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1000,%edi
call   1030 <Mem_Init@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x8,%edi
call   1060 <Mem_Alloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1040 <Mem_Free@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1000,%edi
call   1030 <Mem_Init@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
mov    $0x8,%edi
call   1060 <Mem_Alloc@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1040 <Mem_Free@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i64 @Mem_Init(i32 4096)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = call i8* @Mem_Alloc(i32 8)
store i8* %7, i8** %2
%8 = load i8*, i8** %2
%9 = icmp ne i8* %8, null
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i8*, i8** %2
%13 = call i64 @Mem_Free(i8* %12)
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @Mem_Init(i32 4096)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i8* @Mem_Alloc(i32 8)
%6 = icmp ne i8* %5, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i64 @Mem_Free(i8* %5)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
struct timeval {
  int tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int rx_expired(struct timeval *start) {
  struct timeval now;
  gettimeofday(&now, NULL);
  return (now.tv_sec - start->tv_sec < 3) ? 0 : 1;
}


x86 assembly (clang, -O0):
<rx_expired>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%rax
sub    (%rax),%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x3,%edx
cmovl  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rx_expired>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    0x8(%rsp),%ecx
sub    (%rbx),%ecx
xor    %eax,%eax
cmp    $0x3,%ecx
setge  %al
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
define i32 @rx_expired(%struct.timeval* %0) {
%2 = alloca %struct.timeval*
%3 = alloca %struct.timeval
store %struct.timeval* %0, %struct.timeval** %2
%4 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%6 = load i32, i32* %5
%7 = load %struct.timeval*, %struct.timeval** %2
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
%9 = load i32, i32* %8
%10 = sub nsw i32 %6, %9
%11 = icmp slt i32 %10, 3
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 0, i32 1
ret i32 %13
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define i32 @rx_expired(%struct.timeval* nocapture %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%6 = load i32, i32* %5
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%8 = load i32, i32* %7
%9 = sub nsw i32 %6, %8
%10 = icmp sgt i32 %9, 2
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
scalar_t__ test__truncdfsf2(double);
int main() {
  if (test__truncdfsf2(340282366920938463463374607431768211456.0))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed9(%rip),%xmm0
call   1030 <test__truncdfsf2@plt>
cmp    $0x0,%rax
je     1142 <main+0x32>
movl   $0x1,-0x4(%rbp)
jmp    1149 <main+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xee7(%rip),%xmm0
call   1030 <test__truncdfsf2@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @test__truncdfsf2(double 0x47F0000000000000)
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 1, i32* %1
br label %6
5: ; preds = %0
store i32 0, i32* %1
br label %6
6: ; preds = %5, %4
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @test__truncdfsf2(double 0x47F0000000000000)
%2 = icmp ne i64 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef float clock_t;

/* Variables and functions */
float clock();
void delay(float t) {
  clock_t start = clock();
  while ((clock() - start) < (t * 1000))
    ;
  return;
}


x86 assembly (clang, -O0):
<delay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
movss  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
movaps %xmm0,%xmm1
subss  -0x8(%rbp),%xmm1
movss  0xec0(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1153 <delay+0x43>
jmp    1129 <delay+0x19>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delay>:
push   %rax
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <clock@plt>
movss  %xmm0,0x4(%rsp)
movss  (%rsp),%xmm0
mulss  0xed0(%rip),%xmm0
movss  %xmm0,(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1030 <clock@plt>
subss  0x4(%rsp),%xmm0
movss  (%rsp),%xmm1
ucomiss %xmm0,%xmm1
ja     1140 <delay+0x30>
pop    %rax
ret

LLVM IR (-O0):
define void @delay(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = call float (...) @clock()
store float %4, float* %3
br label %5
5: ; preds = %12, %1
%6 = call float (...) @clock()
%7 = load float, float* %3
%8 = fsub float %6, %7
%9 = load float, float* %2
%10 = fmul float %9, 1.000000e+03
%11 = fcmp olt float %8, %10
br i1 %11, label %12, label %13
12: ; preds = %5
br label %5
13: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @delay(float %0) {
%2 = tail call float (...) @clock()
%3 = fmul float %0, 1.000000e+03
br label %4
4: ; preds = %4, %1
%5 = tail call float (...) @clock()
%6 = fsub float %5, %2
%7 = fcmp olt float %6, %3
br i1 %7, label %4, label %8
8: ; preds = %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void print_spaces(int n) {
  while (n--) {
    putchar(' ');
  }
}


x86 assembly (clang, -O0):
<print_spaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     113e <print_spaces+0x2e>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    111b <print_spaces+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_spaces>:
push   %rbx
test   %edi,%edi
je     112f <print_spaces+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <print_spaces+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @print_spaces(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %5, %3 ], [ %0, %1 ]
%5 = add nsw i32 %4, -1
%6 = tail call i32 @putchar(i8 signext 32)
%7 = icmp eq i32 %5, 0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
/* Variables and functions */
double UINT_MAX;
double lcg_knuth_rand();
double random_uniform(void) { return lcg_knuth_rand() / (0.0 + UINT_MAX); }


x86 assembly (clang, -O0):
<random_uniform>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <lcg_knuth_rand@plt>
xorps  %xmm1,%xmm1
mov    0x2ec3(%rip),%rax
addsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_uniform>:
push   %rax
xor    %eax,%eax
call   1030 <lcg_knuth_rand@plt>
mov    0x2ec9(%rip),%rax
xorpd  %xmm1,%xmm1
addsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@UINT_MAX = global double 0.000000e+00
define double @random_uniform() {
%1 = call double (...) @lcg_knuth_rand()
%2 = load double, double* @UINT_MAX
%3 = fadd double 0.000000e+00, %2
%4 = fdiv double %1, %3
ret double %4
}

LLVM IR (-O2):
@UINT_MAX = global double 0.000000e+00
define double @random_uniform() {
%1 = tail call double (...) @lcg_knuth_rand()
%2 = load double, double* @UINT_MAX
%3 = fadd double %2, 0.000000e+00
%4 = fdiv double %1, %3
ret double %4
}
void g_type_module_use() {}


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

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

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

LLVM IR (-O2):
define void @g_type_module_use() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bounce_north();
int /*<<< orphan*/ bounce_west();
scalar_t__ get_east_penetration();
scalar_t__ get_south_penetration();
void do_south_east(void) {
  if (get_south_penetration() < get_east_penetration())
    bounce_north();
  else
    bounce_west();
}


x86 assembly (clang, -O0):
<do_south_east>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <get_south_penetration@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <get_east_penetration@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
cmp    %rcx,%rax
jge    1176 <do_south_east+0x36>
mov    $0x0,%al
call   1030 <bounce_north@plt>
jmp    117d <do_south_east+0x3d>
mov    $0x0,%al
call   1040 <bounce_west@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_south_east>:
push   %rbx
xor    %eax,%eax
call   1060 <get_south_penetration@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <get_east_penetration@plt>
cmp    %rax,%rbx
jge    115f <do_south_east+0x1f>
xor    %eax,%eax
pop    %rbx
jmp    1030 <bounce_north@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <bounce_west@plt>

LLVM IR (-O0):
define void @do_south_east() {
%1 = call i64 (...) @get_south_penetration()
%2 = call i64 (...) @get_east_penetration()
%3 = icmp slt i64 %1, %2
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @bounce_north()
br label %8
6: ; preds = %0
%7 = call i32 (...) @bounce_west()
br label %8
8: ; preds = %6, %4
ret void
}

LLVM IR (-O2):
define void @do_south_east() {
%1 = tail call i64 (...) @get_south_penetration()
%2 = tail call i64 (...) @get_east_penetration()
%3 = icmp slt i64 %1, %2
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 (...) @bounce_north()
br label %8
6: ; preds = %0
%7 = tail call i32 (...) @bounce_west()
br label %8
8: ; preds = %6, %4
ret void
}