xunge/DecIR huggingface dataset:
double foo(double x, double y) { return ((x + 0.1234 * y) * (x - 0.1234 * y)); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  0xee8(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
movsd  0xec6(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
unpcklpd %xmm1,%xmm1
mulpd  0xef4(%rip),%xmm1
unpcklpd %xmm0,%xmm0
addpd  %xmm1,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @foo(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = call double @llvm.fmuladd.f64(double 1.234000e-01, double %6, double %5)
%8 = load double, double* %3
%9 = load double, double* %4
%10 = call double @llvm.fmuladd.f64(double -1.234000e-01, double %9, double %8)
%11 = fmul double %7, %10
ret double %11
}

LLVM IR (-O2):
define double @foo(double %0, double %1) {
%3 = insertelement <2 x double> poison, double %1, i64 0
%4 = shufflevector <2 x double> %3, <2 x double> poison, <2 x i32> zeroinitializer
%5 = insertelement <2 x double> poison, double %0, i64 0
%6 = shufflevector <2 x double> %5, <2 x double> poison, <2 x i32> zeroinitializer
%7 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %4, <2 x double> <double 1.234000e-01, double -1.234000e-01>, <2 x double> %6)
%8 = shufflevector <2 x double> %7, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%9 = fmul <2 x double> %7, %8
%10 = extractelement <2 x double> %9, i64 0
ret double %10
}
int test_imm_A2uint16_mem(unsigned short *val) {
  return ((*val) & (0xA2 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_A2uint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, 162
%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_A2uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 162
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
char *base_name(path)
char *path;
{
  char *cp;
  if ((cp = strrchr(path, '/')) != 0)
    path = cp + 1;
  return (path);
}


x86 assembly (clang, -O0):
<base_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1144 <base_name+0x34>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<base_name>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @base_name(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i32 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
long nelin0(int a) { return -(a != 0); }


x86 assembly (clang, -O0):
<nelin0>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%ecx
xor    %eax,%eax
sub    %ecx,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<nelin0>:
neg    %edi
sbb    %rax,%rax
ret

LLVM IR (-O0):
define i64 @nelin0(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i32
%6 = sub nsw i32 0, %5
%7 = sext i32 %6 to i64
ret i64 %7
}

LLVM IR (-O2):
define i64 @nelin0(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = sext i1 %2 to i64
ret i64 %3
}
/* Variables and functions */
double dist01();
double dist(double min, double max) { return dist01() * (max - min) + min; }


x86 assembly (clang, -O0):
<dist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    $0x0,%al
call   1030 <dist01@plt>
movsd  -0x10(%rbp),%xmm2
subsd  -0x8(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dist>:
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1030 <dist01@plt>
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
subsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @dist(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = call double (...) @dist01()
%6 = load double, double* %4
%7 = load double, double* %3
%8 = fsub double %6, %7
%9 = load double, double* %3
%10 = call double @llvm.fmuladd.f64(double %5, double %8, double %9)
ret double %10
}

LLVM IR (-O2):
define double @dist(double %0, double %1) {
%3 = tail call double (...) @dist01()
%4 = fsub double %1, %0
%5 = tail call double @llvm.fmuladd.f64(double %3, double %4, double %0)
ret double %5
}
void wdog2_iomux_config() {}


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

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

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

LLVM IR (-O2):
define void @wdog2_iomux_config() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
void put_name(FILE *file, char *name, int quote) {
  if (quote) {
    fputc('\"', file);
    fputs(name, file);
    fputc('\"', file);
  } else
    fputs(name, file);
}


x86 assembly (clang, -O0):
<put_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     116b <put_name+0x4b>
mov    -0x8(%rbp),%rsi
mov    $0x22,%edi
call   1040 <fputc@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <fputs@plt>
mov    -0x8(%rbp),%rsi
mov    $0x22,%edi
call   1040 <fputc@plt>
jmp    1178 <put_name+0x58>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <fputs@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_name>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
test   %edx,%edx
je     115a <put_name+0x3a>
mov    $0x22,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <fputs@plt>
mov    $0x22,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fputc@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fputs@plt>

LLVM IR (-O0):
define void @put_name(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %3
%10 = load i32*, i32** %4
%11 = call i32 @fputc(i8 signext 34, i32* %10)
%12 = load i8*, i8** %5
%13 = load i32*, i32** %4
%14 = call i32 @fputs(i8* %12, i32* %13)
%15 = load i32*, i32** %4
%16 = call i32 @fputc(i8 signext 34, i32* %15)
br label %21
17: ; preds = %3
%18 = load i8*, i8** %5
%19 = load i32*, i32** %4
%20 = call i32 @fputs(i8* %18, i32* %19)
br label %21
21: ; preds = %17, %9
ret void
}

LLVM IR (-O2):
define void @put_name(i32* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = tail call i32 @fputc(i8 signext 34, i32* %0)
%7 = tail call i32 @fputs(i8* %1, i32* %0)
%8 = tail call i32 @fputc(i8 signext 34, i32* %0)
br label %11
9: ; preds = %3
%10 = tail call i32 @fputs(i8* %1, i32* %0)
br label %11
11: ; preds = %9, %5
ret void
}
void avcodec_register() {}


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

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

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

LLVM IR (-O2):
define void @avcodec_register() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ TOSH_SET_GIO2_PIN();
void HUMIDITY_SET_CLOCK() { TOSH_SET_GIO2_PIN(); }


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

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

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

LLVM IR (-O2):
define void @HUMIDITY_SET_CLOCK() {
%1 = tail call i32 (...) @TOSH_SET_GIO2_PIN()
ret void
}
int lower_number(int number1, int number2) {
  if (number1 < number2) {
    return number1;
  } else {
    return number2;
  }
}


x86 assembly (clang, -O0):
<lower_number>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1121 <lower_number+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <lower_number+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lower_number>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @lower_number(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int mode;
};
typedef TYPE_1__ XFocusOutEvent;

/* Variables and functions */
void set_XFocusOutEvent_mode(void *_p, int _v) {
  ((XFocusOutEvent *)_p)->mode = (int)_v;
}


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

x86 assembly (clang, -O2):
<set_XFocusOutEvent_mode>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XFocusOutEvent_mode(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
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XFocusOutEvent_mode(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int max(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char *argv[]) {
  int a, i;
  scanf("%d", &a);
  for (; i = max(a);)
    a = i;
  printf("%d", a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x14(%rbp),%edi
call   1040 <max@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
je     1175 <main+0x45>
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1156 <main+0x26>
mov    -0x14(%rbp),%esi
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
cs nopw 0x0(%rax,%rax,1)
call   1040 <max@plt>
test   %eax,%eax
je     1161 <main+0x31>
mov    %eax,0x4(%rsp)
mov    %eax,%edi
jmp    1150 <main+0x20>
mov    0x4(%rsp),%esi
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
br label %9
9: ; preds = %13, %2
%10 = load i32, i32* %6
%11 = call i32 @max(i32 %10)
store i32 %11, i32* %7
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = load i32, i32* %7
store i32 %14, i32* %6
br label %9
15: ; preds = %9
%16 = load i32, i32* %6
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = call i32 @max(i32 %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %2, %9
%10 = phi i32 [ %11, %9 ], [ %7, %2 ]
store i32 %10, i32* %3
%11 = call i32 @max(i32 %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %9
13: ; preds = %9, %2
%14 = load i32, i32* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}
void *char_copy(void *to_copy) {
  char *c = (char *)calloc(1, sizeof(char));
  *c = *(char *)to_copy;
  return c;
}


x86 assembly (clang, -O0):
<char_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%esi
mov    %rsi,%rdi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<char_copy>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    (%rbx),%cl
mov    %cl,(%rax)
pop    %rbx
ret

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

LLVM IR (-O2):
define noalias i8* @char_copy(i8* nocapture %0) {
%2 = tail call dereferenceable_or_null(1) i8* @calloc(i64 1, i64 1)
%3 = load i8, i8* %0
store i8 %3, i8* %2
ret i8* %2
}
/* Variables and functions */
int init();
int main() {
  int res = 2;
  while (res != 0) {
    res = init();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     113f <main+0x2f>
mov    $0x0,%al
call   1030 <init@plt>
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <init@plt>
test   %eax,%eax
jne    1120 <main+0x10>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 (...) @init()
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %1
4: ; preds = %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ lookNarray(char *, unsigned int);
void lookcomplex8array_(void *x, unsigned int *n) {
  lookNarray((char *)x, (*n * 8));
}


x86 assembly (clang, -O0):
<lookcomplex8array_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
shl    $0x3,%esi
call   1030 <lookNarray@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookcomplex8array_>:
mov    (%rsi),%esi
shl    $0x3,%esi
jmp    1030 <lookNarray@plt>

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

LLVM IR (-O2):
define void @lookcomplex8array_(i8* %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = shl i32 %3, 3
%5 = tail call i32 @lookNarray(i8* %0, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ arc_mode_halt();
int /*<<< orphan*/ mei_aux_acc();
void arc_prep(void) {
  mei_aux_acc();
  arc_mode_halt();
}


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

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

LLVM IR (-O0):
define void @arc_prep() {
%1 = call i32 (...) @mei_aux_acc()
%2 = call i32 (...) @arc_mode_halt()
ret void
}

LLVM IR (-O2):
define void @arc_prep() {
%1 = tail call i32 (...) @mei_aux_acc()
%2 = tail call i32 (...) @arc_mode_halt()
ret void
}
float PerceptronPhi(float v) {
  if (v >= 0)
    return 1;
  return -1;
}


x86 assembly (clang, -O0):
<PerceptronPhi>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     112c <PerceptronPhi+0x2c>
movss  0xee2(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1139 <PerceptronPhi+0x39>
movss  0xecc(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<PerceptronPhi>:
xorps  %xmm1,%xmm1
xor    %eax,%eax
ucomiss %xmm1,%xmm0
setb   %al
lea    0xeee(%rip),%rcx
movss  (%rcx,%rax,4),%xmm0
ret

LLVM IR (-O0):
define float @PerceptronPhi(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fcmp oge float %4, 0.000000e+00
br i1 %5, label %6, label %7
6: ; preds = %1
store float 1.000000e+00, float* %2
br label %8
7: ; preds = %1
store float -1.000000e+00, float* %2
br label %8
8: ; preds = %7, %6
%9 = load float, float* %2
ret float %9
}

LLVM IR (-O2):
define float @PerceptronPhi(float %0) {
%2 = fcmp ult float %0, 0.000000e+00
%3 = select i1 %2, float -1.000000e+00, float 1.000000e+00
ret float %3
}
main(argc, argv) int argc;
char *argv[];
{
  int local_j = argc;
  char *s;
  printf("Hello from execd_program...\n");
  if (argc != 2) {
    printf("expected one string argument\n");
    exit(-1);
  }
  s = argv[1];
  printf("argument received: %s\n", s);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x2,-0x4(%rbp)
je     1165 <main+0x45>
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x2,%ebp
jne    1164 <main+0x34>
mov    0x8(%rbx),%rsi
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"Hello from execd_program...\0A\00"
@.str.1 = [30 x i8] c"expected one string argument\0A\00"
@.str.2 = [23 x i8] c"argument received: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = load i32, i32* %3
store i32 %7, i32* %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
unreachable
13: ; preds = %2
%14 = load i8**, i8*** %4
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
store i8* %16, i8** %6
%17 = load i8*, i8** %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %17)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [23 x i8] c"argument received: %s\0A\00"
@str = [28 x i8] c"Hello from execd_program...\00"
@str.3 = [29 x i8] c"expected one string argument\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%4 = icmp eq i32 %0, 2
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.3, i64 0, i64 0))
tail call void @exit(i32 -1)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %9)
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t packColor(uint8_t red, uint8_t green, uint8_t blue) {
  return ((uint32_t)red << 16) | ((uint32_t)green << 8) | blue;
}


x86 assembly (clang, -O0):
<packColor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x10,%eax
mov    -0x8(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
or     -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<packColor>:
mov    %esi,%eax
shl    $0x10,%edi
shl    $0x8,%eax
or     %edi,%eax
or     %edx,%eax
ret

LLVM IR (-O0):
define i32 @packColor(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = shl i32 %7, 16
%9 = load i32, i32* %5
%10 = shl i32 %9, 8
%11 = or i32 %8, %10
%12 = load i32, i32* %6
%13 = or i32 %11, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @packColor(i32 %0, i32 %1, i32 %2) {
%4 = shl i32 %0, 16
%5 = shl i32 %1, 8
%6 = or i32 %5, %4
%7 = or i32 %6, %2
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ foo(void *);
long ilongor(long x, long y) {
  x |= 24;
  if (!x)
    foo((void *)0);
  return x;
}


x86 assembly (clang, -O0):
<ilongor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
or     $0x18,%rax
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1140 <ilongor+0x30>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <foo@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ilongor>:
mov    %rdi,%rax
or     $0x18,%rax
ret

LLVM IR (-O0):
define i64 @ilongor(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = or i64 %5, 24
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = icmp ne i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = call i32 @foo(i8* null)
br label %11
11: ; preds = %9, %2
%12 = load i64, i64* %3
ret i64 %12
}

LLVM IR (-O2):
define i64 @ilongor(i64 %0, i64 %1) {
%3 = or i64 %0, 24
ret i64 %3
}
/* Type definitions */
struct hashmap {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ hashmap_destroy(struct hashmap *);
void teardown_test(struct hashmap *map) { hashmap_destroy(map); }


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

x86 assembly (clang, -O2):
<teardown_test>:
jmp    1030 <hashmap_destroy@plt>

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

LLVM IR (-O2):
%struct.hashmap = type { i32 }
define void @teardown_test(%struct.hashmap* %0) {
%2 = tail call i32 @hashmap_destroy(%struct.hashmap* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int do_xfrm(int arg, char **argv) {
  fprintf(stderr, "This version of built without xfrm support\n");
  exit(1);
}


x86 assembly (clang, -O0):
<do_xfrm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
lea    0xec1(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<do_xfrm>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [44 x i8] c"This version of built without xfrm support\0A\00"
define i32 @do_xfrm(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [44 x i8] c"This version of built without xfrm support\0A\00"
define i32 @do_xfrm(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
}
long long uszz() { return 0x7fffffff00000000LL; }


x86 assembly (clang, -O0):
<uszz>:
push   %rbp
mov    %rsp,%rbp
movabs $0x7fffffff00000000,%rax
ff ff 7f
pop    %rbp
ret

x86 assembly (clang, -O2):
<uszz>:
movabs $0x7fffffff00000000,%rax
ff ff 7f
ret

LLVM IR (-O0):
define i64 @uszz() {
ret i64 9223372032559808512
}

LLVM IR (-O2):
define i64 @uszz() {
ret i64 9223372032559808512
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ LogVfprintf(int /*<<< orphan*/ *, char *,
                               int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void LogError(FILE *prFP, char *pcFmt, va_list rVArgList) {
  fprintf(prFP, "ERROR: ");
  LogVfprintf(prFP, pcFmt, rVArgList);
}


x86 assembly (clang, -O0):
<LogError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <LogVfprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LogError>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0xecc(%rip),%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   1040 <fwrite@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <LogVfprintf@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"ERROR: \00"
define void @LogError(i32* %0, i8* %1, i32 %2) {
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 7, i64 1, i32* %0)
%5 = tail call i32 @LogVfprintf(i32* %0, i8* %1, i32 %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ vsprintf(char *, char const *, int /*<<< orphan*/);
void uninitvar_vsprintf(void) {
  char *s;
  const char *format;
  va_list arg;
  (void)vsprintf(s, format, arg);
}


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

x86 assembly (clang, -O2):
<uninitvar_vsprintf>:
jmp    1030 <vsprintf@plt>

LLVM IR (-O0):
define void @uninitvar_vsprintf() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i32
%4 = load i8*, i8** %1
%5 = load i8*, i8** %2
%6 = load i32, i32* %3
%7 = call i32 @vsprintf(i8* %4, i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @uninitvar_vsprintf() {
%1 = tail call i32 @vsprintf(i8* undef, i8* undef, i32 undef)
ret void
}
char *save_string(s, len)
char *s;
int len;
{
  register char *result = (char *)xmalloc(len + 1);
  bcopy(s, result, len);
  result[len] = 0;
  return result;
}


x86 assembly (clang, -O0):
<save_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
mov    $0x0,%al
call   1030 <xmalloc@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    $0x0,%al
call   1040 <bcopy@plt>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<save_string>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%r15d
mov    %rdi,%r14
lea    0x1(%r15),%edi
xor    %eax,%eax
call   1030 <xmalloc@plt>
movslq %eax,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
xor    %eax,%eax
call   1040 <bcopy@plt>
movslq %r15d,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @save_string(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = add nsw i32 %6, 1
%8 = call i32 (i32, ...) bitcast (i32 (...)* @xmalloc to i32 (i32, ...)*)(i32 %7)
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %5
%11 = load i8*, i8** %3
%12 = load i8*, i8** %5
%13 = load i32, i32* %4
%14 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @bcopy to i32 (i8*, i8*, i32, ...)*)(i8* %11, i8* %12, i32 %13)
%15 = load i8*, i8** %5
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
store i8 0, i8* %18
%19 = load i8*, i8** %5
ret i8* %19
}

LLVM IR (-O2):
define i8* @save_string(i8* %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @xmalloc to i32 (i32, ...)*)(i32 %3)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
%7 = tail call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @bcopy to i32 (i8*, i8*, i32, ...)*)(i8* %0, i8* %6, i32 %1)
%8 = sext i32 %1 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
store i8 0, i8* %9
ret i8* %6
}
int test_imm_C3int64_lowword_mem(long long *val) {
  return ((*val) & (0xC3 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_C3int64_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, 195
%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_C3int64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 195
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ ENOTTY;
int /*<<< orphan*/ errno;
pid_t tcgetpgrp(int fd) {
  errno = ENOTTY;
  return -1;
}


x86 assembly (clang, -O0):
<tcgetpgrp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0x2eda(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec1(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@ENOTTY = global i32 0
@errno = global i32 0
define i32 @tcgetpgrp(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @ENOTTY
store i32 %3, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOTTY = global i32 0
@errno = global i32 0
define i32 @tcgetpgrp(i32 %0) {
%2 = load i32, i32* @ENOTTY
store i32 %2, i32* @errno
ret i32 -1
}
/* Variables and functions */
int strlen(char *);
int strip_nl(char *s) {
  int len = strlen(s) - 1;
  if (len >= 0 && s[len] == '\n') {
    s[len] = '\0';
    return (1);
  } else
    return (0);
}


x86 assembly (clang, -O0):
<strip_nl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1162 <strip_nl+0x52>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    1162 <strip_nl+0x52>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x1,-0x4(%rbp)
jmp    1169 <strip_nl+0x59>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strip_nl>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
jle    1133 <strip_nl+0x23>
add    $0xffffffff,%ecx
cmpb   $0xa,(%rbx,%rcx,1)
jne    1133 <strip_nl+0x23>
movb   $0x0,(%rbx,%rcx,1)
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @strip_nl(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %11
4: ; preds = %1
%5 = add nsw i32 %2, -1
%6 = zext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 10
br i1 %9, label %10, label %11
10: ; preds = %4
store i8 0, i8* %7
br label %11
11: ; preds = %1, %4, %10
%12 = phi i32 [ 1, %10 ], [ 0, %4 ], [ 0, %1 ]
ret i32 %12
}
void(__attribute__((regparm(2), stdcall)) foo)(int a) {}


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

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

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

LLVM IR (-O2):
define void @foo(i32 %0) {
ret void
}
void glx_highpc(void) {}


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

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

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

LLVM IR (-O2):
define void @glx_highpc() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cli();
int /*<<< orphan*/ console_printf(char *, char const *, unsigned long,
                                  char const *);
int /*<<< orphan*/ hlt();
void __assert_failed(const char *cond, const char *file, unsigned long line) {
  cli();
  console_printf("%s:%x: assertion (%s) failed\n", file, line, cond);
  hlt();
}


x86 assembly (clang, -O0):
<__assert_failed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1050 <cli@plt>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xea2(%rip),%rdi
call   1040 <console_printf@plt>
mov    $0x0,%al
call   1030 <hlt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__assert_failed>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
xor    %eax,%eax
call   1050 <cli@plt>
lea    0xeb4(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
call   1040 <console_printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <hlt@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"%s:%x: assertion (%s) failed\0A\00"
define void @__assert_failed(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 = call i32 (...) @cli()
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = load i8*, i8** %4
%11 = call i32 @console_printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %8, i64 %9, i8* %10)
%12 = call i32 (...) @hlt()
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"%s:%x: assertion (%s) failed\0A\00"
define void @__assert_failed(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 (...) @cli()
%5 = tail call i32 @console_printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %1, i64 %2, i8* %0)
%6 = tail call i32 (...) @hlt()
ret void
}
int f(int *r) {
  r[0] = 0;
  r[1] = 1;
  return r[0];
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rax
movl   $0x1,0x4(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movabs $0x100000000,%rax
mov    %rax,(%rdi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @f(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
store i32 0, i32* %4
%5 = load i32*, i32** %2
%6 = getelementptr inbounds i32, i32* %5, i64 1
store i32 1, i32* %6
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 0
%9 = load i32, i32* %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @f(i32* nocapture writeonly %0) {
store i32 0, i32* %0
%2 = getelementptr inbounds i32, i32* %0, i64 1
store i32 1, i32* %2
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ testFile(int, char **);
int main(int argc, char **args, char **env) {
  testFile(argc, args);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <testFile@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1, i8** nocapture readnone %2) {
%4 = tail call i32 @testFile(i32 %0, i8** %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fadeScreen2(int, int, int, int /*<<< orphan*/, int);
void unfadeScreen() { fadeScreen2(0xFFFFFFFF, 0x0, 0x10, 0, 0x0000); }


x86 assembly (clang, -O0):
<unfadeScreen>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffff,%edi
xor    %r8d,%r8d
mov    $0x10,%edx
mov    %r8d,%esi
mov    %r8d,%ecx
call   1030 <fadeScreen2@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<unfadeScreen>:
mov    $0xffffffff,%edi
xor    %esi,%esi
mov    $0x10,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
jmp    1030 <fadeScreen2@plt>

LLVM IR (-O0):
define void @unfadeScreen() {
%1 = call i32 @fadeScreen2(i32 -1, i32 0, i32 16, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @unfadeScreen() {
%1 = tail call i32 @fadeScreen2(i32 -1, i32 0, i32 16, i32 0, i32 0)
ret void
}
void mdp4_dsi_overlay_blt(struct msm_fb_data_type *mfd,
                          struct msmfb_overlay_blt *req) {}


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

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

LLVM IR (-O0):
%struct.msm_fb_data_type = type opaque
%struct.msmfb_overlay_blt = type opaque
define void @mdp4_dsi_overlay_blt(%struct.msm_fb_data_type* %0, %struct.msmfb_overlay_blt* %1) {
%3 = alloca %struct.msm_fb_data_type*
%4 = alloca %struct.msmfb_overlay_blt*
store %struct.msm_fb_data_type* %0, %struct.msm_fb_data_type** %3
store %struct.msmfb_overlay_blt* %1, %struct.msmfb_overlay_blt** %4
ret void
}

LLVM IR (-O2):
%struct.msm_fb_data_type = type opaque
%struct.msmfb_overlay_blt = type opaque
define void @mdp4_dsi_overlay_blt(%struct.msm_fb_data_type* nocapture %0, %struct.msmfb_overlay_blt* nocapture %1) {
ret void
}
void str_trim_ht(char *str) {
  char *p = str;
  while (*p != '\0') {
    if (*p == '\t')
      *p = '\x20';
    ++p;
  }
}


x86 assembly (clang, -O0):
<str_trim_ht>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1148 <str_trim_ht+0x48>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
jne    1137 <str_trim_ht+0x37>
mov    -0x10(%rbp),%rax
movb   $0x20,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <str_trim_ht+0x10>
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_trim_ht>:
jmp    1117 <str_trim_ht+0x17>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0x20,(%rdi)
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0x9,%al
je     1110 <str_trim_ht+0x10>
test   %al,%al
jne    1113 <str_trim_ht+0x13>
ret

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

LLVM IR (-O2):
define void @str_trim_ht(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
switch i8 %4, label %6 [
i8 0, label %8
i8 9, label %5
]
5: ; preds = %2
store i8 32, i8* %3
br label %6
6: ; preds = %2, %5
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
8: ; preds = %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int __sched_getscheduler(pid_t pid) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<__sched_getscheduler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__sched_getscheduler>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @__sched_getscheduler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @ENOSYS
%4 = call i32 @__set_errno(i32 %3)
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @__sched_getscheduler(i32 %0) {
%2 = load i32, i32* @ENOSYS
%3 = tail call i32 @__set_errno(i32 %2)
ret i32 -1
}
/* Variables and functions */
double sqrt(double);
double sqrt_wrapper(double *arg_list) { return (sqrt(arg_list[0])); }


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

x86 assembly (clang, -O2):
<sqrt_wrapper>:
movsd  (%rdi),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1123 <sqrt_wrapper+0x13>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @sqrt_wrapper(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 0
%5 = load double, double* %4
%6 = call double @sqrt(double %5)
ret double %6
}

LLVM IR (-O2):
define double @sqrt_wrapper(double* nocapture %0) {
%2 = load double, double* %0
%3 = tail call double @sqrt(double %2)
ret double %3
}