xunge/DecIR huggingface dataset:
unsigned char *strcpy(unsigned char *dest, const unsigned char *src) {
  unsigned char *ret = dest;
  if (dest && src) {
    while (*src)
      *dest++ = *src++;
    *dest = 0;
  }
  return ret;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     116a <strcpy+0x6a>
cmpq   $0x0,-0x10(%rbp)
je     116a <strcpy+0x6a>
jmp    112f <strcpy+0x2f>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1163 <strcpy+0x63>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    112f <strcpy+0x2f>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
test   %rdi,%rdi
je     1134 <strcpy+0x34>
test   %rsi,%rsi
je     1134 <strcpy+0x34>
mov    (%rsi),%cl
mov    %rax,%rdx
test   %cl,%cl
je     1131 <strcpy+0x31>
add    $0x1,%rsi
mov    %rax,%rdx
nopl   (%rax)
mov    %cl,(%rdx)
add    $0x1,%rdx
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1120 <strcpy+0x20>
movb   $0x0,(%rdx)
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %19
6: ; preds = %2
%7 = load i8, i8* %1
%8 = icmp eq i8 %7, 0
br i1 %8, label %17, label %9
9: ; preds = %6, %9
%10 = phi i8 [ %15, %9 ], [ %7, %6 ]
%11 = phi i8* [ %14, %9 ], [ %0, %6 ]
%12 = phi i8* [ %13, %9 ], [ %1, %6 ]
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = getelementptr inbounds i8, i8* %11, i64 1
store i8 %10, i8* %11
%15 = load i8, i8* %13
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %9
17: ; preds = %9, %6
%18 = phi i8* [ %0, %6 ], [ %14, %9 ]
store i8 0, i8* %18
br label %19
19: ; preds = %17, %2
ret i8* %0
}
int pcmfile_get_default_ch_mask(int channels) {
  static const int nch_to_mask[8] = {
      (0x4),
      ((0x1 | 0x2)),
      ((0x1 | 0x2) | 0x4),
      ((0x1 | 0x2) | (0x10 | 0x20)),
      (((0x1 | 0x2) | 0x4) | (0x200 | 0x400)),
      ((((0x1 | 0x2) | 0x4) | (0x200 | 0x400)) | 0x8),
      (((((0x1 | 0x2) | 0x4) | (0x200 | 0x400)) | 0x8) | 0x100),
      (((((0x1 | 0x2) | 0x4) | (0x200 | 0x400)) | 0x8) | (0x10 | 0x20))};
  if (channels < 1 || channels > 8)
    return 0;
  return nch_to_mask[channels - 1];
}


x86 assembly (clang, -O0):
<pcmfile_get_default_ch_mask>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     111b <pcmfile_get_default_ch_mask+0x1b>
cmpl   $0x8,-0x8(%rbp)
jle    1127 <pcmfile_get_default_ch_mask+0x27>
movl   $0x0,-0x4(%rbp)
jmp    113d <pcmfile_get_default_ch_mask+0x3d>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    0xec9(%rip),%rax
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pcmfile_get_default_ch_mask>:
lea    -0x9(%rdi),%ecx
xor    %eax,%eax
cmp    $0xfffffff8,%ecx
jb     1117 <pcmfile_get_default_ch_mask+0x17>
add    $0xffffffff,%edi
lea    0xeec(%rip),%rax
mov    (%rax,%rdi,4),%eax
ret

LLVM IR (-O0):
@pcmfile_get_default_ch_mask.nch_to_mask = internal constant [8 x i32] [i32 4, i32 3, i32 7, i32 51, i32 1543, i32 1551, i32 1807, i32 1599]
define i32 @pcmfile_get_default_ch_mask(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 1
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sgt i32 %7, 8
br i1 %8, label %9, label %10
9: ; preds = %6, %1
store i32 0, i32* %2
br label %16
10: ; preds = %6
%11 = load i32, i32* %3
%12 = sub nsw i32 %11, 1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [8 x i32], [8 x i32]* @pcmfile_get_default_ch_mask.nch_to_mask, i64 0, i64 %13
%15 = load i32, i32* %14
store i32 %15, i32* %2
br label %16
16: ; preds = %10, %9
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
@pcmfile_get_default_ch_mask.nch_to_mask = internal unnamed_addr constant [8 x i32] [i32 4, i32 3, i32 7, i32 51, i32 1543, i32 1551, i32 1807, i32 1599]
define i32 @pcmfile_get_default_ch_mask(i32 %0) {
%2 = add i32 %0, -9
%3 = icmp ult i32 %2, -8
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = add nsw i32 %0, -1
%6 = zext i32 %5 to i64
%7 = getelementptr inbounds [8 x i32], [8 x i32]* @pcmfile_get_default_ch_mask.nch_to_mask, i64 0, i64 %6
%8 = load i32, i32* %7
br label %9
9: ; preds = %1, %4
%10 = phi i32 [ %8, %4 ], [ 0, %1 ]
ret i32 %10
}
int min3(int x, int y, int z) {
  if (x <= y)
    return x <= z ? x : z;
  else
    return y <= z ? y : z;
}


x86 assembly (clang, -O0):
<min3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1141 <min3+0x41>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1130 <min3+0x30>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1136 <min3+0x36>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1164 <min3+0x64>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1158 <min3+0x58>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    115e <min3+0x5e>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @min3(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %21
11: ; preds = %3
%12 = load i32, i32* %5
%13 = load i32, i32* %7
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = load i32, i32* %5
br label %19
17: ; preds = %11
%18 = load i32, i32* %7
br label %19
19: ; preds = %17, %15
%20 = phi i32 [ %16, %15 ], [ %18, %17 ]
store i32 %20, i32* %4
br label %31
21: ; preds = %3
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = icmp sle i32 %22, %23
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = load i32, i32* %6
br label %29
27: ; preds = %21
%28 = load i32, i32* %7
br label %29
29: ; preds = %27, %25
%30 = phi i32 [ %26, %25 ], [ %28, %27 ]
store i32 %30, i32* %4
br label %31
31: ; preds = %29, %19
%32 = load i32, i32* %4
ret i32 %32
}

LLVM IR (-O2):
define i32 @min3(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, %2
%5 = select i1 %4, i32 %2, i32 %1
%6 = icmp slt i32 %5, %0
%7 = select i1 %6, i32 %5, i32 %0
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ EA_PCIX_32();
int /*<<< orphan*/ m68ki_jump(int /*<<< orphan*/);
void m68k_op_jmp_32_pcix(void) { m68ki_jump(EA_PCIX_32()); }


x86 assembly (clang, -O0):
<m68k_op_jmp_32_pcix>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <EA_PCIX_32@plt>
mov    %eax,%edi
call   1030 <m68ki_jump@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<m68k_op_jmp_32_pcix>:
push   %rax
xor    %eax,%eax
call   1040 <EA_PCIX_32@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <m68ki_jump@plt>

LLVM IR (-O0):
define void @m68k_op_jmp_32_pcix() {
%1 = call i32 (...) @EA_PCIX_32()
%2 = call i32 @m68ki_jump(i32 %1)
ret void
}

LLVM IR (-O2):
define void @m68k_op_jmp_32_pcix() {
%1 = tail call i32 (...) @EA_PCIX_32()
%2 = tail call i32 @m68ki_jump(i32 %1)
ret void
}
/* Variables and functions */
char *MySAR_fetch_configvalue(char *);
long atol(char *);
long MySAR_fetch_config_long(char *name) {
  char *val;
  val = MySAR_fetch_configvalue(name);
  return atol(val);
}


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

x86 assembly (clang, -O2):
<MySAR_fetch_config_long>:
push   %rax
call   1040 <MySAR_fetch_configvalue@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <atol@plt>

LLVM IR (-O0):
define i64 @MySAR_fetch_config_long(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @MySAR_fetch_configvalue(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i64 @atol(i8* %6)
ret i64 %7
}

LLVM IR (-O2):
define i64 @MySAR_fetch_config_long(i8* %0) {
%2 = tail call i8* @MySAR_fetch_configvalue(i8* %0)
%3 = tail call i64 @atol(i8* %2)
ret i64 %3
}
const char *Call_Description(void) {
  return "The `Call` class is used by types which can be called as functions.";
}


x86 assembly (clang, -O0):
<Call_Description>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Call_Description>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [68 x i8] c"The `Call` class is used by types which can be called as functions.\00"
define i8* @Call_Description() {
ret i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [68 x i8] c"The `Call` class is used by types which can be called as functions.\00"
define i8* @Call_Description() {
ret i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0)
}
int hash(int x, int length) {
  int s = 0;
  x &= 0x7FFFFFFF;
  while (x > 0) {
    s = s * 31 + ((x % 10) + 0x30);
    x >>= 1;
  }
  return (s & 0x7FFFFFFF) % length;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7fffffff,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1151 <hash+0x51>
imul   $0x1f,-0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%eax
add    $0x30,%edx
add    %edx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111c <hash+0x1c>
mov    -0xc(%rbp),%eax
and    $0x7fffffff,%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
xor    %eax,%eax
and    $0x7fffffff,%edi
je     114f <hash+0x4f>
mov    $0xcccccccd,%r8d
mov    %edi,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%ecx
shl    $0x5,%ecx
sub    %eax,%ecx
mov    %edi,%eax
imul   %r8,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%r9d
mov    %edi,%eax
sub    %r9d,%eax
add    %ecx,%eax
add    $0x30,%eax
shr    %edx
cmp    $0x1,%edi
mov    %edx,%edi
ja     1120 <hash+0x20>
and    $0x7fffffff,%eax
xor    %edx,%edx
idiv   %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @hash(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
%6 = load i32, i32* %3
%7 = and i32 %6, 2147483647
store i32 %7, i32* %3
br label %8
8: ; preds = %11, %2
%9 = load i32, i32* %3
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = load i32, i32* %5
%13 = mul nsw i32 %12, 31
%14 = load i32, i32* %3
%15 = srem i32 %14, 10
%16 = add nsw i32 %15, 48
%17 = add nsw i32 %13, %16
store i32 %17, i32* %5
%18 = load i32, i32* %3
%19 = ashr i32 %18, 1
store i32 %19, i32* %3
br label %8
20: ; preds = %8
%21 = load i32, i32* %5
%22 = and i32 %21, 2147483647
%23 = load i32, i32* %4
%24 = srem i32 %22, %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @hash(i32 %0, i32 %1) {
%3 = and i32 %0, 2147483647
%4 = icmp eq i32 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i32 [ %11, %5 ], [ 0, %2 ]
%7 = phi i32 [ %12, %5 ], [ %3, %2 ]
%8 = mul nsw i32 %6, 31
%9 = urem i32 %7, 10
%10 = or i32 %9, 48
%11 = add nsw i32 %10, %8
%12 = lshr i32 %7, 1
%13 = icmp ult i32 %7, 2
br i1 %13, label %14, label %5
14: ; preds = %5
%15 = and i32 %11, 2147483647
br label %16
16: ; preds = %14, %2
%17 = phi i32 [ 0, %2 ], [ %15, %14 ]
%18 = srem i32 %17, %1
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void CySoftwareReset() { printf("CYSoftwareReset called!!\n"); }


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

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

LLVM IR (-O0):
@.str = [26 x i8] c"CYSoftwareReset called!!\0A\00"
define void @CySoftwareReset() {
%1 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [25 x i8] c"CYSoftwareReset called!!\00"
define void @CySoftwareReset() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
bool is_prime(int number) {
  int divisor;
  if (number <= 1)
    return false;
  for (divisor = 2; divisor * divisor <= number; divisor++)
    if (number % divisor == 0)
      return false;
  return true;
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     111d <is_prime+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    116a <is_prime+0x6a>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1163 <is_prime+0x63>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1150 <is_prime+0x50>
movl   $0x0,-0x4(%rbp)
jmp    116a <is_prime+0x6a>
jmp    1155 <is_prime+0x55>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <is_prime+0x24>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
xor    %ecx,%ecx
cmp    $0x2,%edi
jge    110a <is_prime+0xa>
mov    %ecx,%eax
ret
cmp    $0x4,%edi
jae    1115 <is_prime+0x15>
mov    $0x1,%eax
ret
mov    $0x2,%esi
nopw   0x0(%rax,%rax,1)
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1107 <is_prime+0x7>
add    $0x1,%esi
mov    %esi,%eax
imul   %esi,%eax
cmp    %edi,%eax
jle    1120 <is_prime+0x20>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @is_prime(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = icmp ult i32 %0, 4
br i1 %4, label %13, label %8
5: ; preds = %8
%6 = mul nsw i32 %12, %12
%7 = icmp sgt i32 %6, %0
br i1 %7, label %13, label %8
8: ; preds = %3, %5
%9 = phi i32 [ %12, %5 ], [ 2, %3 ]
%10 = srem i32 %0, %9
%11 = icmp eq i32 %10, 0
%12 = add nuw nsw i32 %9, 1
br i1 %11, label %13, label %5
13: ; preds = %8, %5, %3, %1
%14 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 0, %8 ], [ 1, %5 ]
ret i32 %14
}
char initGet(struct args_t *args) { return 1; }


x86 assembly (clang, -O0):
<initGet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%al
movsbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.args_t = type opaque
define signext i8 @initGet(%struct.args_t* %0) {
%2 = alloca %struct.args_t*
store %struct.args_t* %0, %struct.args_t** %2
ret i8 1
}

LLVM IR (-O2):
%struct.args_t = type opaque
define signext i8 @initGet(%struct.args_t* nocapture readnone %0) {
ret i8 1
}
float fstep(float _edge, float _a) { return _a < _edge ? 0.0f : 1.0f; }


x86 assembly (clang, -O0):
<fstep>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
xorps  %xmm3,%xmm3
movss  0xedd(%rip),%xmm2
cmpltss %xmm1,%xmm0
movaps %xmm0,%xmm1
andps  %xmm3,%xmm1
andnps %xmm2,%xmm0
orps   %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fstep>:
cmpltss %xmm0,%xmm1
movss  0xef3(%rip),%xmm0
andnps %xmm0,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @fstep(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %4
%6 = load float, float* %3
%7 = fcmp olt float %5, %6
%8 = zext i1 %7 to i64
%9 = select i1 %7, float 0.000000e+00, float 1.000000e+00
ret float %9
}

LLVM IR (-O2):
define float @fstep(float %0, float %1) {
%3 = fcmp olt float %1, %0
%4 = select i1 %3, float 0.000000e+00, float 1.000000e+00
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("FOO != BAR\n");
  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)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [12 x i8] c"FOO != BAR\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 i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [11 x i8] c"FOO != BAR\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ENOTSUP;
int /*<<< orphan*/ errno;
int _open(const char *name, int flags, int mode) {
  errno = ENOTSUP;
  return -1;
}


x86 assembly (clang, -O0):
<_open>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    0x2ed3(%rip),%rax
mov    (%rax),%ecx
mov    0x2eba(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_open>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOTSUP = global i32 0
@errno = global i32 0
define i32 @_open(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* @ENOTSUP
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOTSUP = global i32 0
@errno = global i32 0
define i32 @_open(i8* nocapture readnone %0, i32 %1, i32 %2) {
%4 = load i32, i32* @ENOTSUP
store i32 %4, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ fn4();
int main() {
  fn4();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <fn4@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @fn4()
ret i32 0
}
/* Variables and functions */
double scs_sin_rz(double);
double sin_rz(double x) { return scs_sin_rz(x); }


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

x86 assembly (clang, -O2):
<sin_rz>:
jmp    1030 <scs_sin_rz@plt>

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

LLVM IR (-O2):
define double @sin_rz(double %0) {
%2 = tail call double @scs_sin_rz(double %0)
ret double %2
}
int FreeStack() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @FreeStack() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("hello how are u");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"hello how are u\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"hello how are u\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ f20_t();
void f20(void) { f20_t(); }


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

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

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

LLVM IR (-O2):
define void @f20() {
%1 = tail call i32 (...) @f20_t()
ret void
}
/* Type definitions */
struct rte_mempool {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ rte_mempool_sp_put(struct rte_mempool *, void *);
void rte_mempool_put(struct rte_mempool *mp, void *obj) {
  rte_mempool_sp_put(mp, obj);
}


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

x86 assembly (clang, -O2):
<rte_mempool_put>:
jmp    1030 <rte_mempool_sp_put@plt>

LLVM IR (-O0):
%struct.rte_mempool = type { i32 }
define void @rte_mempool_put(%struct.rte_mempool* %0, i8* %1) {
%3 = alloca %struct.rte_mempool*
%4 = alloca i8*
store %struct.rte_mempool* %0, %struct.rte_mempool** %3
store i8* %1, i8** %4
%5 = load %struct.rte_mempool*, %struct.rte_mempool** %3
%6 = load i8*, i8** %4
%7 = call i32 @rte_mempool_sp_put(%struct.rte_mempool* %5, i8* %6)
ret void
}

LLVM IR (-O2):
%struct.rte_mempool = type { i32 }
define void @rte_mempool_put(%struct.rte_mempool* %0, i8* %1) {
%3 = tail call i32 @rte_mempool_sp_put(%struct.rte_mempool* %0, i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ b1();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int main() {
  if (!b1())
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <b1@plt>
cmp    $0x0,%eax
jne    1156 <main+0x26>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <b1@plt>
test   %eax,%eax
jne    1143 <main+0x13>
xor    %eax,%eax
call   1030 <abort@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @b1()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
char *strtime(time_t t) {
  struct tm *mytm;
  static char s[20];
  mytm = localtime(&t);
  strftime(s, 20, "%d/%m/%Y#%H:%M:%S", mytm);
  return s;
}


x86 assembly (clang, -O0):
<strtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
lea    0x2efd(%rip),%rdi
mov    $0x14,%esi
lea    0xeb1(%rip),%rdx
call   1040 <strftime@plt>
lea    0x2ee5(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtime>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
lea    0x2f06(%rip),%rbx
lea    0xebf(%rip),%rdx
mov    %rbx,%rdi
mov    $0x14,%esi
mov    %rax,%rcx
call   1040 <strftime@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@strtime.s = internal global [20 x i8] zeroinitializer
@.str = [18 x i8] c"%d/%m/%Y#%H:%M:%S\00"
define i8* @strtime(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.tm*
store i32 %0, i32* %2
%4 = call %struct.tm* @localtime(i32* %2)
store %struct.tm* %4, %struct.tm** %3
%5 = load %struct.tm*, %struct.tm** %3
%6 = call i32 @strftime(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @strtime.s, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* %5)
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @strtime.s, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@strtime.s = internal global [20 x i8] zeroinitializer
@.str = [18 x i8] c"%d/%m/%Y#%H:%M:%S\00"
define i8* @strtime(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call %struct.tm* @localtime(i32* %2)
%4 = call i32 @strftime(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @strtime.s, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* %3)
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @strtime.s, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ create_write_byte(int);
void create_wait_theta(int angle) {
  ;
  create_write_byte(157);
  create_write_byte(((angle & 0xFFFF) >> 8));
  create_write_byte((angle & 0xFF));
  ;
}


x86 assembly (clang, -O0):
<create_wait_theta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x9d,%edi
call   1030 <create_write_byte@plt>
mov    -0x4(%rbp),%edi
and    $0xffff,%edi
sar    $0x8,%edi
call   1030 <create_write_byte@plt>
mov    -0x4(%rbp),%edi
and    $0xff,%edi
call   1030 <create_write_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_wait_theta>:
push   %rbx
mov    %edi,%ebx
mov    $0x9d,%edi
call   1030 <create_write_byte@plt>
movzbl %bh,%edi
call   1030 <create_write_byte@plt>
movzbl %bl,%edi
pop    %rbx
jmp    1030 <create_write_byte@plt>

LLVM IR (-O0):
define void @create_wait_theta(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @create_write_byte(i32 157)
%4 = load i32, i32* %2
%5 = and i32 %4, 65535
%6 = ashr i32 %5, 8
%7 = call i32 @create_write_byte(i32 %6)
%8 = load i32, i32* %2
%9 = and i32 %8, 255
%10 = call i32 @create_write_byte(i32 %9)
ret void
}

LLVM IR (-O2):
define void @create_wait_theta(i32 %0) {
%2 = tail call i32 @create_write_byte(i32 157)
%3 = lshr i32 %0, 8
%4 = and i32 %3, 255
%5 = tail call i32 @create_write_byte(i32 %4)
%6 = and i32 %0, 255
%7 = tail call i32 @create_write_byte(i32 %6)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;
struct tcphdr {
  int /*<<< orphan*/ source;
};

/* Variables and functions */
int /*<<< orphan*/ ntohs(int /*<<< orphan*/);
uint16_t tcphdr_source_ntohs(struct tcphdr *h) { return ntohs(h->source); }


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

x86 assembly (clang, -O2):
<tcphdr_source_ntohs>:
mov    (%rdi),%edi
jmp    1030 <ntohs@plt>

LLVM IR (-O0):
%struct.tcphdr = type { i32 }
define i32 @tcphdr_source_ntohs(%struct.tcphdr* %0) {
%2 = alloca %struct.tcphdr*
store %struct.tcphdr* %0, %struct.tcphdr** %2
%3 = load %struct.tcphdr*, %struct.tcphdr** %2
%4 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = call i32 @ntohs(i32 %5)
ret i32 %6
}

LLVM IR (-O2):
%struct.tcphdr = type { i32 }
define i32 @tcphdr_source_ntohs(%struct.tcphdr* nocapture %0) {
%2 = getelementptr inbounds %struct.tcphdr, %struct.tcphdr* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = tail call i32 @ntohs(i32 %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ dmbGetUsedMemSize();
int /*<<< orphan*/ dmbLog(int, char *, int /*<<< orphan*/);
void dmbLogSystemInfo() {
  dmbLog(2, "<System>: Used memory size is %d\n", dmbGetUsedMemSize());
}


x86 assembly (clang, -O0):
<dmbLogSystemInfo>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <dmbGetUsedMemSize@plt>
mov    %eax,%edx
mov    $0x2,%edi
lea    0xec7(%rip),%rsi
call   1030 <dmbLog@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmbLogSystemInfo>:
push   %rax
xor    %eax,%eax
call   1040 <dmbGetUsedMemSize@plt>
lea    0xed1(%rip),%rsi
mov    $0x2,%edi
mov    %eax,%edx
pop    %rax
jmp    1030 <dmbLog@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"<System>: Used memory size is %d\0A\00"
define void @dmbLogSystemInfo() {
%1 = call i32 (...) @dmbGetUsedMemSize()
%2 = call i32 @dmbLog(i32 2, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"<System>: Used memory size is %d\0A\00"
define void @dmbLogSystemInfo() {
%1 = tail call i32 (...) @dmbGetUsedMemSize()
%2 = tail call i32 @dmbLog(i32 2, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
char *uwsgi_concat2(char *, char *);
void uwsgi_opt_set_str_spaced(char *opt, char *value, void *key) {
  char **ptr = (char **)key;
  *ptr = uwsgi_concat2((char *)value, " ");
}


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

x86 assembly (clang, -O2):
<uwsgi_opt_set_str_spaced>:
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%rdi
lea    0xee2(%rip),%rsi
call   1030 <uwsgi_concat2@plt>
mov    %rax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
define void @uwsgi_opt_set_str_spaced(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8**
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = bitcast i8* %8 to i8**
store i8** %9, i8*** %7
%10 = load i8*, i8** %5
%11 = call i8* @uwsgi_concat2(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = load i8**, i8*** %7
store i8* %11, i8** %12
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define void @uwsgi_opt_set_str_spaced(i8* nocapture readnone %0, i8* %1, i8* nocapture writeonly %2) {
%4 = bitcast i8* %2 to i8**
%5 = tail call i8* @uwsgi_concat2(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sub(float *, int);
int main() {
  float array[10000];
  sub(array, 10000);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
sub    $0x9c48,%rsp
mov    %rsp,%rdi
mov    $0x2710,%esi
call   1030 <sub@plt>
xor    %eax,%eax
add    $0x9c48,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [10000 x float]
store i32 0, i32* %1
%3 = getelementptr inbounds [10000 x float], [10000 x float]* %2, i64 0, i64 0
%4 = call i32 @sub(float* %3, i32 10000)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [10000 x float]
%2 = bitcast [10000 x float]* %1 to i8*
%3 = getelementptr inbounds [10000 x float], [10000 x float]* %1, i64 0, i64 0
%4 = call i32 @sub(float* %3, i32 10000)
ret i32 0
}
int test_imm_8Auint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x8A << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_8Auint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 138
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int known_types() {
  struct {
    long long bin, oct, dec, hex;
  } val;
  memset(&val, 0, sizeof val);
  val.bin = 0x123456789abcdefLL;
  val.oct = 01234567123456701234567LL;
  val.dec = 12345678901234567890ULL;
  val.hex = val.bin - val.dec | val.oct;
  return 0;
}


x86 assembly (clang, -O0):
<known_types>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
movabs $0x123456789abcdef,%rax
45 23 01
mov    %rax,-0x20(%rbp)
movabs $0xa72ee53977053977,%rax
e5 2e a7
mov    %rax,-0x18(%rbp)
movabs $0xab54a98ceb1f0ad2,%rax
a9 54 ab
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
sub    -0x10(%rbp),%rax
or     -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.anon = type { i64, i64, i64, i64 }
define i32 @known_types() {
%1 = alloca %struct.anon
%2 = bitcast %struct.anon* %1 to i8*
%3 = getelementptr inbounds %struct.anon, %struct.anon* %1, i32 0, i32 0
store i64 81985529216486895, i64* %3
%4 = getelementptr inbounds %struct.anon, %struct.anon* %1, i32 0, i32 1
store i64 -6399925985474168457, i64* %4
%5 = getelementptr inbounds %struct.anon, %struct.anon* %1, i32 0, i32 2
store i64 -6101065172474983726, i64* %5
%6 = getelementptr inbounds %struct.anon, %struct.anon* %1, i32 0, i32 0
%7 = load i64, i64* %6
%8 = getelementptr inbounds %struct.anon, %struct.anon* %1, i32 0, i32 2
%9 = load i64, i64* %8
%10 = sub nsw i64 %7, %9
%11 = getelementptr inbounds %struct.anon, %struct.anon* %1, i32 0, i32 1
%12 = load i64, i64* %11
%13 = or i64 %10, %12
%14 = getelementptr inbounds %struct.anon, %struct.anon* %1, i32 0, i32 3
store i64 %13, i64* %14
ret i32 0
}

LLVM IR (-O2):
define i32 @known_types() {
ret i32 0
}
/* Variables and functions */
int hello();
int main(void) { return hello(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @hello()
ret i32 %1
}
void *rstrip(char *string) {
  char *end = string + len(string) - 1;
  while (end >= string && isspace(*end))
    end--;
  *(end + 1) = '\0';
  return string;
}


x86 assembly (clang, -O0):
<rstrip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <len@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmp    -0x8(%rbp),%rcx
mov    %al,-0x19(%rbp)
jb     117b <rstrip+0x5b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    118b <rstrip+0x6b>
jmp    119c <rstrip+0x7c>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1153 <rstrip+0x33>
mov    -0x10(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rstrip>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1030 <len@plt>
cltq
lea    (%rax,%r14,1),%rcx
add    $0xffffffffffffffff,%rcx
nopl   0x0(%rax,%rax,1)
mov    %rcx,%rbx
cmp    %r14,%rcx
jb     1158 <rstrip+0x38>
movsbl (%rbx),%edi
call   1040 <isspace@plt>
lea    -0x1(%rbx),%rcx
test   %eax,%eax
jne    1140 <rstrip+0x20>
movb   $0x0,0x1(%rbx)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @rstrip(i8* returned %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @len to i32 (i8*, ...)*)(i8* %0)
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
br label %5
5: ; preds = %9, %1
%6 = phi i8* [ %4, %1 ], [ %7, %9 ]
%7 = getelementptr inbounds i8, i8* %6, i64 -1
%8 = icmp ult i8* %7, %0
br i1 %8, label %14, label %9
9: ; preds = %5
%10 = load i8, i8* %7
%11 = sext i8 %10 to i32
%12 = tail call i32 @isspace(i32 %11)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %9
store i8 0, i8* %6
ret i8* %0
}
/* Variables and functions */
unsigned int __builtin_wasm_atomic_notify(int *, unsigned int);
unsigned int atomic_notify(int *addr, unsigned int count) {
  return __builtin_wasm_atomic_notify(addr, count);
}


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

x86 assembly (clang, -O2):
<atomic_notify>:
jmp    1030 <__builtin_wasm_atomic_notify@plt>

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

LLVM IR (-O2):
define i32 @atomic_notify(i32* %0, i32 %1) {
%3 = tail call i32 @__builtin_wasm_atomic_notify(i32* %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double, double, double);
int main() {
  double x = 152.5;
  double y = 152.1986;
  printf("%3.1lf - %3.4lf = %lf\n", x, y, x - y);
  printf("%3.1lf - %3.4lf = %lf\n", x, y, x - y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xee1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xecc(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
subsd  -0x18(%rbp),%xmm2
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
subsd  -0x18(%rbp),%xmm2
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf00(%rip),%rbx
movsd  0xee0(%rip),%xmm0
movsd  0xee0(%rip),%xmm1
movsd  0xee0(%rip),%xmm2
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
movsd  0xebd(%rip),%xmm0
movsd  0xebd(%rip),%xmm1
movsd  0xebd(%rip),%xmm2
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"%3.1lf - %3.4lf = %lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
store i32 0, i32* %1
store double 1.525000e+02, double* %2
store double 0x4063065AEE631F8A, double* %3
%4 = load double, double* %2
%5 = load double, double* %3
%6 = load double, double* %2
%7 = load double, double* %3
%8 = fsub double %6, %7
%9 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), double %4, double %5, double %8)
%10 = load double, double* %2
%11 = load double, double* %3
%12 = load double, double* %2
%13 = load double, double* %3
%14 = fsub double %12, %13
%15 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), double %10, double %11, double %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"%3.1lf - %3.4lf = %lf\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), double 1.525000e+02, double 0x4063065AEE631F8A, double 0x3FD34A2339C0EC00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), double 1.525000e+02, double 0x4063065AEE631F8A, double 0x3FD34A2339C0EC00)
ret i32 0
}
/* Variables and functions */
scalar_t__ bar(int);
int /*<<< orphan*/ baz(scalar_t__);
void foo(int y) {
  int a;
  if (y)
    baz(bar(7) + 6);
  else
    baz(bar(7) + 6);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1150 <foo+0x30>
mov    $0x7,%edi
call   1040 <bar@plt>
mov    %rax,%rdi
add    $0x6,%rdi
call   1030 <baz@plt>
jmp    1166 <foo+0x46>
mov    $0x7,%edi
call   1040 <bar@plt>
mov    %rax,%rdi
add    $0x6,%rdi
call   1030 <baz@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
mov    $0x7,%edi
call   1040 <bar@plt>
lea    0x6(%rax),%rdi
pop    %rax
jmp    1030 <baz@plt>

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

LLVM IR (-O2):
define void @foo(i32 %0) {
%2 = tail call i64 @bar(i32 7)
%3 = add nsw i64 %2, 6
%4 = tail call i32 @baz(i64 %3)
ret void
}
/* Variables and functions */
char *strchr(const char *s, int c) {
  while (*s != (char)c)
    if (*s++ == '\0')
      return NULL;
  return (char *)s;
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x14(%rbp),%ecx
movsbl %cl,%ecx
cmp    %ecx,%eax
je     114d <strchr+0x4d>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1148 <strchr+0x48>
movq   $0x0,-0x8(%rbp)
jmp    1155 <strchr+0x55>
jmp    110b <strchr+0xb>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    %rdi,%rax
movsbl %sil,%ecx
nopw   0x0(%rax,%rax,1)
movsbl (%rax),%edx
cmp    %edx,%ecx
je     1121 <strchr+0x21>
add    $0x1,%rax
test   %dl,%dl
jne    1110 <strchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
%3 = shl i32 %1, 24
%4 = ashr exact i32 %3, 24
br label %5
5: ; preds = %10, %2
%6 = phi i8* [ %0, %2 ], [ %11, %10 ]
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %4, %8
br i1 %9, label %13, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = icmp eq i8 %7, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %10
%14 = phi i8* [ null, %10 ], [ %6, %5 ]
ret i8* %14
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ serial_write(int /*<<< orphan*/ *, int);
void output_sensors_binary(double in_AccGyroMag[3][3]) {
  serial_write((uint8_t *)in_AccGyroMag, 3 * 3 * sizeof(double));
}


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

x86 assembly (clang, -O2):
<output_sensors_binary>:
mov    $0x48,%esi
jmp    1030 <serial_write@plt>

LLVM IR (-O0):
define void @output_sensors_binary([3 x double]* %0) {
%2 = alloca [3 x double]*
store [3 x double]* %0, [3 x double]** %2
%3 = load [3 x double]*, [3 x double]** %2
%4 = bitcast [3 x double]* %3 to i32*
%5 = call i32 @serial_write(i32* %4, i32 72)
ret void
}

LLVM IR (-O2):
define void @output_sensors_binary([3 x double]* %0) {
%2 = bitcast [3 x double]* %0 to i32*
%3 = tail call i32 @serial_write(i32* %2, i32 72)
ret void
}