xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ RegReadA_lc898122(unsigned short, unsigned char *);
int /*<<< orphan*/ RegWriteA_lc898122(unsigned short, unsigned char);
void BsyWit_lc898122(unsigned short UsTrgAdr, unsigned char UcTrgDat) {
  unsigned char UcFlgVal;
  RegWriteA_lc898122(UsTrgAdr, UcTrgDat);
  UcFlgVal = 1;
  while (UcFlgVal) {
    RegReadA_lc898122(UsTrgAdr, &UcFlgVal);
    UcFlgVal &= (UcTrgDat & 0x0F);
  };
}


x86 assembly (clang, -O0):
<BsyWit_lc898122>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    -0x2(%rbp),%ax
movzwl %ax,%edi
movzbl -0x3(%rbp),%esi
call   1030 <RegWriteA_lc898122@plt>
movb   $0x1,-0x4(%rbp)
cmpb   $0x0,-0x4(%rbp)
je     1175 <BsyWit_lc898122+0x55>
lea    -0x4(%rbp),%rsi
movzwl -0x2(%rbp),%edi
call   1040 <RegReadA_lc898122@plt>
movzbl -0x3(%rbp),%ecx
and    $0xf,%ecx
movzbl -0x4(%rbp),%eax
and    %ecx,%eax
mov    %al,-0x4(%rbp)
jmp    1149 <BsyWit_lc898122+0x29>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BsyWit_lc898122>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <RegWriteA_lc898122@plt>
movb   $0x1,0xf(%rsp)
and    $0xf,%bl
movzwl %bp,%ebp
lea    0xf(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
mov    %r14,%rsi
call   1040 <RegReadA_lc898122@plt>
and    %bl,0xf(%rsp)
jne    1150 <BsyWit_lc898122+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @BsyWit_lc898122(i16 zeroext %0, i8 zeroext %1) {
%3 = alloca i16
%4 = alloca i8
%5 = alloca i8
store i16 %0, i16* %3
store i8 %1, i8* %4
%6 = load i16, i16* %3
%7 = load i8, i8* %4
%8 = call i32 @RegWriteA_lc898122(i16 zeroext %6, i8 zeroext %7)
store i8 1, i8* %5
br label %9
9: ; preds = %12, %2
%10 = load i8, i8* %5
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %22
12: ; preds = %9
%13 = load i16, i16* %3
%14 = call i32 @RegReadA_lc898122(i16 zeroext %13, i8* %5)
%15 = load i8, i8* %4
%16 = zext i8 %15 to i32
%17 = and i32 %16, 15
%18 = load i8, i8* %5
%19 = zext i8 %18 to i32
%20 = and i32 %19, %17
%21 = trunc i32 %20 to i8
store i8 %21, i8* %5
br label %9
22: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @BsyWit_lc898122(i16 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = tail call i32 @RegWriteA_lc898122(i16 zeroext %0, i8 zeroext %1)
store i8 1, i8* %3
%5 = and i8 %1, 15
br label %6
6: ; preds = %2, %6
%7 = call i32 @RegReadA_lc898122(i16 zeroext %0, i8* %3)
%8 = load i8, i8* %3
%9 = and i8 %5, %8
store i8 %9, i8* %3
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %6
11: ; preds = %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SPI_MAX7221_DisableRxInt();
int /*<<< orphan*/ SPI_MAX7221_DisableTxInt();
void SPI_MAX7221_DisableInt(void) {
  SPI_MAX7221_DisableTxInt();
  SPI_MAX7221_DisableRxInt();
}


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

x86 assembly (clang, -O2):
<SPI_MAX7221_DisableInt>:
push   %rax
xor    %eax,%eax
call   1030 <SPI_MAX7221_DisableTxInt@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <SPI_MAX7221_DisableRxInt@plt>

LLVM IR (-O0):
define void @SPI_MAX7221_DisableInt() {
%1 = call i32 (...) @SPI_MAX7221_DisableTxInt()
%2 = call i32 (...) @SPI_MAX7221_DisableRxInt()
ret void
}

LLVM IR (-O2):
define void @SPI_MAX7221_DisableInt() {
%1 = tail call i32 (...) @SPI_MAX7221_DisableTxInt()
%2 = tail call i32 (...) @SPI_MAX7221_DisableRxInt()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ TCSBRK;
int syscall_cp(int, int, int /*<<< orphan*/, int);
int tcdrain(int fd) { return syscall_cp(54, fd, TCSBRK, 1); }


x86 assembly (clang, -O0):
<tcdrain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    0x2ecb(%rip),%rax
mov    (%rax),%edx
mov    $0x36,%edi
mov    $0x1,%ecx
call   1030 <syscall_cp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcdrain>:
mov    %edi,%esi
mov    0x2ed7(%rip),%rax
mov    (%rax),%edx
mov    $0x36,%edi
mov    $0x1,%ecx
jmp    1030 <syscall_cp@plt>

LLVM IR (-O0):
@TCSBRK = global i32 0
define i32 @tcdrain(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @TCSBRK
%5 = call i32 @syscall_cp(i32 54, i32 %3, i32 %4, i32 1)
ret i32 %5
}

LLVM IR (-O2):
@TCSBRK = global i32 0
define i32 @tcdrain(i32 %0) {
%2 = load i32, i32* @TCSBRK
%3 = tail call i32 @syscall_cp(i32 54, i32 %0, i32 %2, i32 1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage(void) {
  printf("Usage: tgl [options] [infile]\nText Generation Language\n\n");
  printf("  -l file  Use the given file (instead of ~/.tgl) for the user "
         "library.\n"
         "  -r file  Use the given file (instead of ~/.tgl_registers) to "
         "preserve\n"
         "           registers.\n"
         "  -c name  Specify the current context.\n"
         "  -p       Look for payload at beginning of code\n"
         "  -h       This help message.\n");
}


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

x86 assembly (clang, -O2):
<print_usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf14(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [57 x i8] c"Usage: tgl [options] [infile]\0AText Generation Language\0A\0A\00"
@.str.1 = [286 x i8] c" -l file Use the given file (instead of ~/.tgl) for the user library.\0A -r file Use the given file (instead of ~/.tgl_registers) to preserve\0A registers.\0A -c name Specify the current context.\0A -p Look for payload at beginning of code\0A -h This help message.\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([286 x i8], [286 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [56 x i8] c"Usage: tgl [options] [infile]\0AText Generation Language\0A\00"
@str.2 = [285 x i8] c" -l file Use the given file (instead of ~/.tgl) for the user library.\0A -r file Use the given file (instead of ~/.tgl_registers) to preserve\0A registers.\0A -c name Specify the current context.\0A -p Look for payload at beginning of code\0A -h This help message.\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([285 x i8], [285 x i8]* @str.2, i64 0, i64 0))
ret void
}
float avg2(float average, float input, float weight) {
  return input * weight + average * (1.0 - weight);
}


x86 assembly (clang, -O0):
<avg2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm2
cvtss2sd %xmm2,%xmm3
movsd  0xec5(%rip),%xmm2
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<avg2>:
mulss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm2,%xmm2
movsd  0xee8(%rip),%xmm3
subsd  %xmm2,%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm1,%xmm3
xorps  %xmm0,%xmm0
cvtsd2ss %xmm3,%xmm0
ret

LLVM IR (-O0):
define float @avg2(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %5
%8 = load float, float* %6
%9 = fmul float %7, %8
%10 = fpext float %9 to double
%11 = load float, float* %4
%12 = fpext float %11 to double
%13 = load float, float* %6
%14 = fpext float %13 to double
%15 = fsub double 1.000000e+00, %14
%16 = call double @llvm.fmuladd.f64(double %12, double %15, double %10)
%17 = fptrunc double %16 to float
ret float %17
}

LLVM IR (-O2):
define float @avg2(float %0, float %1, float %2) {
%4 = fmul float %1, %2
%5 = fpext float %4 to double
%6 = fpext float %0 to double
%7 = fpext float %2 to double
%8 = fsub double 1.000000e+00, %7
%9 = tail call double @llvm.fmuladd.f64(double %6, double %8, double %5)
%10 = fptrunc double %9 to float
ret float %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float, float);
void fc_init(float a, float b) { printf("fc_init: %f, %f\n", a, b); }


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"fc_init: %f, %f\0A\00"
define void @fc_init(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), float %5, float %6)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"fc_init: %f, %f\0A\00"
define void @fc_init(float %0, float %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), float %0, float %1)
ret void
}
void genreserved() {}


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

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

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

LLVM IR (-O2):
define void @genreserved() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, size_t, char *, char const *);
size_t strlen(char const *);
size_t strlcpy(char *dst, const char *src, size_t size) {
  snprintf(dst, size, "%s", src);
  return strlen(src);
}


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

x86 assembly (clang, -O2):
<strlcpy>:
push   %rbx
mov    %rsi,%rbx
lea    0xed5(%rip),%rax
mov    %rdx,%rsi
mov    %rax,%rdx
mov    %rbx,%rcx
call   1040 <snprintf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <strlen@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i64 @strlcpy(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @snprintf(i8* %0, i64 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%5 = tail call i64 @strlen(i8* dereferenceable(1) %1)
ret i64 %5
}
int int_lt(int *a, int *b) { return *a < *b; }


x86 assembly (clang, -O0):
<int_lt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_lt>:
mov    (%rdi),%ecx
xor    %eax,%eax
cmp    (%rsi),%ecx
setl   %al
ret

LLVM IR (-O0):
define i32 @int_lt(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* %5
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = icmp slt i32 %6, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @int_lt(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
const char *_safe_check_longlong(const char *fmt, int *have_longlong) {
  *have_longlong = 0;
  if (*fmt == 'l') {
    fmt++;
    if (*fmt != 'l') {
      *have_longlong = (sizeof(long) == sizeof(long long));
    } else {
      fmt++;
      *have_longlong = 1;
    }
  }
  return fmt;
}


x86 assembly (clang, -O0):
<_safe_check_longlong>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x6c,%eax
jne    116c <_safe_check_longlong+0x6c>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x6c,%eax
je     1151 <_safe_check_longlong+0x51>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    1167 <_safe_check_longlong+0x67>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    116c <_safe_check_longlong+0x6c>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_safe_check_longlong>:
mov    %rdi,%rax
movl   $0x0,(%rsi)
cmpb   $0x6c,(%rdi)
jne    1124 <_safe_check_longlong+0x24>
lea    0x2(%rax),%rcx
cmpb   $0x6c,0x1(%rax)
lea    0x1(%rax),%rax
cmove  %rcx,%rax
movl   $0x1,(%rsi)
ret

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

LLVM IR (-O2):
define i8* @_safe_check_longlong(i8* %0, i32* nocapture writeonly %1) {
store i32 0, i32* %1
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 108
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 108
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = select i1 %8, i8* %9, i8* %6
store i32 1, i32* %1
br label %11
11: ; preds = %5, %2
%12 = phi i8* [ %0, %2 ], [ %10, %5 ]
ret i8* %12
}
int test_imm_31int16_mem(short *val) {
  return ((*val) & (-0x31 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_31int16_mem>:
movzwl (%rdi),%eax
test   $0xffcf,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_31int16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, -49
%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_31int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -49
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
scalar_t__ llrint(double);
long long llrintl(long double x) { return (long double)llrint((double)x); }


x86 assembly (clang, -O0):
<llrintl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
fstpl  -0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <llrint@plt>
mov    %rax,-0x18(%rbp)
fildll -0x18(%rbp)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<llrintl>:
fldt   0x8(%rsp)
fstpl  -0x8(%rsp)
movsd  -0x8(%rsp),%xmm0
jmp    1030 <llrint@plt>

LLVM IR (-O0):
define i64 @llrintl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = fptrunc x86_fp80 %3 to double
%5 = call i64 @llrint(double %4)
%6 = sitofp i64 %5 to x86_fp80
%7 = fptosi x86_fp80 %6 to i64
ret i64 %7
}

LLVM IR (-O2):
define i64 @llrintl(x86_fp80 %0) {
%2 = fptrunc x86_fp80 %0 to double
%3 = tail call i64 @llrint(double %2)
ret i64 %3
}
int test_imm_29int8_reg(signed char val) {
  return ((val) & (-0x29 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_29int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xffffffd7,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_29int8_reg>:
test   $0xd7,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_29int8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, -41
%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_29int8_reg(i8 signext %0) {
%2 = and i8 %0, -41
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void AUXSMPHAcquire(uint32_t ui32Semaphore) {

  ;
  while ((*((volatile unsigned long *)(0x400C8000 + 0x00000000 +
                                       4 * ui32Semaphore))) == 0x00000000) {
  }
}


x86 assembly (clang, -O0):
<AUXSMPHAcquire>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
add    $0x400c8000,%eax
cltq
mov    (%rax),%rax
cmp    $0x0,%rax
jne    1126 <AUXSMPHAcquire+0x26>
jmp    1107 <AUXSMPHAcquire+0x7>
pop    %rbp
ret

x86 assembly (clang, -O2):
<AUXSMPHAcquire>:
movslq %edi,%rax
lea    0x400c8000(,%rax,4),%rax
40
nopl   0x0(%rax,%rax,1)
cmpq   $0x0,(%rax)
je     1110 <AUXSMPHAcquire+0x10>
ret

LLVM IR (-O0):
define void @AUXSMPHAcquire(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %11, %1
%4 = load i32, i32* %2
%5 = mul nsw i32 4, %4
%6 = add nsw i32 1074561024, %5
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %3
br label %3
12: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @AUXSMPHAcquire(i32 %0) {
%2 = shl nsw i32 %0, 2
%3 = add nsw i32 %2, 1074561024
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i64*
br label %6
6: ; preds = %6, %1
%7 = load volatile i64, i64* %5
%8 = icmp eq i64 %7, 0
br i1 %8, label %6, label %9
9: ; preds = %6
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
size_t snprintf(char *, size_t, char *, size_t);
char *size_to_string(size_t value) {
  size_t charectersRequired = snprintf(NULL, 0, "%zu", value);
  char *toReturn = (char *)malloc(sizeof(char) * (++charectersRequired));
  snprintf(toReturn, charectersRequired, "%zu", value);
  return toReturn;
}


x86 assembly (clang, -O0):
<size_to_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%esi
lea    0xec5(%rip),%rdx
mov    %rsi,%rdi
call   1030 <snprintf@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
shl    $0x0,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rcx
lea    0xe8b(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<size_to_string>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
lea    0xece(%rip),%r14
xor    %edi,%edi
xor    %esi,%esi
mov    %r14,%rdx
mov    %r15,%rcx
call   1030 <snprintf@plt>
lea    0x1(%rax),%r12
mov    %r12d,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
call   1030 <snprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%zu\00"
define i8* @size_to_string(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i8*
store i64 %0, i64* %2
%5 = load i64, i64* %2
%6 = call i64 @snprintf(i8* null, i64 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %5)
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = add i64 %7, 1
store i64 %8, i64* %3
%9 = mul i64 1, %8
%10 = trunc i64 %9 to i32
%11 = call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to i8*
store i8* %12, i8** %4
%13 = load i8*, i8** %4
%14 = load i64, i64* %3
%15 = load i64, i64* %2
%16 = call i64 @snprintf(i8* %13, i64 %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %15)
%17 = load i8*, i8** %4
ret i8* %17
}

LLVM IR (-O2):
@.str = [4 x i8] c"%zu\00"
define i8* @size_to_string(i64 %0) {
%2 = tail call i64 @snprintf(i8* null, i64 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %0)
%3 = add i64 %2, 1
%4 = trunc i64 %3 to i32
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to i8*
%7 = tail call i64 @snprintf(i8* %6, i64 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %0)
ret i8* %6
}
int string_compare(const char *string1, const char *string2) {
  int esi, edi;
  register int eax;
  asm volatile("cld\n"
               "1:  lodsb\n"
               "scasb\n"
               "jne 2f\n"
               "testb %%al, %%al\n"
               "jne 1b\n"
               "xorl %%eax, %%eax\n"
               "jmp 3f\n"
               "2:  sbbl %%eax, %%eax\n"
               "orb $1, %%al\n"
               "3:"
               : "=a"(eax), "=&S"(esi), "=&D"(edi)
               : "1"(string1), "2"(string2));
  return eax;
}


x86 assembly (clang, -O0):
<string_compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdi
cld
lods   %ds:(%rsi),%al
scas   %es:(%rdi),%al
jne    112c <string_compare+0x2c>
test   %al,%al
jne    1115 <string_compare+0x15>
xor    %eax,%eax
jmp    1130 <string_compare+0x30>
sbb    %eax,%eax
or     $0x1,%al
mov    %eax,-0x1c(%rbp)
mov    %esi,%eax
mov    %eax,-0x14(%rbp)
mov    %edi,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_compare>:
mov    %rsi,%rax
mov    %rdi,%rsi
mov    %rax,%rdi
cld
lods   %ds:(%rsi),%al
scas   %es:(%rdi),%al
jne    1116 <string_compare+0x16>
test   %al,%al
jne    110a <string_compare+0xa>
xor    %eax,%eax
jmp    111a <string_compare+0x1a>
sbb    %eax,%eax
or     $0x1,%al
ret

LLVM IR (-O0):
define i32 @string_compare(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = call { i32, i8*, i8* } asm sideeffect "cld\0A1: lodsb\0Ascasb\0Ajne 2f\0Atestb %al, %al\0Ajne 1b\0Axorl %eax, %eax\0Ajmp 3f\0A2: sbbl %eax, %eax\0Aorb $$1, %al\0A3:", "={ax},=&{si},=&{di},1,2,~{dirflag},~{fpsr},~{flags}"(i8* %8, i8* %9)
%11 = extractvalue { i32, i8*, i8* } %10, 0
%12 = extractvalue { i32, i8*, i8* } %10, 1
%13 = extractvalue { i32, i8*, i8* } %10, 2
store i32 %11, i32* %7
%14 = ptrtoint i8* %12 to i64
%15 = trunc i64 %14 to i32
store i32 %15, i32* %5
%16 = ptrtoint i8* %13 to i64
%17 = trunc i64 %16 to i32
store i32 %17, i32* %6
%18 = load i32, i32* %7
ret i32 %18
}

LLVM IR (-O2):
define i32 @string_compare(i8* %0, i8* %1) {
%3 = tail call { i32, i8*, i8* } asm sideeffect "cld\0A1: lodsb\0Ascasb\0Ajne 2f\0Atestb %al, %al\0Ajne 1b\0Axorl %eax, %eax\0Ajmp 3f\0A2: sbbl %eax, %eax\0Aorb $$1, %al\0A3:", "={ax},=&{si},=&{di},1,2,~{dirflag},~{fpsr},~{flags}"(i8* %0, i8* %1)
%4 = extractvalue { i32, i8*, i8* } %3, 0
ret i32 %4
}
/* Variables and functions */
size_t getParent(int, int *);
void makeUnion(int u, int v, int *path) {
  path[getParent(u, path)] = getParent(v, path);
}


x86 assembly (clang, -O0):
<makeUnion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <getParent@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <getParent@plt>
mov    -0x1c(%rbp),%edx
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %edx,(%rax,%rcx,4)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeUnion>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %edi,%r14d
mov    %esi,%edi
mov    %rdx,%rsi
call   1030 <getParent@plt>
mov    %rax,%rbp
mov    %r14d,%edi
mov    %rbx,%rsi
call   1030 <getParent@plt>
mov    %ebp,(%rbx,%rax,4)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @makeUnion(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i32, i32* %5
%8 = load i32*, i32** %6
%9 = call i64 @getParent(i32 %7, i32* %8)
%10 = trunc i64 %9 to i32
%11 = load i32*, i32** %6
%12 = load i32, i32* %4
%13 = load i32*, i32** %6
%14 = call i64 @getParent(i32 %12, i32* %13)
%15 = getelementptr inbounds i32, i32* %11, i64 %14
store i32 %10, i32* %15
ret void
}

LLVM IR (-O2):
define void @makeUnion(i32 %0, i32 %1, i32* %2) {
%4 = tail call i64 @getParent(i32 %1, i32* %2)
%5 = trunc i64 %4 to i32
%6 = tail call i64 @getParent(i32 %0, i32* %2)
%7 = getelementptr inbounds i32, i32* %2, i64 %6
store i32 %5, i32* %7
ret void
}
void f107(void) {
  ({
    ({ 0; });
    ({ 0; });
    0;
  });
  ({
    goto a;
    ({ 0; });
  a:
    ({ 0; });
    0;
  });
  0;
}


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

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

LLVM IR (-O0):
define void @f107() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = load i32, i32* %1
store i32 0, i32* %2
%7 = load i32, i32* %2
store i32 0, i32* %3
%8 = load i32, i32* %3
br label %9
9: ; preds = %0
store i32 0, i32* %4
%10 = load i32, i32* %4
store i32 0, i32* %5
%11 = load i32, i32* %5
ret void
}

LLVM IR (-O2):
define void @f107() {
ret void
}
/* Variables and functions */
int strcmp(char const *, char const *);
int strcoll(const char *a, const char *b) { return strcmp(a, b); }


x86 assembly (clang, -O0):
<strcoll>:
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 <strcmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcoll>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @strcoll(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
int test_imm_12int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x12 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_12int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 77309411328
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int count_instances(char *str, char ofwhat) {
  int i, count;
  for (i = 0, count = 0; str[i] != '\0'; i++) {
    if (ofwhat == str[i])
      count += 1;
  }
  return count;
}


x86 assembly (clang, -O0):
<count_instances>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1165 <count_instances+0x65>
movsbl -0x9(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0x10(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    1152 <count_instances+0x52>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1157 <count_instances+0x57>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    111c <count_instances+0x1c>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_instances>:
mov    (%rdi),%cl
test   %cl,%cl
je     1126 <count_instances+0x26>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
xor    %edx,%edx
cmp    %sil,%cl
sete   %dl
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <count_instances+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @count_instances(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %12, %5 ], [ 0, %2 ]
%7 = phi i8 [ %14, %5 ], [ %3, %2 ]
%8 = phi i32 [ %11, %5 ], [ 0, %2 ]
%9 = icmp eq i8 %7, %1
%10 = zext i1 %9 to i32
%11 = add nuw nsw i32 %8, %10
%12 = add nuw nsw i64 %6, 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 %5
16: ; preds = %5, %2
%17 = phi i32 [ 0, %2 ], [ %11, %5 ]
ret i32 %17
}
double berechne_annuitaet(double tilgungsrate, double zinsen) {
  double annuitaet = tilgungsrate + zinsen;
  return annuitaet;
}


x86 assembly (clang, -O0):
<berechne_annuitaet>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<berechne_annuitaet>:
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @berechne_annuitaet(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = load double, double* %4
%8 = fadd double %6, %7
store double %8, double* %5
%9 = load double, double* %5
ret double %9
}

LLVM IR (-O2):
define double @berechne_annuitaet(double %0, double %1) {
%3 = fadd double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void clear_screen() { printf("\e[1;1H\e[2J"); }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"\1B[1;1H\1B[2J\00"
define void @clear_screen() {
%1 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"\1B[1;1H\1B[2J\00"
define void @clear_screen() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
int test_imm_5Dint16_mem(short *val) {
  return ((*val) & (0x5D << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_5Dint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, 93
%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_5Dint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 93
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ text_out(char *);
void style_reverse() { text_out("\x1b[7m"); }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[7m\00"
define void @style_reverse() {
%1 = tail call i32 @text_out(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
void timer_phase(int hz) {
  unsigned int divisor = 1193180 / hz;
  unsigned short command = 0b00110110;
  __asm__ __volatile__("outb %%al,%%dx" ::"d"(0x43), "a"(command));
  ;
  __asm__ __volatile__("outb %%al,%%dx" ::"d"(0x40), "a"(divisor & 0xFF));
  ;
  __asm__ __volatile__("outb %%al,%%dx" ::"d"(0x40), "a"(divisor >> 8));
  ;
}


x86 assembly (clang, -O0):
<timer_phase>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1234dc,%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,-0x8(%rbp)
movw   $0x36,-0xa(%rbp)
mov    -0xa(%rbp),%ax
mov    $0x43,%edx
out    %al,(%dx)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    $0x40,%edx
out    %al,(%dx)
mov    -0x8(%rbp),%eax
shr    $0x8,%eax
mov    $0x40,%edx
out    %al,(%dx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer_phase>:
mov    $0x1234dc,%eax
xor    %edx,%edx
idiv   %edi
mov    %eax,%ecx
mov    $0x43,%edx
mov    $0x36,%ax
out    %al,(%dx)
movzbl %cl,%eax
mov    $0x40,%edx
out    %al,(%dx)
shr    $0x8,%ecx
mov    $0x40,%edx
mov    %ecx,%eax
out    %al,(%dx)
ret

LLVM IR (-O0):
define void @timer_phase(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i16
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = sdiv i32 1193180, %5
store i32 %6, i32* %3
store i16 54, i16* %4
%7 = load i16, i16* %4
%8 = load i32, i32* %3
%9 = and i32 %8, 255
%10 = load i32, i32* %3
%11 = lshr i32 %10, 8
ret void
}

LLVM IR (-O2):
define void @timer_phase(i32 %0) {
%2 = sdiv i32 1193180, %0
tail call void asm sideeffect "outb %al,%dx", "{dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 67, i16 54)
%3 = and i32 %2, 255
tail call void asm sideeffect "outb %al,%dx", "{dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 64, i32 %3)
%4 = lshr i32 %2, 8
tail call void asm sideeffect "outb %al,%dx", "{dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 64, i32 %4)
ret void
}
/* Variables and functions */
int PAPI_read(int, long long *);
void papif_read__(int *EventSet, long long *values, int *check) {
  *check = PAPI_read(*EventSet, values);
}


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

x86 assembly (clang, -O2):
<papif_read__>:
push   %rbx
mov    %rdx,%rbx
mov    (%rdi),%edi
call   1030 <PAPI_read@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @papif_read__(i32* nocapture %0, i64* %1, i32* nocapture writeonly %2) {
%4 = load i32, i32* %0
%5 = tail call i32 @PAPI_read(i32 %4, i64* %1)
store i32 %5, i32* %2
ret void
}
/* Variables and functions */
scalar_t__ isspace(char);
int empty(const char *str) {
  char c;
  while ((c = *str) != '\0' && isspace(c))
    str++;
  return (*str == '\0');
}


x86 assembly (clang, -O0):
<empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xa(%rbp)
je     1149 <empty+0x39>
movsbl -0x9(%rbp),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    1159 <empty+0x49>
jmp    116a <empty+0x5a>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <empty+0xc>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<empty>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
mov    $0x1,%ebp
test   %al,%al
je     1154 <empty+0x44>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %al,%edi
call   1030 <isspace@plt>
test   %rax,%rax
je     114a <empty+0x3a>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <empty+0x20>
jmp    1154 <empty+0x44>
xor    %ebp,%ebp
cmpb   $0x0,-0x1(%rbx)
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @empty(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %1, %13
%5 = phi i8 [ %15, %13 ], [ %2, %1 ]
%6 = phi i8* [ %14, %13 ], [ %0, %1 ]
%7 = tail call i64 @isspace(i8 signext %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %4
%10 = load i8, i8* %6
%11 = icmp eq i8 %10, 0
%12 = zext i1 %11 to i32
br label %17
13: ; preds = %4
%14 = getelementptr inbounds i8, i8* %6, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %4
17: ; preds = %13, %9, %1
%18 = phi i32 [ 1, %1 ], [ %12, %9 ], [ 1, %13 ]
ret i32 %18
}
/* Variables and functions */
scalar_t__ isspace(unsigned char);
char *sld_string_allocate(char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *sld_string_trim_leading(char *string) {
  char *trimmed_string = NULL;
  trimmed_string = sld_string_allocate(string);
  strcpy(trimmed_string, string);
  while (isspace((unsigned char)*trimmed_string))
    trimmed_string++;
  return trimmed_string;
}


x86 assembly (clang, -O0):
<sld_string_trim_leading>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <sld_string_allocate@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1050 <isspace@plt>
cmp    $0x0,%rax
je     1185 <sld_string_trim_leading+0x55>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    115e <sld_string_trim_leading+0x2e>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sld_string_trim_leading>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <sld_string_allocate@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
add    $0xffffffffffffffff,%rbx
xchg   %ax,%ax
movzbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1050 <isspace@plt>
test   %rax,%rax
jne    1150 <sld_string_trim_leading+0x20>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @sld_string_trim_leading(i8* %0) {
%2 = tail call i8* @sld_string_allocate(i8* %0)
%3 = tail call i32 @strcpy(i8* %2, i8* %0)
br label %4
4: ; preds = %4, %1
%5 = phi i8* [ %2, %1 ], [ %9, %4 ]
%6 = load i8, i8* %5
%7 = tail call i64 @isspace(i8 zeroext %6)
%8 = icmp eq i64 %7, 0
%9 = getelementptr inbounds i8, i8* %5, i64 1
br i1 %8, label %10, label %4
10: ; preds = %4
ret i8* %5
}
int dm_bcd_to_int(int b) { return (b & 15) + ((b & 240) >> 4) * 10; }


x86 assembly (clang, -O0):
<dm_bcd_to_int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
mov    -0x4(%rbp),%ecx
and    $0xf0,%ecx
sar    $0x4,%ecx
imul   $0xa,%ecx,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dm_bcd_to_int>:
mov    %edi,%eax
and    $0xf,%eax
shr    $0x4,%edi
and    $0xf,%edi
lea    (%rdi,%rdi,4),%ecx
lea    (%rax,%rcx,2),%eax
ret

LLVM IR (-O0):
define i32 @dm_bcd_to_int(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 15
%5 = load i32, i32* %2
%6 = and i32 %5, 240
%7 = ashr i32 %6, 4
%8 = mul nsw i32 %7, 10
%9 = add nsw i32 %4, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @dm_bcd_to_int(i32 %0) {
%2 = and i32 %0, 15
%3 = lshr i32 %0, 4
%4 = and i32 %3, 15
%5 = mul nuw nsw i32 %4, 10
%6 = add nuw nsw i32 %5, %2
ret i32 %6
}
int g(long long x) { return (x == 0); }


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<g>:
xor    %eax,%eax
test   %rdi,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @g(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @g(i64 %0) {
%2 = icmp eq i64 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t mvhd_to_be16(uint16_t val) {
  uint16_t ret = 0;
  uint8_t *tmp = (uint8_t *)&ret;
  tmp[0] = (val & 0xff00) >> 8;
  tmp[1] = (val & 0x00ff) >> 0;
  return ret;
}


x86 assembly (clang, -O0):
<mvhd_to_be16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
sar    $0x0,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mvhd_to_be16>:
mov    %edi,%eax
movzbl %ah,%eax
ret

LLVM IR (-O0):
define i32 @mvhd_to_be16(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %2
store i32 0, i32* %3
store i32* %3, i32** %4
%5 = load i32, i32* %2
%6 = and i32 %5, 65280
%7 = ashr i32 %6, 8
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 0
store i32 %7, i32* %9
%10 = load i32, i32* %2
%11 = and i32 %10, 255
%12 = ashr i32 %11, 0
%13 = load i32*, i32** %4
%14 = getelementptr inbounds i32, i32* %13, i64 1
store i32 %12, i32* %14
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @mvhd_to_be16(i32 %0) {
%2 = lshr i32 %0, 8
%3 = and i32 %2, 255
ret i32 %3
}
/* Variables and functions */
char *ft_strcpy(int /*<<< orphan*/, char const *);
int /*<<< orphan*/ ft_strlen(char const *);
int /*<<< orphan*/ ft_strnew(int /*<<< orphan*/);
char *ft_strdup(const char *s1) {
  return (ft_strcpy(ft_strnew(ft_strlen(s1)), s1));
}


x86 assembly (clang, -O0):
<ft_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <ft_strlen@plt>
mov    %eax,%edi
call   1050 <ft_strnew@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%rsi
call   1030 <ft_strcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strdup>:
push   %rbx
mov    %rdi,%rbx
call   1040 <ft_strlen@plt>
mov    %eax,%edi
call   1050 <ft_strnew@plt>
mov    %eax,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <ft_strcpy@plt>

LLVM IR (-O0):
define i8* @ft_strdup(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @ft_strlen(i8* %3)
%5 = call i32 @ft_strnew(i32 %4)
%6 = load i8*, i8** %2
%7 = call i8* @ft_strcpy(i32 %5, i8* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @ft_strdup(i8* %0) {
%2 = tail call i32 @ft_strlen(i8* %0)
%3 = tail call i32 @ft_strnew(i32 %2)
%4 = tail call i8* @ft_strcpy(i32 %3, i8* %0)
ret i8* %4
}