xunge/DecIR huggingface dataset:
void store1a(int *array, int a) {
  array[200] = a;
  array[201] = a;
  array[202] = a;
  array[203] = a;
}


x86 assembly (clang, -O0):
<store1a>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x320(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x324(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x328(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x32c(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<store1a>:
movd   %esi,%xmm0
pshufd $0x0,%xmm0,%xmm0
movdqu %xmm0,0x320(%rdi)
ret

LLVM IR (-O0):
define void @store1a(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 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 200
store i32 %5, i32* %7
%8 = load i32, i32* %4
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 201
store i32 %8, i32* %10
%11 = load i32, i32* %4
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 202
store i32 %11, i32* %13
%14 = load i32, i32* %4
%15 = load i32*, i32** %3
%16 = getelementptr inbounds i32, i32* %15, i64 203
store i32 %14, i32* %16
ret void
}

LLVM IR (-O2):
define void @store1a(i32* nocapture writeonly %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 200
%4 = insertelement <4 x i32> poison, i32 %1, i64 0
%5 = shufflevector <4 x i32> %4, <4 x i32> poison, <4 x i32> zeroinitializer
%6 = bitcast i32* %3 to <4 x i32>*
store <4 x i32> %5, <4 x i32>* %6
ret void
}
/* Type definitions */
typedef scalar_t__ uid_t;

/* Variables and functions */
scalar_t__ getuid();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ read_flag();
void get_admin_motd() {
  uid_t uid = getuid();
  if (uid != 0) {
    printf("You're not root!\n");
  } else {
    read_flag();
  }
  return;
}


x86 assembly (clang, -O0):
<get_admin_motd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getuid@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     115f <get_admin_motd+0x2f>
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
jmp    1166 <get_admin_motd+0x36>
mov    $0x0,%al
call   1050 <read_flag@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_admin_motd>:
push   %rax
xor    %eax,%eax
call   1040 <getuid@plt>
test   %rax,%rax
je     114a <get_admin_motd+0x1a>
lea    0xebc(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <read_flag@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"You're not root!\0A\00"
define void @get_admin_motd() {
%1 = alloca i64
%2 = call i64 (...) @getuid()
store i64 %2, i64* %1
%3 = load i64, i64* %1
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %9
7: ; preds = %0
%8 = call i32 (...) @read_flag()
br label %9
9: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
@str = [17 x i8] c"You're not root!\00"
define void @get_admin_motd() {
%1 = tail call i64 (...) @getuid()
%2 = icmp eq i64 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %7
5: ; preds = %0
%6 = tail call i32 (...) @read_flag()
br label %7
7: ; preds = %5, %3
ret void
}
void test_half_tear_down(struct mu_test_desc *desc) {}


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

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

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

LLVM IR (-O2):
%struct.mu_test_desc = type opaque
define void @test_half_tear_down(%struct.mu_test_desc* nocapture %0) {
ret void
}
int execute_utimensat() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_utimensat() {
ret i32 0
}
/* Type definitions */
struct constructHeader {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ SetConstructPPForm(void *, struct constructHeader *,
                                      char const *);
void EnvSetDeffunctionPPForm(void *theEnv, void *theDeffunction,
                             const char *thePPForm) {
  SetConstructPPForm(theEnv, (struct constructHeader *)theDeffunction,
                     thePPForm);
}


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

x86 assembly (clang, -O2):
<EnvSetDeffunctionPPForm>:
jmp    1030 <SetConstructPPForm@plt>

LLVM IR (-O0):
%struct.constructHeader = type { i32 }
define void @EnvSetDeffunctionPPForm(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = bitcast i8* %8 to %struct.constructHeader*
%10 = load i8*, i8** %6
%11 = call i32 @SetConstructPPForm(i8* %7, %struct.constructHeader* %9, i8* %10)
ret void
}

LLVM IR (-O2):
%struct.constructHeader = type { i32 }
define void @EnvSetDeffunctionPPForm(i8* %0, i8* %1, i8* %2) {
%4 = bitcast i8* %1 to %struct.constructHeader*
%5 = tail call i32 @SetConstructPPForm(i8* %0, %struct.constructHeader* %4, i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void Usage() {
  printf("Usage: db filename insert key data\n");
  printf("       db filename query key\n");
  printf("       db filename delete key\n");
  printf("       db filename walk\n");
  printf("       db filename dump\n");
  exit(-1);
}


x86 assembly (clang, -O0):
<Usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
call   1030 <printf@plt>
lea    0xf12(%rip),%rdi
call   1030 <printf@plt>
lea    0xf1f(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<Usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeef(%rip),%rdi
call   1030 <puts@plt>
lea    0xf00(%rip),%rdi
call   1030 <puts@plt>
lea    0xf12(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1e(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"Usage: db filename insert key data\0A\00"
@.str.1 = [30 x i8] c" db filename query key\0A\00"
@.str.2 = [31 x i8] c" db filename delete key\0A\00"
@.str.3 = [25 x i8] c" db filename walk\0A\00"
@.str.4 = [25 x i8] c" db filename dump\0A\00"
define void @Usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%6 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@str = [35 x i8] c"Usage: db filename insert key data\00"
@str.5 = [29 x i8] c" db filename query key\00"
@str.6 = [30 x i8] c" db filename delete key\00"
@str.7 = [24 x i8] c" db filename walk\00"
@str.8 = [24 x i8] c" db filename dump\00"
define void @Usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.8, i64 0, i64 0))
%6 = tail call i32 @exit(i32 -1)
unreachable
}
int main() { return 3 * 4; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0xc,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
ret i32 12
}

LLVM IR (-O2):
define i32 @main() {
ret i32 12
}
int main(void) {
  double lower = 99.4, higher = 99.5;
  if (higher > lower ? lower < higher : 0) {
    return 42;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movsd  0xef5(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xee0(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    114e <main+0x4e>
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
ja     115d <main+0x5d>
jmp    1169 <main+0x69>
xor    %eax,%eax
test   $0x1,%al
jne    115d <main+0x5d>
jmp    1169 <main+0x69>
movl   $0x2a,-0x4(%rbp)
jmp    1170 <main+0x70>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
store i32 0, i32* %1
store double 9.940000e+01, double* %2
store double 9.950000e+01, double* %3
%4 = load double, double* %3
%5 = load double, double* %2
%6 = fcmp ogt double %4, %5
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = load double, double* %2
%9 = load double, double* %3
%10 = fcmp olt double %8, %9
br i1 %10, label %12, label %13
11: ; preds = %0
br i1 false, label %12, label %13
12: ; preds = %11, %7
store i32 42, i32* %1
br label %14
13: ; preds = %11, %7
store i32 0, i32* %1
br label %14
14: ; preds = %13, %12
%15 = load i32, i32* %1
ret i32 %15
}

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

/* Variables and functions */
bool is_sync(uint32_t insn) {
  if (insn >> 11)
    return false;
  if ((insn & 0x3f) != 0x0f)
    return false;
  return true;
}


x86 assembly (clang, -O0):
<is_sync>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0xb,%eax
cmp    $0x0,%eax
je     1122 <is_sync+0x22>
movl   $0x0,-0x4(%rbp)
jmp    1144 <is_sync+0x44>
mov    -0x8(%rbp),%eax
and    $0x3f,%eax
cmp    $0xf,%eax
je     113d <is_sync+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    1144 <is_sync+0x44>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_sync>:
and    $0xfffff83f,%edi
xor    %eax,%eax
cmp    $0xf,%edi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @is_sync(i32 %0) {
%2 = and i32 %0, -1985
%3 = icmp eq i32 %2, 15
%4 = zext i1 %3 to i32
ret i32 %4
}
char *my_select_dict(int dict) {
  if (dict != 0) {
    return "0123456789abcdef\0";
  }
  return "0123456789ABCDEF\0";
}


x86 assembly (clang, -O0):
<my_select_dict>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1121 <my_select_dict+0x21>
lea    0xee8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    112c <my_select_dict+0x2c>
lea    0xeea(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_select_dict>:
test   %edi,%edi
lea    0xf09(%rip),%rcx
lea    0xef0(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [18 x i8] c"0123456789abcdef\00\00"
@.str.1 = [18 x i8] c"0123456789ABCDEF\00\00"
define i8* @my_select_dict(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %2
br label %8
7: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %8
8: ; preds = %7, %6
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [18 x i8] c"0123456789abcdef\00\00"
@.str.1 = [18 x i8] c"0123456789ABCDEF\00\00"
define i8* @my_select_dict(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
int test_imm_3Fint64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x3F << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_3Fint64_midword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x10,%rdx
and    $0x3f,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_3Fint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 4128768
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, int *, int);
int /*<<< orphan*/ write(int, char *, int);
void logit(char *buffer, int fifo_TOlog, int size, int debugv, int flogv) {
  int debug = debugv;
  int flog = flogv;
  memcpy(buffer, &debug, sizeof(int));
  memcpy(buffer + 4, &flog, sizeof(int));
  write(fifo_TOlog, buffer, size);
}


x86 assembly (clang, -O0):
<logit>:
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    %r8d,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
lea    -0x20(%rbp),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%edx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logit>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %ecx,0xc(%rsp)
mov    %r8d,0x8(%rsp)
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
lea    0x4(%rbx),%rdi
lea    0x8(%rsp),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @logit(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%13 = load i32, i32* %9
store i32 %13, i32* %11
%14 = load i32, i32* %10
store i32 %14, i32* %12
%15 = load i8*, i8** %6
%16 = call i32 @memcpy(i8* %15, i32* %11, i32 4)
%17 = load i8*, i8** %6
%18 = getelementptr inbounds i8, i8* %17, i64 4
%19 = call i32 @memcpy(i8* %18, i32* %12, i32 4)
%20 = load i32, i32* %7
%21 = load i8*, i8** %6
%22 = load i32, i32* %8
%23 = call i32 @write(i32 %20, i8* %21, i32 %22)
ret void
}

LLVM IR (-O2):
define void @logit(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i32* %6 to i8*
store i32 %3, i32* %6
%9 = bitcast i32* %7 to i8*
store i32 %4, i32* %7
%10 = call i32 @memcpy(i8* %0, i32* %6, i32 4)
%11 = getelementptr inbounds i8, i8* %0, i64 4
%12 = call i32 @memcpy(i8* %11, i32* %7, i32 4)
%13 = call i32 @write(i32 %1, i8* %0, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ parallel(int, int);
main() {
  parallel(1, 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <parallel@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <parallel@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @parallel(i32 1, i32 2)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @parallel(i32 1, i32 2)
ret i32 0
}
void native_irq_enable(void) { asm volatile("sti" : : : "memory"); }


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

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

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

LLVM IR (-O2):
define void @native_irq_enable() {
tail call void asm sideeffect "sti", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int *test(int **, int **);
void func() {
  int *mem1;
  int *mem2;
  int r1 = 5;
  int r2 = 6;
  mem1 = &r1;
  mem2 = &r2;
  int *a1 = test(&mem1, &mem2);
  int *b1 = test(&mem2, &mem1);
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x5,-0x14(%rbp)
movl   $0x6,-0x18(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x8(%rbp)
lea    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <test@plt>
mov    %rax,-0x20(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <test@plt>
mov    %rax,-0x28(%rbp)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movl   $0x5,0x4(%rsp)
movl   $0x6,(%rsp)
lea    0x4(%rsp),%rax
mov    %rax,0x10(%rsp)
mov    %rsp,%rax
mov    %rax,0x8(%rsp)
lea    0x10(%rsp),%r14
lea    0x8(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <test@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <test@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @func() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
store i32 5, i32* %3
store i32 6, i32* %4
store i32* %3, i32** %1
store i32* %4, i32** %2
%7 = call i32* @test(i32** %1, i32** %2)
store i32* %7, i32** %5
%8 = call i32* @test(i32** %2, i32** %1)
store i32* %8, i32** %6
ret void
}

LLVM IR (-O2):
define void @func() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32** %1 to i8*
%6 = bitcast i32** %2 to i8*
%7 = bitcast i32* %3 to i8*
store i32 5, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 6, i32* %4
store i32* %3, i32** %1
store i32* %4, i32** %2
%9 = call i32* @test(i32** %1, i32** %2)
%10 = call i32* @test(i32** %2, i32** %1)
ret void
}
/* Variables and functions */
scalar_t__ isspace(char);
char *skipspace(char *line) {
  char *pt;
  pt = line;
  while (isspace(*pt)) {
    pt++;
  }
  return (pt);
}


x86 assembly (clang, -O0):
<skipspace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     114b <skipspace+0x3b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <skipspace+0x14>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipspace>:
push   %rbx
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
nopl   0x0(%rax,%rax,1)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <isspace@plt>
test   %rax,%rax
jne    1120 <skipspace+0x10>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @skipspace(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %7, %2 ]
%4 = load i8, i8* %3
%5 = tail call i64 @isspace(i8 signext %4)
%6 = icmp eq i64 %5, 0
%7 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void *malloc(int);
void *safe_alloc(void) {
  void *ptr = malloc(sizeof(void *));
  if (ptr)
    return ptr;
  abort();
}


x86 assembly (clang, -O0):
<safe_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114b <safe_alloc+0x2b>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<safe_alloc>:
push   %rax
mov    $0x8,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1132 <safe_alloc+0x12>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @safe_alloc() {
%1 = alloca i8*
%2 = call i8* @malloc(i32 8)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = load i8*, i8** %1
ret i8* %6
7: ; preds = %0
%8 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define noalias i8* @safe_alloc() {
%1 = tail call dereferenceable_or_null(8) i8* @malloc(i32 8)
%2 = icmp eq i8* %1, null
br i1 %2, label %4, label %3
3: ; preds = %0
ret i8* %1
4: ; preds = %0
%5 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double volatile);
int main() {
  volatile double x;
  for (x = 0.0; x < 10.0; x += 0.2)
    ;
  printf("%.20g\n", x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  0xecc(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    115e <main+0x4e>
jmp    1143 <main+0x33>
movsd  -0x10(%rbp),%xmm0
movsd  0xeb8(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1127 <main+0x17>
movsd  -0x10(%rbp),%xmm0
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movq   $0x0,(%rsp)
movsd  0xedf(%rip),%xmm0
ucomisd (%rsp),%xmm0
jbe    1145 <main+0x35>
movsd  0xed8(%rip),%xmm1
movsd  (%rsp),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%rsp)
ucomisd (%rsp),%xmm0
ja     1130 <main+0x20>
movsd  (%rsp),%xmm0
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%.20g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
store volatile double 0.000000e+00, double* %2
br label %3
3: ; preds = %7, %0
%4 = load volatile double, double* %2
%5 = fcmp olt double %4, 1.000000e+01
br i1 %5, label %6, label %10
6: ; preds = %3
br label %7
7: ; preds = %6
%8 = load volatile double, double* %2
%9 = fadd double %8, 2.000000e-01
store volatile double %9, double* %2
br label %3
10: ; preds = %3
%11 = load volatile double, double* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %11)
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@.str = [7 x i8] c"%.20g\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
store volatile double 0.000000e+00, double* %1
%3 = load volatile double, double* %1
%4 = fcmp olt double %3, 1.000000e+01
br i1 %4, label %5, label %10
5: ; preds = %0, %5
%6 = load volatile double, double* %1
%7 = fadd double %6, 2.000000e-01
store volatile double %7, double* %1
%8 = load volatile double, double* %1
%9 = fcmp olt double %8, 1.000000e+01
br i1 %9, label %5, label %10
10: ; preds = %5, %0
%11 = load volatile double, double* %1
%12 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %11)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ SBWRITECSR(int, int /*<<< orphan*/);
void board_device_reset(void) {
  SBWRITECSR((0x0010064000 + 0x1000 * (2) + (0x00000208)), 0);
}


x86 assembly (clang, -O0):
<board_device_reset>:
push   %rbp
mov    %rsp,%rbp
mov    $0x10066208,%edi
xor    %esi,%esi
call   1030 <SBWRITECSR@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<board_device_reset>:
mov    $0x10066208,%edi
xor    %esi,%esi
jmp    1030 <SBWRITECSR@plt>

LLVM IR (-O0):
define void @board_device_reset() {
%1 = call i32 @SBWRITECSR(i32 268853768, i32 0)
ret void
}

LLVM IR (-O2):
define void @board_device_reset() {
%1 = tail call i32 @SBWRITECSR(i32 268853768, i32 0)
ret void
}
/* Type definitions */
struct timespec {
  unsigned long long tv_sec;
  scalar_t__ tv_nsec;
};
typedef scalar_t__ __u64;

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
__u64 time_get_ns(void) {
  struct timespec ts;
  clock_gettime(CLOCK_MONOTONIC, &ts);
  return ts.tv_sec * 1000000000ull + ts.tv_nsec;
}


x86 assembly (clang, -O0):
<time_get_ns>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
imul   $0x3b9aca00,-0x10(%rbp),%rax
3b
add    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_get_ns>:
sub    $0x18,%rsp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
imul   $0x3b9aca00,0x8(%rsp),%rax
9a 3b
add    0x10(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
@CLOCK_MONOTONIC = global i32 0
define i64 @time_get_ns() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_MONOTONIC
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%5 = load i64, i64* %4
%6 = mul i64 %5, 1000000000
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%8 = load i64, i64* %7
%9 = add i64 %6, %8
ret i64 %9
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
@CLOCK_MONOTONIC = global i32 0
define i64 @time_get_ns() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%6 = load i64, i64* %5
%7 = mul i64 %6, 1000000000
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%9 = load i64, i64* %8
%10 = add i64 %7, %9
ret i64 %10
}
void g_scanner_cur_value() {}


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

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

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

LLVM IR (-O2):
define void @g_scanner_cur_value() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
void foo(unsigned int *arr, unsigned int i, unsigned int j) {
  printf("arr[index]=%u\n", arr[3 - i - j]);
  return;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x3,%ecx
sub    -0xc(%rbp),%ecx
sub    -0x10(%rbp),%ecx
mov    %ecx,%ecx
mov    (%rax,%rcx,4),%esi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
add    %edx,%esi
mov    $0x3,%eax
sub    %esi,%eax
mov    (%rdi,%rax,4),%esi
lea    0xedd(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"arr[index]=%u\0A\00"
define void @foo(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = sub i32 3, %8
%10 = load i32, i32* %6
%11 = sub i32 %9, %10
%12 = zext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %7, i64 %12
%14 = load i32, i32* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %14)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"arr[index]=%u\0A\00"
define void @foo(i32* nocapture %0, i32 %1, i32 %2) {
%4 = add i32 %1, %2
%5 = sub i32 3, %4
%6 = zext i32 %5 to i64
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = load i32, i32* %7
%9 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %8)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t *blk_overflow(uint32_t *p, uint32_t *end, size_t nbytes) {
  uint32_t *q = p + ((nbytes + 3) >> 2);
  if (q > end || q < p)
    return NULL;
  return p;
}


x86 assembly (clang, -O0):
<blk_overflow>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
add    $0x3,%rcx
shr    $0x2,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
ja     1147 <blk_overflow+0x47>
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1154 <blk_overflow+0x54>
movq   $0x0,-0x8(%rbp)
jmp    115c <blk_overflow+0x5c>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<blk_overflow>:
add    $0x3,%rdx
and    $0xfffffffffffffffc,%rdx
add    %rdi,%rdx
xor    %eax,%eax
cmp    %rsi,%rdx
cmovbe %rdi,%rax
ret

LLVM IR (-O0):
define i32* @blk_overflow(i32* %0, i32* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i32*
store i32* %0, i32** %5
store i32* %1, i32** %6
store i64 %2, i64* %7
%9 = load i32*, i32** %5
%10 = load i64, i64* %7
%11 = add i64 %10, 3
%12 = lshr i64 %11, 2
%13 = getelementptr inbounds i32, i32* %9, i64 %12
store i32* %13, i32** %8
%14 = load i32*, i32** %8
%15 = load i32*, i32** %6
%16 = icmp ugt i32* %14, %15
br i1 %16, label %21, label %17
17: ; preds = %3
%18 = load i32*, i32** %8
%19 = load i32*, i32** %5
%20 = icmp ult i32* %18, %19
br i1 %20, label %21, label %22
21: ; preds = %17, %3
store i32* null, i32** %4
br label %24
22: ; preds = %17
%23 = load i32*, i32** %5
store i32* %23, i32** %4
br label %24
24: ; preds = %22, %21
%25 = load i32*, i32** %4
ret i32* %25
}

LLVM IR (-O2):
define i32* @blk_overflow(i32* readnone %0, i32* readnone %1, i64 %2) {
%4 = add i64 %2, 3
%5 = lshr i64 %4, 2
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = icmp ugt i32* %6, %1
%8 = select i1 %7, i32* null, i32* %0
ret i32* %8
}
void CL_HTTP_Init(void) {}


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

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

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

LLVM IR (-O2):
define void @CL_HTTP_Init() {
ret void
}
/* Variables and functions */
scalar_t__ is_char(char const);
char *skip_char(const char *s, int sz) {
  while (sz > 0 && is_char(*s)) {
    s++;
    sz--;
  }
  return (char *)s;
}


x86 assembly (clang, -O0):
<skip_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0xd(%rbp)
jle    1144 <skip_char+0x34>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <is_char@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1154 <skip_char+0x44>
jmp    116e <skip_char+0x5e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    111f <skip_char+0xf>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_char>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
test   %esi,%esi
jle    1139 <skip_char+0x29>
mov    %esi,%ebp
add    $0x1,%ebp
nop
movsbl (%rbx),%edi
call   1030 <is_char@plt>
test   %rax,%rax
je     1139 <skip_char+0x29>
add    $0x1,%rbx
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
jg     1120 <skip_char+0x10>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i8* @skip_char(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
br label %5
5: ; preds = %15, %2
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = call i64 @is_char(i8 signext %10)
%12 = icmp ne i64 %11, 0
br label %13
13: ; preds = %8, %5
%14 = phi i1 [ false, %5 ], [ %12, %8 ]
br i1 %14, label %15, label %20
15: ; preds = %13
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %3
%18 = load i32, i32* %4
%19 = add nsw i32 %18, -1
store i32 %19, i32* %4
br label %5
20: ; preds = %13
%21 = load i8*, i8** %3
ret i8* %21
}

LLVM IR (-O2):
define i8* @skip_char(i8* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2, %10
%5 = phi i32 [ %12, %10 ], [ %1, %2 ]
%6 = phi i8* [ %11, %10 ], [ %0, %2 ]
%7 = load i8, i8* %6
%8 = tail call i64 @is_char(i8 signext %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %4
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = add nsw i32 %5, -1
%13 = icmp sgt i32 %5, 1
br i1 %13, label %4, label %14
14: ; preds = %4, %10, %2
%15 = phi i8* [ %0, %2 ], [ %11, %10 ], [ %6, %4 ]
ret i8* %15
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
void FanIntEnable(unsigned long ulBase, unsigned long ulFlags) {
  DEBUG_ASSERT(ulBase == 0x40084000);
  (*((volatile unsigned long *)(ulBase + 0x00000090))) |= ulFlags;
}


x86 assembly (clang, -O0):
<FanIntEnable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x40084000,-0x8(%rbp)
40
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    0x90(%rax),%rcx
or     %rdx,%rcx
mov    %rcx,0x90(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FanIntEnable>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
cmp    $0x40084000,%rbx
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
or     %r14,0x90(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @FanIntEnable(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 = icmp eq i64 %5, 1074282496
%7 = zext i1 %6 to i32
%8 = call i32 @DEBUG_ASSERT(i32 %7)
%9 = load i64, i64* %4
%10 = load i64, i64* %3
%11 = add i64 %10, 144
%12 = inttoptr i64 %11 to i64*
%13 = load volatile i64, i64* %12
%14 = or i64 %13, %9
store volatile i64 %14, i64* %12
ret void
}

LLVM IR (-O2):
define void @FanIntEnable(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, 1074282496
%4 = zext i1 %3 to i32
%5 = tail call i32 @DEBUG_ASSERT(i32 %4)
%6 = add i64 %0, 144
%7 = inttoptr i64 %6 to i64*
%8 = load volatile i64, i64* %7
%9 = or i64 %8, %1
store volatile i64 %9, i64* %7
ret void
}
long time(long *p) { return 0L; }


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

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

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

LLVM IR (-O2):
define i64 @time(i64* nocapture readnone %0) {
ret i64 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_tagstruct_putu32() {
  printf("NOT IMPLEMENTED:"
         "pa_tagstruct_putu32"
         "\n");
}


x86 assembly (clang, -O0):
<pa_tagstruct_putu32>:
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_tagstruct_putu32>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [36 x i8] c"NOT IMPLEMENTED:pa_tagstruct_putu32\00"
define i32 @pa_tagstruct_putu32() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ sleep(int);
void sleepRandom() { sleep(rand() % 2 + 1); }


x86 assembly (clang, -O0):
<sleepRandom>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x1,%edi
call   1030 <sleep@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sleepRandom>:
push   %rax
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
and    $0xfffffffe,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x1,%edi
pop    %rax
jmp    1030 <sleep@plt>

LLVM IR (-O0):
define void @sleepRandom() {
%1 = call i32 (...) @rand()
%2 = srem i32 %1, 2
%3 = add nsw i32 %2, 1
%4 = call i32 @sleep(i32 %3)
ret void
}

LLVM IR (-O2):
define void @sleepRandom() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 2
%3 = add nsw i32 %2, 1
%4 = tail call i32 @sleep(i32 %3)
ret void
}
/* Type definitions */
typedef size_t uLongf;

/* Variables and functions */
int Z_OK;
int compress2(void *, size_t *, void const *, size_t, int);
int z_compress_level(void *dst, size_t *dstlen, const void *src, size_t srclen,
                     int level) {
  int ret;
  uLongf len = *dstlen;
  if ((ret = compress2(dst, &len, src, srclen, level)) == Z_OK)
    *dstlen = (size_t)len;
  return (ret);
}


x86 assembly (clang, -O0):
<z_compress_level>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
lea    -0x30(%rbp),%rsi
call   1030 <compress2@plt>
mov    %eax,-0x28(%rbp)
mov    0x2e96(%rip),%rcx
cmp    (%rcx),%eax
jne    116d <z_compress_level+0x5d>
mov    -0x30(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<z_compress_level>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    (%rsi),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rsi
call   1030 <compress2@plt>
mov    0x2ebf(%rip),%rcx
cmp    (%rcx),%eax
jne    113d <z_compress_level+0x2d>
mov    0x8(%rsp),%rcx
mov    %rcx,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@Z_OK = global i32 0
define i32 @z_compress_level(i8* %0, i64* nocapture %1, i8* %2, i64 %3, i32 %4) {
%6 = alloca i64
%7 = bitcast i64* %6 to i8*
%8 = load i64, i64* %1
store i64 %8, i64* %6
%9 = call i32 @compress2(i8* %0, i64* %6, i8* %2, i64 %3, i32 %4)
%10 = load i32, i32* @Z_OK
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %5
%13 = load i64, i64* %6
store i64 %13, i64* %1
br label %14
14: ; preds = %12, %5
ret i32 %9
}
double farenheit_to_celsius(double farenheit_temp) {
  return (farenheit_temp - 32.0) * (5.0 / 9.0);
}


x86 assembly (clang, -O0):
<farenheit_to_celsius>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xef2(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xede(%rip),%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<farenheit_to_celsius>:
addsd  0xef8(%rip),%xmm0
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @farenheit_to_celsius(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fsub double %3, 3.200000e+01
%5 = fmul double %4, 0x3FE1C71C71C71C72
ret double %5
}

LLVM IR (-O2):
define double @farenheit_to_celsius(double %0) {
%2 = fadd double %0, -3.200000e+01
%3 = fmul double %2, 0x3FE1C71C71C71C72
ret double %3
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int /*<<< orphan*/, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void util_get_current_time_string(char *buf, ssize_t max_len) {
  time_t now;
  struct tm *timeinfo;
  time(&now);
  timeinfo = localtime(&now);
  strftime(buf, max_len, "%m-%d-%Y_%X", timeinfo);
}


x86 assembly (clang, -O0):
<util_get_current_time_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x10(%rbp),%rdi
call   1040 <time@plt>
lea    -0x10(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rcx
lea    0xe99(%rip),%rdx
call   1050 <strftime@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_get_current_time_string>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xc(%rsp),%r14
mov    %r14,%rdi
call   1040 <time@plt>
mov    %r14,%rdi
call   1030 <localtime@plt>
lea    0xea7(%rip),%rdx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %rax,%rcx
call   1050 <strftime@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [12 x i8] c"%m-%d-%Y_%X\00"
define void @util_get_current_time_string(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.tm*
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = call i32 @time(i32* %5)
%8 = call %struct.tm* @localtime(i32* %5)
store %struct.tm* %8, %struct.tm** %6
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = load %struct.tm*, %struct.tm** %6
%12 = call i32 @strftime(i8* %9, i32 %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %struct.tm* %11)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [12 x i8] c"%m-%d-%Y_%X\00"
define void @util_get_current_time_string(i8* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @time(i32* %3)
%6 = call %struct.tm* @localtime(i32* %3)
%7 = call i32 @strftime(i8* %0, i32 %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %struct.tm* %6)
ret void
}
long long int instr_util_lssat(long long int val, unsigned int bitc) {
  long long int retval;
  long long int max = 1L;
  long long int min = 1L;
  max = (max << (bitc - 1)) - 1;
  min = -(min << (bitc - 1));
  if (val > max)
    retval = max;
  else if (val < min)
    retval = min;
  else
    retval = val;
  return retval;
}


x86 assembly (clang, -O0):
<instr_util_lssat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x1,-0x20(%rbp)
movq   $0x1,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
shl    %cl,%rax
sub    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
shl    %cl,%rax
mov    %rax,%rcx
xor    %eax,%eax
sub    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x20(%rbp),%rax
jle    1168 <instr_util_lssat+0x68>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1190 <instr_util_lssat+0x90>
mov    -0x8(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    1183 <instr_util_lssat+0x83>
mov    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    118b <instr_util_lssat+0x8b>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1190 <instr_util_lssat+0x90>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<instr_util_lssat>:
lea    -0x1(%rsi),%ecx
mov    $0x1,%edx
shl    %cl,%rdx
mov    %rdx,%rax
neg    %rax
cmp    %rdi,%rax
cmovle %rdi,%rax
lea    -0x1(%rdx),%rcx
cmp    %rdi,%rdx
cmovle %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @instr_util_lssat(i64 %0, i32 %1) {
%3 = add i32 %1, -1
%4 = zext i32 %3 to i64
%5 = shl nuw i64 1, %4
%6 = sub nsw i64 0, %5
%7 = icmp sgt i64 %5, %0
%8 = add nsw i64 %5, -1
%9 = icmp sgt i64 %6, %0
%10 = select i1 %9, i64 %6, i64 %0
%11 = select i1 %7, i64 %10, i64 %8
ret i64 %11
}