xunge/DecIR huggingface dataset:
int test_imm_BDuint32_mem(unsigned int *val) {
  return ((*val) & (0xBD << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_BDuint32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 189
%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_BDuint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 189
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
char *bazelSays();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ simpleFun();
int main(int argc, char **argv) {
  printf("Call bazelSays() directly: %s\n", bazelSays());
  simpleFun();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <bazelSays@plt>
mov    %rax,%rsi
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <simpleFun@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <bazelSays@plt>
lea    0xec1(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <simpleFun@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [31 x i8] c"Call bazelSays() directly: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* (...) @bazelSays()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = tail call i32 (...) @simpleFun()
ret i32 0
}
/* Type definitions */
typedef size_t uint8_t;

/* Variables and functions */
unsigned int atoiu(const char *a) {
  uint8_t c = 0;
  unsigned int i = 0;
  while (a[c] != '\0') {
    i *= 10;
    i += a[c] - 0x30;
    c++;
  }
  return i;
}


x86 assembly (clang, -O0):
<atoiu>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1159 <atoiu+0x59>
imul   $0xa,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x30,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1117 <atoiu+0x17>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<atoiu>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <atoiu+0x28>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
lea    (%rax,%rax,4),%eax
lea    (%rcx,%rax,2),%eax
add    $0xffffffd0,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <atoiu+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @atoiu(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %14, %4 ], [ %2, %1 ]
%6 = phi i32 [ %11, %4 ], [ 0, %1 ]
%7 = phi i64 [ %12, %4 ], [ 0, %1 ]
%8 = sext i8 %5 to i32
%9 = mul i32 %6, 10
%10 = add i32 %9, -48
%11 = add i32 %10, %8
%12 = add i64 %7, 1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %4
16: ; preds = %4, %1
%17 = phi i32 [ 0, %1 ], [ %11, %4 ]
ret i32 %17
}
/* Variables and functions */
int fromHex(int);
void call_fromHex2_200_Good_FP() {
  char arr[17];
  int idx = fromHex(200);
  arr[idx + 1] = 'H';
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0xc8,%edi
call   1030 <fromHex@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
cltq
movb   $0x48,-0x20(%rbp,%rax,1)
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @call_fromHex2_200_Good_FP() {
%1 = alloca [17 x i8]
%2 = alloca i32
%3 = call i32 @fromHex(i32 200)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [17 x i8], [17 x i8]* %1, i64 0, i64 %6
store i8 72, i8* %7
ret void
}

LLVM IR (-O2):
define void @call_fromHex2_200_Good_FP() {
%1 = tail call i32 @fromHex(i32 200)
ret void
}
int cmp_int(const void *a, const void *b) {
  int p = *(int *)a;
  int q = *(int *)b;
  if (p < q)
    return -1;
  if (p > q)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<cmp_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1136 <cmp_int+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    1155 <cmp_int+0x55>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    114e <cmp_int+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    1155 <cmp_int+0x55>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_int>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @cmp_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp slt i32 %4, %6
%8 = icmp sgt i32 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
void LightController_Destroy(void) {}


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

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

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

LLVM IR (-O2):
define void @LightController_Destroy() {
ret void
}
void WatchdogIntClear(unsigned long ulBase) {
  ;
  (*((volatile unsigned long *)(ulBase + 0x0000000C))) = 0x00000001;
}


x86 assembly (clang, -O0):
<WatchdogIntClear>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movq   $0x1,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<WatchdogIntClear>:
movq   $0x1,0xc(%rdi)
ret

LLVM IR (-O0):
define void @WatchdogIntClear(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 %3, 12
%5 = inttoptr i64 %4 to i64*
store volatile i64 1, i64* %5
ret void
}

LLVM IR (-O2):
define void @WatchdogIntClear(i64 %0) {
%2 = add i64 %0, 12
%3 = inttoptr i64 %2 to i64*
store volatile i64 1, i64* %3
ret void
}
/* Variables and functions */
int ds_get_boolean(int /*<<< orphan*/, int);
int snmp_get_quick_print(void) { return ds_get_boolean(0, 13); }


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

x86 assembly (clang, -O2):
<snmp_get_quick_print>:
xor    %edi,%edi
mov    $0xd,%esi
jmp    1030 <ds_get_boolean@plt>

LLVM IR (-O0):
define i32 @snmp_get_quick_print() {
%1 = call i32 @ds_get_boolean(i32 0, i32 13)
ret i32 %1
}

LLVM IR (-O2):
define i32 @snmp_get_quick_print() {
%1 = tail call i32 @ds_get_boolean(i32 0, i32 13)
ret i32 %1
}
/* Variables and functions */
scalar_t__ COND_EQ();
int /*<<< orphan*/ EA_AW_8();
int /*<<< orphan*/ m68ki_write_8(int /*<<< orphan*/, int);
void m68k_op_seq_8_aw(void) { m68ki_write_8(EA_AW_8(), COND_EQ() ? 0xff : 0); }


x86 assembly (clang, -O0):
<m68k_op_seq_8_aw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <EA_AW_8@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <COND_EQ@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rcx
xor    %esi,%esi
mov    $0xff,%eax
cmp    $0x0,%rcx
cmovne %eax,%esi
call   1050 <m68ki_write_8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m68k_op_seq_8_aw>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <EA_AW_8@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <COND_EQ@plt>
test   %rax,%rax
mov    $0xff,%esi
cmove  %ebp,%esi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <m68ki_write_8@plt>

LLVM IR (-O0):
define void @m68k_op_seq_8_aw() {
%1 = call i32 (...) @EA_AW_8()
%2 = call i64 (...) @COND_EQ()
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i64
%5 = select i1 %3, i32 255, i32 0
%6 = call i32 @m68ki_write_8(i32 %1, i32 %5)
ret void
}

LLVM IR (-O2):
define void @m68k_op_seq_8_aw() {
%1 = tail call i32 (...) @EA_AW_8()
%2 = tail call i64 (...) @COND_EQ()
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 0, i32 255
%5 = tail call i32 @m68ki_write_8(i32 %1, i32 %4)
ret void
}
void disable_intr(void) { __asm__ volatile("cli" ::: "memory"); }


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

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

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

LLVM IR (-O2):
define void @disable_intr() {
tail call void asm sideeffect "cli", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
int sext_7bit_int(int value) {
  return (value & 0x40) ? (value | 0xffffff80) : (value & 0x7f);
}


x86 assembly (clang, -O0):
<sext_7bit_int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
je     1124 <sext_7bit_int+0x24>
mov    -0x4(%rbp),%eax
or     $0xffffff80,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <sext_7bit_int+0x2d>
mov    -0x4(%rbp),%eax
and    $0x7f,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sext_7bit_int>:
mov    %edi,%eax
shl    $0x19,%eax
sar    $0x1f,%eax
and    $0x7f,%edi
and    $0xffffff80,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @sext_7bit_int(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 64
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = or i32 %7, -128
br label %12
9: ; preds = %1
%10 = load i32, i32* %2
%11 = and i32 %10, 127
br label %12
12: ; preds = %9, %6
%13 = phi i32 [ %8, %6 ], [ %11, %9 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @sext_7bit_int(i32 %0) {
%2 = and i32 %0, 64
%3 = icmp eq i32 %2, 0
%4 = and i32 %0, 127
%5 = select i1 %3, i32 0, i32 -128
%6 = or i32 %5, %4
ret i32 %6
}
/* Variables and functions */
double floor(double);
double rint(double s) { return floor(s); }


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

x86 assembly (clang, -O2):
<rint>:
jmp    1030 <floor@plt>

LLVM IR (-O0):
define double @rint(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.floor.f64(double %3)
ret double %4
}

LLVM IR (-O2):
define double @rint(double %0) {
%2 = tail call double @llvm.floor.f64(double %0)
ret double %2
}
int d_ble_cr2(double a1) { return !(__builtin_islessequal(100, a1)); }


x86 assembly (clang, -O0):
<d_ble_cr2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
ucomisd %xmm1,%xmm0
setae  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_ble_cr2>:
xor    %eax,%eax
ucomisd 0xef6(%rip),%xmm0
setb   %al
ret

LLVM IR (-O0):
define i32 @d_ble_cr2(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp ole double 1.000000e+02, %3
%5 = xor i1 %4, true
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @d_ble_cr2(double %0) {
%2 = fcmp ult double %0, 1.000000e+02
%3 = zext i1 %2 to i32
ret i32 %3
}
__attribute__((no)) int ddd() {
  int ans;
  asm("ddd_label: .globl ddd_label");
  ans = eee() + 1;
  asm("ddd_label2: .globl ddd_label2");
  return ans;
}


x86 assembly (clang, -O0):
<ddd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp

x86 assembly (clang, -O2):
<ddd>:
push   %rax

LLVM IR (-O0):
define i32 @ddd() {
%1 = alloca i32
%2 = call i32 (...) @eee()
%3 = add nsw i32 %2, 1
store i32 %3, i32* %1
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
define i32 @ddd() {
tail call void asm sideeffect "ddd_label: .globl ddd_label", "~{dirflag},~{fpsr},~{flags}"()
%1 = tail call i32 (...) @eee()
%2 = add nsw i32 %1, 1
tail call void asm sideeffect "ddd_label2: .globl ddd_label2", "~{dirflag},~{fpsr},~{flags}"()
ret i32 %2
}
void breakpoint() { static int preventInline = 0; }


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

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

LLVM IR (-O0):
@breakpoint.preventInline = internal global i32 0
define void @breakpoint() {
ret void
}

LLVM IR (-O2):
define void @breakpoint() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LIB_SYSTICK_Run();
void HAL_SYSTICK_Callback(void) { LIB_SYSTICK_Run(); }


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

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

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

LLVM IR (-O2):
define void @HAL_SYSTICK_Callback() {
%1 = tail call i32 (...) @LIB_SYSTICK_Run()
ret void
}
__typeof__(memchr(1, 1, 1)) test_memchr_130(void) { return memchr(1, 1, 1); }


x86 assembly (clang, -O0):
<test_memchr_130>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rdx,%rdi
call   1030 <memchr@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_memchr_130>:
mov    $0x1,%edi
mov    $0x1,%edx
mov    $0x1,%esi
jmp    1030 <memchr@plt>

LLVM IR (-O0):
define i8* @test_memchr_130() {
%1 = call i8* @memchr(i8* inttoptr (i64 1 to i8*), i32 1, i64 1)
ret i8* %1
}

LLVM IR (-O2):
define i8* @test_memchr_130() {
%1 = tail call i8* @memchr(i8* dereferenceable(1) inttoptr (i64 1 to i8*), i32 1, i64 1)
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ console_1char_mode();
int /*<<< orphan*/ console_line_mode();
int run(int, char **);
int main(int argc, char *argv[]) {
  int result;
  console_1char_mode();
  result = run(argc, argv);
  console_line_mode();
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <console_1char_mode@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <run@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1050 <console_line_mode@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <console_1char_mode@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <run@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <console_line_mode@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @console_1char_mode()
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i32 @run(i32 %8, i8** %9)
store i32 %10, i32* %6
%11 = call i32 (...) @console_line_mode()
%12 = load i32, i32* %6
ret i32 %12
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 (...) @console_1char_mode()
%4 = tail call i32 @run(i32 %0, i8** %1)
%5 = tail call i32 (...) @console_line_mode()
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ base_convert_short_float(float *, short const *, int);
void convert_short_float(float *out, const short *in, int len) {
  base_convert_short_float(out, in, len);
}


x86 assembly (clang, -O0):
<convert_short_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <base_convert_short_float@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_short_float>:
jmp    1030 <base_convert_short_float@plt>

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

LLVM IR (-O2):
define void @convert_short_float(float* %0, i16* %1, i32 %2) {
%4 = tail call i32 @base_convert_short_float(float* %0, i16* %1, i32 %2)
ret void
}
int iscntrl(int c) {
  if ((c >= 0) && (c <= 31)) {
    return (1);
  } else if (c == 127) {
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<iscntrl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1127 <iscntrl+0x27>
cmpl   $0x1f,-0x8(%rbp)
jg     1127 <iscntrl+0x27>
movl   $0x1,-0x4(%rbp)
jmp    1149 <iscntrl+0x49>
cmpl   $0x7f,-0x8(%rbp)
jne    113d <iscntrl+0x3d>
movl   $0x1,-0x4(%rbp)
jmp    1149 <iscntrl+0x49>
jmp    1142 <iscntrl+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iscntrl>:
cmp    $0x20,%edi
setb   %al
cmp    $0x7f,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @iscntrl(i32 %0) {
%2 = alloca i32
%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 %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 31
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %2
br label %16
10: ; preds = %6, %1
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 127
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 1, i32* %2
br label %16
14: ; preds = %10
br label %15
15: ; preds = %14
store i32 0, i32* %2
br label %16
16: ; preds = %15, %13, %9
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
define i32 @iscntrl(i32 %0) {
%2 = icmp ult i32 %0, 32
%3 = icmp eq i32 %0, 127
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
scalar_t__ getcwd(char *, int);
int /*<<< orphan*/ puts(char *);
int main(int argc, char **argv) {
  char cwd[500];
  if (getcwd(cwd, 500)) {
    puts(cwd);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
mov    $0x1f4,%esi
call   1040 <getcwd@plt>
cmp    $0x0,%rax
je     1160 <main+0x40>
lea    -0x210(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x1f8,%rsp
mov    %rsp,%rdi
mov    $0x1f4,%esi
call   1040 <getcwd@plt>
test   %rax,%rax
je     1141 <main+0x21>
mov    %rsp,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x1f8,%rsp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [500 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%8 = call i64 @getcwd(i8* %7, i32 500)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%12 = call i32 @puts(i8* %11)
br label %13
13: ; preds = %10, %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [500 x i8]
%4 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%5 = call i64 @getcwd(i8* %4, i32 500)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = call i32 @puts(i8* %4)
br label %9
9: ; preds = %7, %2
ret i32 0
}
double read_S15Fixed16Number(char *p) {
  signed long i32;
  i32 = 16777216 * (signed long)((signed char *)p)[0] +
        65536 * (signed long)((unsigned char *)p)[1] +
        256 * (signed long)((unsigned char *)p)[2] +
        (signed long)((unsigned char *)p)[3];
  return (double)i32 / 65536.0;
}


x86 assembly (clang, -O0):
<read_S15Fixed16Number>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbq (%rax),%rax
shl    $0x18,%rax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x10,%rcx
add    %rcx,%rax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x8,%rcx
add    %rcx,%rax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
cvtsi2sdq -0x10(%rbp),%xmm0
movsd  0xeb1(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_S15Fixed16Number>:
mov    (%rdi),%eax
bswap  %eax
cvtsi2sd %eax,%xmm0
mulsd  0xef0(%rip),%xmm0
ret

LLVM IR (-O0):
define double @read_S15Fixed16Number(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i64
%8 = mul nsw i64 16777216, %7
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = zext i8 %11 to i64
%13 = mul nsw i64 65536, %12
%14 = add nsw i64 %8, %13
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 2
%17 = load i8, i8* %16
%18 = zext i8 %17 to i64
%19 = mul nsw i64 256, %18
%20 = add nsw i64 %14, %19
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i64 3
%23 = load i8, i8* %22
%24 = zext i8 %23 to i64
%25 = add nsw i64 %20, %24
store i64 %25, i64* %3
%26 = load i64, i64* %3
%27 = sitofp i64 %26 to double
%28 = fdiv double %27, 6.553600e+04
ret double %28
}

LLVM IR (-O2):
define double @read_S15Fixed16Number(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i64
%4 = shl nsw i64 %3, 24
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
%8 = shl nuw nsw i64 %7, 16
%9 = or i64 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = zext i8 %11 to i64
%13 = shl nuw nsw i64 %12, 8
%14 = or i64 %9, %13
%15 = getelementptr inbounds i8, i8* %0, i64 3
%16 = load i8, i8* %15
%17 = zext i8 %16 to i64
%18 = or i64 %14, %17
%19 = sitofp i64 %18 to double
%20 = fmul double %19, 0x3EF0000000000000
ret double %20
}
/* Variables and functions */
double M_PI_2;
double sin(double);
double sineEaseOutd(double p) { return sin(p * M_PI_2); }


x86 assembly (clang, -O0):
<sineEaseOutd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    0x2ebf(%rip),%rax
mulsd  (%rax),%xmm0
call   1030 <sin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sineEaseOutd>:
mov    0x2ed1(%rip),%rax
mulsd  (%rax),%xmm0
jmp    1030 <sin@plt>

LLVM IR (-O0):
@M_PI_2 = global double 0.000000e+00
define double @sineEaseOutd(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* @M_PI_2
%5 = fmul double %3, %4
%6 = call double @sin(double %5)
ret double %6
}

LLVM IR (-O2):
@M_PI_2 = global double 0.000000e+00
define double @sineEaseOutd(double %0) {
%2 = load double, double* @M_PI_2
%3 = fmul double %2, %0
%4 = tail call double @sin(double %3)
ret double %4
}
/* Variables and functions */
int change_memory_attr(unsigned long, int, int /*<<< orphan*/);
int set_memory_ro(unsigned long addr, int numpages) {
  return change_memory_attr(addr, numpages, 0);
}


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

x86 assembly (clang, -O2):
<set_memory_ro>:
xor    %edx,%edx
jmp    1030 <change_memory_attr@plt>

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

LLVM IR (-O2):
define i32 @set_memory_ro(i64 %0, i32 %1) {
%3 = tail call i32 @change_memory_attr(i64 %0, i32 %1, i32 0)
ret i32 %3
}
/* Type definitions */
struct passwd {
  int dummy;
};

/* Variables and functions */
struct passwd *getpwnam(const char *name) {
  return NULL;
}


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

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

LLVM IR (-O0):
%struct.passwd = type { i32 }
define %struct.passwd* @getpwnam(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret %struct.passwd* null
}

LLVM IR (-O2):
%struct.passwd = type { i32 }
define noalias %struct.passwd* @getpwnam(i8* nocapture readnone %0) {
ret %struct.passwd* null
}
void strnCpy(char *dest, const char *src, int n) {
  while (n > 0 && (*dest++ = *src++))
    n--;
  *dest = '\0';
}


x86 assembly (clang, -O0):
<strnCpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x15(%rbp)
jle    114c <strnCpy+0x4c>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    115c <strnCpy+0x5c>
jmp    116a <strnCpy+0x6a>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    110f <strnCpy+0xf>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<strnCpy>:
test   %edx,%edx
jle    112b <strnCpy+0x2b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rsi),%eax
mov    %al,(%rdi)
add    $0x1,%rdi
test   %al,%al
je     112b <strnCpy+0x2b>
add    $0x1,%rsi
lea    -0x1(%rdx),%eax
cmp    $0x1,%edx
mov    %eax,%edx
ja     1110 <strnCpy+0x10>
movb   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @strnCpy(i8* nocapture writeonly %0, i8* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %16
5: ; preds = %3, %5
%6 = phi i32 [ %13, %5 ], [ %2, %3 ]
%7 = phi i8* [ %12, %5 ], [ %1, %3 ]
%8 = phi i8* [ %10, %5 ], [ %0, %3 ]
%9 = load i8, i8* %7
%10 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %9, i8* %8
%11 = icmp ne i8 %9, 0
%12 = getelementptr inbounds i8, i8* %7, i64 1
%13 = add nsw i32 %6, -1
%14 = icmp ugt i32 %6, 1
%15 = select i1 %11, i1 %14, i1 false
br i1 %15, label %5, label %16
16: ; preds = %5, %3
%17 = phi i8* [ %0, %3 ], [ %10, %5 ]
store i8 0, i8* %17
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ST_Start();
void ST_changeDemoView(void) { ST_Start(); }


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

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

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

LLVM IR (-O2):
define void @ST_changeDemoView() {
%1 = tail call i32 (...) @ST_Start()
ret void
}
/* Variables and functions */
float kill_denormal(int /*<<< orphan*/);
int /*<<< orphan*/ sqrtf(float);
float fsqr_native(float f) { return kill_denormal(sqrtf(f)); }


x86 assembly (clang, -O0):
<fsqr_native>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sqrtf@plt>
mov    %eax,%edi
call   1040 <kill_denormal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsqr_native>:
push   %rax
call   1030 <sqrtf@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <kill_denormal@plt>

LLVM IR (-O0):
define float @fsqr_native(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i32 @sqrtf(float %3)
%5 = call float @kill_denormal(i32 %4)
ret float %5
}

LLVM IR (-O2):
define float @fsqr_native(float %0) {
%2 = tail call i32 @sqrtf(float %0)
%3 = tail call float @kill_denormal(i32 %2)
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void *someThreadFunction() {
  printf("Hello from a thread!\n");
  return NULL;
}


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

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

LLVM IR (-O0):
@.str = [22 x i8] c"Hello from a thread!\0A\00"
define i8* @someThreadFunction() {
%1 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret i8* null
}

LLVM IR (-O2):
@str = [21 x i8] c"Hello from a thread!\00"
define noalias i8* @someThreadFunction() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ ndsctl_print(char *);
void ndsctl_stop(void) { ndsctl_print("stop"); }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"stop\00"
define void @ndsctl_stop() {
%1 = tail call i32 @ndsctl_print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
void ADCExtiEventInjecTrigger(unsigned long ulBase) {
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000008))) |= 0x00008000;
}


x86 assembly (clang, -O0):
<ADCExtiEventInjecTrigger>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rcx
or     $0x8000,%rcx
mov    %rcx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADCExtiEventInjecTrigger>:
orq    $0x8000,0x8(%rdi)
ret

LLVM IR (-O0):
define void @ADCExtiEventInjecTrigger(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 %3, 8
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = or i64 %6, 32768
store volatile i64 %7, i64* %5
ret void
}

LLVM IR (-O2):
define void @ADCExtiEventInjecTrigger(i64 %0) {
%2 = add i64 %0, 8
%3 = inttoptr i64 %2 to i64*
%4 = load volatile i64, i64* %3
%5 = or i64 %4, 32768
store volatile i64 %5, i64* %3
ret void
}
/* Type definitions */
typedef unsigned long uint32_t;

/* Variables and functions */
void GPIO_toggleMultiDio(uint32_t dioMask) {
  ;
  (*((volatile unsigned long *)(0x40022000 + 0x000000B0))) = dioMask;
}


x86 assembly (clang, -O0):
<GPIO_toggleMultiDio>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0x400220b0,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPIO_toggleMultiDio>:
mov    %rdi,0x400220b0
40
ret

LLVM IR (-O0):
define void @GPIO_toggleMultiDio(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
store volatile i64 %3, i64* inttoptr (i64 1073881264 to i64*)
ret void
}

LLVM IR (-O2):
define void @GPIO_toggleMultiDio(i64 %0) {
store volatile i64 %0, i64* inttoptr (i64 1073881264 to i64*)
ret void
}
int test_imm_CBuint16_mem(unsigned short *val) {
  return ((*val) & (0xCB << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_CBuint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 203
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
void *ff(size_t size) { return NULL; }


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

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

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

LLVM IR (-O2):
define noalias i8* @ff(i64 %0) {
ret i8* null
}
int sys$setrwm(int flags) {
  return ({
    unsigned long resultvar;
    register long int _a1 asm("rdi") = (long)(flags);
    asm volatile("movq %1, %%rax\n\t"
                 "int $0x81\n\t"
                 : "=a"(resultvar)
                 : "i"(23), "r"(_a1)
                 : "memory", "cc", "r11", "cx");
    (long)resultvar;
  });
}


x86 assembly (clang, -O0):
<sys$setrwm>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x17,%rax
int    $0x81
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys$setrwm>:
movslq %edi,%rdi
mov    $0x17,%rax
int    $0x81
ret

LLVM IR (-O0):
define i32 @"sys$setrwm"(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
store i64 %7, i64* %4
%8 = load i64, i64* %4
%9 = call i64 asm sideeffect "movq $1, %rax\0A\09int $$0x81\0A\09", "={ax},i,{rdi},~{memory},~{cc},~{r11},~{cx},~{dirflag},~{fpsr},~{flags}"(i32 23, i64 %8)
store i64 %9, i64* %3
%10 = load i64, i64* %3
store i64 %10, i64* %5
%11 = load i64, i64* %5
%12 = trunc i64 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @"sys$setrwm"(i32 %0) {
%2 = sext i32 %0 to i64
%3 = tail call i64 asm sideeffect "movq $1, %rax\0A\09int $$0x81\0A\09", "={ax},i,{rdi},~{memory},~{cc},~{r11},~{cx},~{dirflag},~{fpsr},~{flags}"(i32 23, i64 %2)
%4 = trunc i64 %3 to i32
ret i32 %4
}
void blink_orange(int duration) {
  int i;
  *((volatile long *)0xc0220090) = 0x46;
  for (i = 0; i < duration; i++) {
    asm volatile("nop\n");
  }
  *((volatile long *)0xc0220090) = 0x44;
  for (i = 0; i < duration; i++) {
    asm volatile("nop\n");
  }
}


x86 assembly (clang, -O0):
<blink_orange>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0xc0220090,%eax
movq   $0x46,(%rax)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1135 <blink_orange+0x35>
nop
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111a <blink_orange+0x1a>
mov    $0xc0220090,%eax
movq   $0x44,(%rax)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1163 <blink_orange+0x63>
nop
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1148 <blink_orange+0x48>
pop    %rbp
ret

x86 assembly (clang, -O2):
<blink_orange>:
mov    $0xc0220090,%eax
movq   $0x46,(%rax)
test   %edi,%edi
jle    1147 <blink_orange+0x47>
mov    %edi,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
nop
add    $0xffffffff,%ecx
jne    1120 <blink_orange+0x20>
movq   $0x44,(%rax)
test   %edi,%edi
jle    1146 <blink_orange+0x46>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
nop
add    $0xffffffff,%edi
jne    1140 <blink_orange+0x40>
ret
movq   $0x44,(%rax)
ret

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

LLVM IR (-O2):
define void @blink_orange(i32 %0) {
store volatile i64 70, i64* inttoptr (i64 3223453840 to i64*)
%2 = icmp sgt i32 %0, 0
br i1 %2, label %4, label %3
3: ; preds = %1
store volatile i64 68, i64* inttoptr (i64 3223453840 to i64*)
br label %13
4: ; preds = %1, %4
%5 = phi i32 [ %6, %4 ], [ 0, %1 ]
tail call void asm sideeffect "nop\0A", "~{dirflag},~{fpsr},~{flags}"()
%6 = add nuw nsw i32 %5, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %4
8: ; preds = %4
store volatile i64 68, i64* inttoptr (i64 3223453840 to i64*)
br i1 %2, label %9, label %13
9: ; preds = %8, %9
%10 = phi i32 [ %11, %9 ], [ 0, %8 ]
tail call void asm sideeffect "nop\0A", "~{dirflag},~{fpsr},~{flags}"()
%11 = add nuw nsw i32 %10, 1
%12 = icmp eq i32 %11, %0
br i1 %12, label %13, label %9
13: ; preds = %9, %3, %8
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t s20_littleendian(uint8_t *b) {
  return b[0] + (b[1] << 8) + (b[2] << 16) + (b[3] << 24);
}


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

x86 assembly (clang, -O2):
<s20_littleendian>:
mov    0x4(%rdi),%eax
mov    0x8(%rdi),%ecx
shl    $0x8,%eax
add    (%rdi),%eax
shl    $0x10,%ecx
add    %eax,%ecx
mov    0xc(%rdi),%eax
shl    $0x18,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @s20_littleendian(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = load i32*, i32** %2
%7 = getelementptr inbounds i32, i32* %6, i64 1
%8 = load i32, i32* %7
%9 = shl i32 %8, 8
%10 = add nsw i32 %5, %9
%11 = load i32*, i32** %2
%12 = getelementptr inbounds i32, i32* %11, i64 2
%13 = load i32, i32* %12
%14 = shl i32 %13, 16
%15 = add nsw i32 %10, %14
%16 = load i32*, i32** %2
%17 = getelementptr inbounds i32, i32* %16, i64 3
%18 = load i32, i32* %17
%19 = shl i32 %18, 24
%20 = add nsw i32 %15, %19
ret i32 %20
}

LLVM IR (-O2):
define i32 @s20_littleendian(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = shl i32 %4, 8
%6 = add nsw i32 %5, %2
%7 = getelementptr inbounds i32, i32* %0, i64 2
%8 = load i32, i32* %7
%9 = shl i32 %8, 16
%10 = add nsw i32 %6, %9
%11 = getelementptr inbounds i32, i32* %0, i64 3
%12 = load i32, i32* %11
%13 = shl i32 %12, 24
%14 = add nsw i32 %10, %13
ret i32 %14
}
/* Variables and functions */
int strlen(char *);
void create(char s[], char w[]) {
  int len = strlen(s);
  int j;
  for (j = 0; j < len; j++)
    w[j] = '-';
  w[len] = '\0';
}


x86 assembly (clang, -O0):
<create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1159 <create+0x49>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x2d,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1133 <create+0x23>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ebp
test   %eax,%eax
jle    1140 <create+0x20>
mov    %ebp,%edx
mov    %rbx,%rdi
mov    $0x2d,%esi
call   1040 <memset@plt>
movslq %ebp,%rax
movb   $0x0,(%rbx,%rax,1)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @create(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
store i32 %8, i32* %5
store i32 0, i32* %6
br label %9
9: ; preds = %18, %2
%10 = load i32, i32* %6
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %21
13: ; preds = %9
%14 = load i8*, i8** %4
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
store i8 45, i8* %17
br label %18
18: ; preds = %13
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
store i32 %20, i32* %6
br label %9
21: ; preds = %9
%22 = load i8*, i8** %4
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
store i8 0, i8* %25
ret void
}

LLVM IR (-O2):
define void @create(i8* %0, i8* nocapture writeonly %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = zext i32 %3 to i64
br label %7
7: ; preds = %5, %2
%8 = sext i32 %3 to i64
%9 = getelementptr inbounds i8, i8* %1, i64 %8
store i8 0, i8* %9
ret void
}
/* Type definitions */
struct utmpx {
  scalar_t__ ut_type;
};

/* Variables and functions */
scalar_t__ DEAD_PROCESS;
scalar_t__ USER_PROCESS;
int /*<<< orphan*/ endutxent();
int /*<<< orphan*/ pututxline(struct utmpx *);
int /*<<< orphan*/ setutxent();
void foo(void) {
  struct utmpx ut;
  ut.ut_type = DEAD_PROCESS;
  ut.ut_type = USER_PROCESS;
  ut.ut_type = 0;
  setutxent();
  pututxline(&ut);
  endutxent();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
movq   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1050 <setutxent@plt>
lea    -0x8(%rbp),%rdi
call   1040 <pututxline@plt>
mov    $0x0,%al
call   1030 <endutxent@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
movq   $0x0,(%rsp)
xor    %eax,%eax
call   1050 <setutxent@plt>
mov    %rsp,%rdi
call   1040 <pututxline@plt>
xor    %eax,%eax
call   1030 <endutxent@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.utmpx = type { i64 }
@DEAD_PROCESS = global i64 0
@USER_PROCESS = global i64 0
define void @foo() {
%1 = alloca %struct.utmpx
%2 = load i64, i64* @DEAD_PROCESS
%3 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %1, i32 0, i32 0
store i64 %2, i64* %3
%4 = load i64, i64* @USER_PROCESS
%5 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %1, i32 0, i32 0
store i64 %4, i64* %5
%6 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %1, i32 0, i32 0
store i64 0, i64* %6
%7 = call i32 (...) @setutxent()
%8 = call i32 @pututxline(%struct.utmpx* %1)
%9 = call i32 (...) @endutxent()
ret void
}

LLVM IR (-O2):
%struct.utmpx = type { i64 }
@DEAD_PROCESS = global i64 0
@USER_PROCESS = global i64 0
define void @foo() {
%1 = alloca %struct.utmpx
%2 = bitcast %struct.utmpx* %1 to i8*
%3 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %1, i64 0, i32 0
store i64 0, i64* %3
%4 = tail call i32 (...) @setutxent()
%5 = call i32 @pututxline(%struct.utmpx* %1)
%6 = call i32 (...) @endutxent()
ret void
}