xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int EPERM;
int /*<<< orphan*/ assert(int);
int pthread_mutex_unlock(int /*<<< orphan*/ *);
int d_pthread_mutex_unlock(pthread_mutex_t *mutex) {
  int err = pthread_mutex_unlock(mutex);
  assert(err != EPERM);
  assert(err == 0);
  return 0;
}


x86 assembly (clang, -O0):
<d_pthread_mutex_unlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <pthread_mutex_unlock@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e96(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x0,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_pthread_mutex_unlock>:
push   %rbx
call   1040 <pthread_mutex_unlock@plt>
mov    %eax,%ebx
mov    0x2ea9(%rip),%rax
xor    %edi,%edi
cmp    (%rax),%ebx
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %ebx,%ebx
sete   %dil
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@EPERM = global i32 0
define i32 @d_pthread_mutex_unlock(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @pthread_mutex_unlock(i32* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = load i32, i32* @EPERM
%8 = icmp ne i32 %6, %7
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
ret i32 0
}

LLVM IR (-O2):
@EPERM = global i32 0
define i32 @d_pthread_mutex_unlock(i32* %0) {
%2 = tail call i32 @pthread_mutex_unlock(i32* %0)
%3 = load i32, i32* @EPERM
%4 = icmp ne i32 %2, %3
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = icmp eq i32 %2, 0
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
ret i32 0
}
int id(int x) {
  if (x == 0)
    return 0;
  int ret = id(x - 1) + 1;
  if (ret > 3)
    return 3;
  return ret;
}


x86 assembly (clang, -O0):
<id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1131 <id+0x21>
movl   $0x0,-0x4(%rbp)
jmp    115e <id+0x4e>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <id@plt>
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jle    1158 <id+0x48>
movl   $0x3,-0x4(%rbp)
jmp    115e <id+0x4e>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<id>:
test   %edi,%edi
je     1130 <id+0x20>
push   %rax
add    $0xffffffff,%edi
call   1030 <id@plt>
lea    0x1(%rax),%ecx
cmp    $0x3,%eax
mov    $0x3,%eax
cmovl  %ecx,%eax
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @id(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %18
8: ; preds = %1
%9 = load i32, i32* %3
%10 = sub nsw i32 %9, 1
%11 = call i32 @id(i32 %10)
%12 = add nsw i32 %11, 1
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = icmp sgt i32 %13, 3
br i1 %14, label %15, label %16
15: ; preds = %8
store i32 3, i32* %2
br label %18
16: ; preds = %8
%17 = load i32, i32* %4
store i32 %17, i32* %2
br label %18
18: ; preds = %16, %15, %7
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @id(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1, %5
%4 = phi i32 [ %10, %5 ], [ 0, %1 ]
ret i32 %4
5: ; preds = %1
%6 = add nsw i32 %0, -1
%7 = tail call i32 @id(i32 %6)
%8 = add nsw i32 %7, 1
%9 = icmp slt i32 %7, 3
%10 = select i1 %9, i32 %8, i32 3
br label %3
}
int add(int input1, int input2) { return input1 + input2; }


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

x86 assembly (clang, -O2):
<add>:
lea    (%rdi,%rsi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @add(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ PIN_IRQ_Handler(int);
void PIN_INT4_IRQHandler(void) { PIN_IRQ_Handler(4); }


x86 assembly (clang, -O0):
<PIN_INT4_IRQHandler>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
call   1030 <PIN_IRQ_Handler@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @PIN_INT4_IRQHandler() {
%1 = call i32 @PIN_IRQ_Handler(i32 4)
ret void
}

LLVM IR (-O2):
define void @PIN_INT4_IRQHandler() {
%1 = tail call i32 @PIN_IRQ_Handler(i32 4)
ret void
}
int main() {
  extern void crash(void);
  crash();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
tail call void @crash()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
bool cc3_gpio_get_value(uint8_t pin) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @cc3_gpio_get_value(i32 %0) {
ret i32 0
}
int sum(int n) { return (n + 1) * n >> 1; }


x86 assembly (clang, -O0):
<sum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
imul   -0x4(%rbp),%eax
sar    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum>:
lea    0x1(%rdi),%eax
imul   %edi,%eax
sar    %eax
ret

LLVM IR (-O0):
define i32 @sum(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
%5 = load i32, i32* %2
%6 = mul nsw i32 %4, %5
%7 = ashr i32 %6, 1
ret i32 %7
}

LLVM IR (-O2):
define i32 @sum(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = mul nsw i32 %2, %0
%4 = ashr i32 %3, 1
ret i32 %4
}
rnd(num) { return (random() % num); }


x86 assembly (clang, -O0):
<rnd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <random@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rnd>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <random@plt>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @rnd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @random()
%4 = load i32, i32* %2
%5 = srem i32 %3, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @rnd(i32 %0) {
%2 = tail call i32 (...) @random()
%3 = srem i32 %2, %0
ret i32 %3
}
void efx_fini_mcdi_logging(struct efx_nic *efx) {}


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

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

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

LLVM IR (-O2):
%struct.efx_nic = type opaque
define void @efx_fini_mcdi_logging(%struct.efx_nic* nocapture %0) {
ret void
}
int is_dot_or_dotdot(const char *name) {
  return (name[0] == '.' && !name[1]) ||
         (name[0] == '.' && name[1] == '.' && !name[2]);
}


x86 assembly (clang, -O0):
<is_dot_or_dotdot>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    112b <is_dot_or_dotdot+0x2b>
mov    -0x8(%rbp),%rcx
mov    $0x1,%al
cmpb   $0x0,0x1(%rcx)
mov    %al,-0x9(%rbp)
je     116c <is_dot_or_dotdot+0x6c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x2e,%ecx
mov    %al,-0xa(%rbp)
jne    1166 <is_dot_or_dotdot+0x66>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%ecx
xor    %eax,%eax
cmp    $0x2e,%ecx
mov    %al,-0xa(%rbp)
jne    1166 <is_dot_or_dotdot+0x66>
mov    -0x8(%rbp),%rax
cmpb   $0x0,0x2(%rax)
setne  %al
xor    $0xff,%al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_dot_or_dotdot>:
xor    %eax,%eax
cmpb   $0x2e,(%rdi)
jne    111c <is_dot_or_dotdot+0x1c>
mov    0x1(%rdi),%cl
test   %cl,%cl
je     111d <is_dot_or_dotdot+0x1d>
cmp    $0x2e,%cl
jne    111c <is_dot_or_dotdot+0x1c>
xor    %eax,%eax
cmpb   $0x0,0x2(%rdi)
sete   %al
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @is_dot_or_dotdot(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 46
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
switch i8 %6, label %12 [
i8 0, label %13
i8 46, label %7
]
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %0, i64 2
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
%11 = zext i1 %10 to i32
br label %13
12: ; preds = %4
br label %13
13: ; preds = %4, %12, %1, %7
%14 = phi i32 [ 1, %4 ], [ %11, %7 ], [ 0, %1 ], [ 0, %12 ]
ret i32 %14
}
void hwInitPeripherals(void) {}


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

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

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

LLVM IR (-O2):
define void @hwInitPeripherals() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ wmlOutputWmlUilMm();
void wmlOutputMmFiles() { wmlOutputWmlUilMm(); }


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

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

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

LLVM IR (-O2):
define void @wmlOutputMmFiles() {
%1 = tail call i32 (...) @wmlOutputWmlUilMm()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void imprimeVetor(int vetor[], int tamanho) {
  int i;
  for (i = 0; i < tamanho; i++) {
    printf("%d\n", vetor[i]);
  }
}


x86 assembly (clang, -O0):
<imprimeVetor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1157 <imprimeVetor+0x47>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <imprimeVetor+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imprimeVetor>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1145 <imprimeVetor+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <imprimeVetor+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @imprimeVetor(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
double kelvin_to_celsius(double k) { return k - 273.5; }


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

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

LLVM IR (-O0):
define double @kelvin_to_celsius(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fsub double %3, 2.735000e+02
ret double %4
}

LLVM IR (-O2):
define double @kelvin_to_celsius(double %0) {
%2 = fadd double %0, -2.735000e+02
ret double %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ STDOUT_FILENO;
char *malloc(int /*<<< orphan*/);
int /*<<< orphan*/ read_size();
int /*<<< orphan*/ write(int /*<<< orphan*/, char **, int);
void do_allocate() {
  uint32_t size = read_size();
  char *buf = malloc(size);
  write(STDOUT_FILENO, &buf, sizeof(buf));
}


x86 assembly (clang, -O0):
<do_allocate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <read_size@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1040 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_allocate>:
push   %rax
xor    %eax,%eax
call   1030 <read_size@plt>
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,(%rsp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
mov    $0x8,%edx
call   1040 <write@plt>
pop    %rax
ret

LLVM IR (-O0):
@STDOUT_FILENO = global i32 0
define void @do_allocate() {
%1 = alloca i32
%2 = alloca i8*
%3 = call i32 (...) @read_size()
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %2
%6 = load i32, i32* @STDOUT_FILENO
%7 = call i32 @write(i32 %6, i8** %2, i32 8)
ret void
}

LLVM IR (-O2):
@STDOUT_FILENO = global i32 0
define void @do_allocate() {
%1 = alloca i8*
%2 = tail call i32 (...) @read_size()
%3 = bitcast i8** %1 to i8*
%4 = tail call i8* @malloc(i32 %2)
store i8* %4, i8** %1
%5 = load i32, i32* @STDOUT_FILENO
%6 = call i32 @write(i32 %5, i8** %1, i32 8)
ret void
}
void test2() {
  const char *str =
      "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
      "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
      "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
      "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
      "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
      "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
      "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
      "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
      "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
      "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
      "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
      "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
      "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds";
}


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

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

LLVM IR (-O0):
@.str = [846 x i8] c"sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfdssdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfdssdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfdssdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfdssdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfdssdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfdssdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfdssdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfdssdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfdssdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfdssdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfdssdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfdssdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds\00"
define void @test2() {
%1 = alloca i8*
store i8* getelementptr inbounds ([846 x i8], [846 x i8]* @.str, i64 0, i64 0), i8** %1
ret void
}

LLVM IR (-O2):
define void @test2() {
ret void
}
int test_imm_E1int16_mem(short *val) {
  return ((*val) & (-0xE1 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_E1int16_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, -225
%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_E1int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -225
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef char *uint32_t;

/* Variables and functions */
uint32_t CPU_read_MSR(uint32_t msr) {
  uint32_t eax, edx;
  asm("rdmsr" : "=a"(eax), "=d"(edx) : "c"(msr));
  return eax;
}


x86 assembly (clang, -O0):
<CPU_read_MSR>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
rdmsr
mov    %rax,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CPU_read_MSR>:
mov    %rdi,%rcx
rdmsr
ret

LLVM IR (-O0):
define i8* @CPU_read_MSR(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call { i8*, i8* } asm "rdmsr", "={ax},={dx},{cx},~{dirflag},~{fpsr},~{flags}"(i8* %5)
%7 = extractvalue { i8*, i8* } %6, 0
%8 = extractvalue { i8*, i8* } %6, 1
store i8* %7, i8** %3
store i8* %8, i8** %4
%9 = load i8*, i8** %3
ret i8* %9
}

LLVM IR (-O2):
define i8* @CPU_read_MSR(i8* %0) {
%2 = tail call { i8*, i8* } asm "rdmsr", "={ax},={dx},{cx},~{dirflag},~{fpsr},~{flags}"(i8* %0)
%3 = extractvalue { i8*, i8* } %2, 0
ret i8* %3
}
int cast_ulong_int_fast(unsigned long int x) { return (int)x; }


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

x86 assembly (clang, -O2):
<cast_ulong_int_fast>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
define i32 @cast_ulong_int_fast(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @cast_ulong_int_fast(i64 %0) {
%2 = trunc i64 %0 to i32
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ sem_t;

/* Variables and functions */
int sem_getvalue(sem_t *sem, int *sval) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @sem_getvalue(i32* nocapture readnone %0, i32* nocapture readnone %1) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int c;
  for (c = 0; c <= 255; c++) {
    printf(" %d - %c\n", c, c);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xff,-0x8(%rbp)
jg     1153 <main+0x43>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xee3(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x100,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c" %d - %c\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 256
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
void DESTROY() {}


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

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

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

LLVM IR (-O2):
define void @DESTROY() {
ret void
}
void toUpperCase(char *value) {
  while (*value != '\0') {
    if (*value >= 'a' && *value <= 'z')
      *value -= 32;
    value++;
  }
}


x86 assembly (clang, -O0):
<toUpperCase>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1155 <toUpperCase+0x55>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jl     1144 <toUpperCase+0x44>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7a,%eax
jg     1144 <toUpperCase+0x44>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
sub    $0x20,%ecx
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <toUpperCase+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<toUpperCase>:
mov    (%rdi),%al
test   %al,%al
je     112a <toUpperCase+0x2a>
add    $0x1,%rdi
jmp    111b <toUpperCase+0x1b>
nopl   0x0(%rax)
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
je     112a <toUpperCase+0x2a>
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     1110 <toUpperCase+0x10>
add    $0xe0,%al
mov    %al,-0x1(%rdi)
jmp    1110 <toUpperCase+0x10>
ret

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

LLVM IR (-O2):
define void @toUpperCase(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %11
%5 = phi i8 [ %13, %11 ], [ %2, %1 ]
%6 = phi i8* [ %12, %11 ], [ %0, %1 ]
%7 = add i8 %5, -97
%8 = icmp ult i8 %7, 26
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = add nsw i8 %5, -32
store i8 %10, i8* %6
br label %11
11: ; preds = %9, %4
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %11, %1
ret void
}
int jose(int x) { return x * 1423; }


x86 assembly (clang, -O0):
<jose>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
imul   $0x58f,-0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<jose>:
imul   $0x58f,%edi,%eax
ret

LLVM IR (-O0):
define i32 @jose(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 1423
ret i32 %4
}

LLVM IR (-O2):
define i32 @jose(i32 %0) {
%2 = mul nsw i32 %0, 1423
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ stderr;
int _id_error(char const *message, int ret) {
  fputs("id"
        ": ",
        stderr);
  perror(message);
  return ret;
}


x86 assembly (clang, -O0):
<_id_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%esi
lea    0xec1(%rip),%rdi
call   1030 <fputs@plt>
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_id_error>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
lea    0xec8(%rip),%rdi
call   1030 <fputs@plt>
mov    %rbx,%rdi
call   1040 <perror@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"id: \00"
@stderr = global i32 0
define i32 @_id_error(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i8*, i8** %3
%8 = call i32 @perror(i8* %7)
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
@.str = [5 x i8] c"id: \00"
@stderr = global i32 0
define i32 @_id_error(i8* nocapture %0, i32 returned %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fputs(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @perror(i8* %0)
ret i32 %1
}
int test_imm_21uint8_reg(unsigned char val) {
  return ((val) & (0x21 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_21uint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 33
%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_21uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 33
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ display;
};
struct TYPE_4__ {
  TYPE_1__ xkeymap;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void *get_XEvent_xkeymap_display(void *_p) {
  return (void *)((XEvent *)_p)->xkeymap.display;
}


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

x86 assembly (clang, -O2):
<get_XEvent_xkeymap_display>:
mov    (%rdi),%rax
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i64 }
define i8* @get_XEvent_xkeymap_display(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_4__*
%5 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i32 0, i32 0
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
%7 = load i64, i64* %6
%8 = inttoptr i64 %7 to i8*
ret i8* %8
}

LLVM IR (-O2):
define i8* @get_XEvent_xkeymap_display(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
/* Variables and functions */
unsigned long O_NDELAY;
unsigned long O_NOCTTY;
unsigned long O_RDWR;
int open(char const *, unsigned long);
int openPort(const char *dev, unsigned long flags) {
  return open(dev, O_RDWR | O_NOCTTY | O_NDELAY | flags);
}


x86 assembly (clang, -O0):
<openPort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ebd(%rip),%rax
mov    (%rax),%rsi
mov    0x2ea3(%rip),%rax
or     (%rax),%rsi
mov    0x2e91(%rip),%rax
or     (%rax),%rsi
or     -0x10(%rbp),%rsi
call   1030 <open@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openPort>:
mov    0x2ed1(%rip),%rax
mov    0x2eba(%rip),%rcx
mov    0x2eab(%rip),%rdx
or     (%rax),%rsi
or     (%rcx),%rsi
or     (%rdx),%rsi
jmp    1030 <open@plt>

LLVM IR (-O0):
@O_RDWR = global i64 0
@O_NOCTTY = global i64 0
@O_NDELAY = global i64 0
define i32 @openPort(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* @O_RDWR
%7 = load i64, i64* @O_NOCTTY
%8 = or i64 %6, %7
%9 = load i64, i64* @O_NDELAY
%10 = or i64 %8, %9
%11 = load i64, i64* %4
%12 = or i64 %10, %11
%13 = call i32 @open(i8* %5, i64 %12)
ret i32 %13
}

LLVM IR (-O2):
@O_RDWR = global i64 0
@O_NOCTTY = global i64 0
@O_NDELAY = global i64 0
define i32 @openPort(i8* nocapture %0, i64 %1) {
%3 = load i64, i64* @O_RDWR
%4 = load i64, i64* @O_NOCTTY
%5 = load i64, i64* @O_NDELAY
%6 = or i64 %3, %1
%7 = or i64 %6, %4
%8 = or i64 %7, %5
%9 = tail call i32 @open(i8* %0, i64 %8)
ret i32 %9
}
int main(int argc, char **argv) {
  printf("%s: Hello world\n", __func__);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"%s: Hello world\0A\00"
@__func__.main = [5 x i8] c"main\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__func__.main, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"%s: Hello world\0A\00"
@__func__.main = [5 x i8] c"main\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__func__.main, i64 0, i64 0))
ret i32 0
}
int isPrime(int n) {
  int i = 2;
  while (i * i <= n) {
    if (n % i == 0)
      return 1;
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<isPrime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1148 <isPrime+0x48>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    113a <isPrime+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    114f <isPrime+0x4f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <isPrime+0xe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPrime>:
xor    %ecx,%ecx
cmp    $0x4,%edi
jl     1125 <isPrime+0x25>
mov    $0x2,%esi
nopl   0x0(%rax)
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1128 <isPrime+0x28>
add    $0x1,%esi
mov    %esi,%eax
imul   %esi,%eax
cmp    %edi,%eax
jle    1110 <isPrime+0x10>
mov    %ecx,%eax
ret
mov    $0x1,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @isPrime(i32 %0) {
%2 = icmp slt i32 %0, 4
br i1 %2, label %11, label %6
3: ; preds = %6
%4 = mul nsw i32 %10, %10
%5 = icmp sgt i32 %4, %0
br i1 %5, label %11, label %6
6: ; preds = %1, %3
%7 = phi i32 [ %10, %3 ], [ 2, %1 ]
%8 = srem i32 %0, %7
%9 = icmp eq i32 %8, 0
%10 = add nuw nsw i32 %7, 1
br i1 %9, label %11, label %3
11: ; preds = %6, %3, %1
%12 = phi i32 [ 0, %1 ], [ 0, %3 ], [ 1, %6 ]
ret i32 %12
}
void strcat2(char *s, char *t) {
  while (*s)
    s++;
  ;
  while (*s++ = *t++)
    ;
  *s = '\0';
}


x86 assembly (clang, -O0):
<strcat2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     112a <strcat2+0x2a>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <strcat2+0xc>
jmp    112f <strcat2+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     115e <strcat2+0x5e>
jmp    112f <strcat2+0x2f>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat2>:
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1100 <strcat2>
mov    $0xffffffffffffffff,%rax
movzbl 0x1(%rsi,%rax,1),%ecx
mov    %cl,(%rdi,%rax,1)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strcat2+0x10>
movb   $0x0,(%rdi,%rax,1)
ret

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

LLVM IR (-O2):
define void @strcat2(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %7, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3, %8
%9 = phi i8* [ %13, %8 ], [ %4, %3 ]
%10 = phi i8* [ %11, %8 ], [ %1, %3 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %10
%13 = getelementptr inbounds i8, i8* %9, i64 1
store i8 %12, i8* %9
%14 = icmp eq i8 %12, 0
br i1 %14, label %15, label %8
15: ; preds = %8
store i8 0, i8* %13
ret void
}
void ff_hevc_put_hevc_qpel_hv64_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_qpel_hv64_12_sse4() {
ret void
}
_fltswap(i1, i2) double *i1, *i2;
{
  double i3;
  i3 = *i1;
  *i1 = *i2;
  *i2 = i3;
}


x86 assembly (clang, -O0):
<_fltswap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_fltswap>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
movsd  %xmm1,(%rdi)
movsd  %xmm0,(%rsi)
ret

LLVM IR (-O0):
define i32 @_fltswap(double* %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca double*
%6 = alloca double
store double* %0, double** %4
store double* %1, double** %5
%7 = load double*, double** %4
%8 = load double, double* %7
store double %8, double* %6
%9 = load double*, double** %5
%10 = load double, double* %9
%11 = load double*, double** %4
store double %10, double* %11
%12 = load double, double* %6
%13 = load double*, double** %5
store double %12, double* %13
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @_fltswap(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
store double %4, double* %0
store double %3, double* %1
ret i32 undef
}
void gen_keydefs(int mode) {
  char buf[16];
  char obuf[16];
  int i;
}


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

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

LLVM IR (-O0):
define void @gen_keydefs(i32 %0) {
%2 = alloca i32
%3 = alloca [16 x i8]
%4 = alloca [16 x i8]
%5 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @gen_keydefs(i32 %0) {
ret void
}
/* Variables and functions */
int Cmd_Argc();
int /*<<< orphan*/ Cmd_Argv(int);
int /*<<< orphan*/ Com_Printf(char *);
int /*<<< orphan*/ Cvar_Reset(int /*<<< orphan*/);
void Cvar_Reset_f(void) {
  if (Cmd_Argc() != 2) {
    Com_Printf("usage: reset <variable>\n");
    return;
  }
  Cvar_Reset(Cmd_Argv(1));
}


x86 assembly (clang, -O0):
<Cvar_Reset_f>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <Cmd_Argc@plt>
cmp    $0x2,%eax
je     1165 <Cvar_Reset_f+0x25>
lea    0xea5(%rip),%rdi
call   1050 <Com_Printf@plt>
jmp    1176 <Cvar_Reset_f+0x36>
mov    $0x1,%edi
call   1060 <Cmd_Argv@plt>
mov    %eax,%edi
call   1030 <Cvar_Reset@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cvar_Reset_f>:
push   %rax
xor    %eax,%eax
call   1040 <Cmd_Argc@plt>
cmp    $0x2,%eax
jne    115f <Cvar_Reset_f+0x1f>
mov    $0x1,%edi
call   1060 <Cmd_Argv@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <Cvar_Reset@plt>
lea    0xe9a(%rip),%rdi
pop    %rax
jmp    1050 <Com_Printf@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"usage: reset <variable>\0A\00"
define void @Cvar_Reset_f() {
%1 = call i32 (...) @Cmd_Argc()
%2 = icmp ne i32 %1, 2
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @Com_Printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %8
5: ; preds = %0
%6 = call i32 @Cmd_Argv(i32 1)
%7 = call i32 @Cvar_Reset(i32 %6)
br label %8
8: ; preds = %5, %3
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"usage: reset <variable>\0A\00"
define void @Cvar_Reset_f() {
%1 = tail call i32 (...) @Cmd_Argc()
%2 = icmp eq i32 %1, 2
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @Com_Printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %8
5: ; preds = %0
%6 = tail call i32 @Cmd_Argv(i32 1)
%7 = tail call i32 @Cvar_Reset(i32 %6)
br label %8
8: ; preds = %5, %3
ret void
}
int is_character_start(int c, int ahead) { return c == '#' && ahead == '\\'; }


x86 assembly (clang, -O0):
<is_character_start>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x23,-0x4(%rbp)
mov    %al,-0x9(%rbp)
jne    1123 <is_character_start+0x23>
cmpl   $0x5c,-0x8(%rbp)
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_character_start>:
xor    $0x23,%edi
xor    $0x5c,%esi
xor    %eax,%eax
or     %edi,%esi
sete   %al
ret

LLVM IR (-O0):
define i32 @is_character_start(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 = icmp eq i32 %5, 35
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 92
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ false, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @is_character_start(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 35
%4 = icmp eq i32 %1, 92
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
void switch_mm(struct mm_struct *prev, struct mm_struct *next,
               struct task_struct *tsk) {}


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

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

LLVM IR (-O0):
%struct.mm_struct = type opaque
%struct.task_struct = type opaque
define void @switch_mm(%struct.mm_struct* %0, %struct.mm_struct* %1, %struct.task_struct* %2) {
%4 = alloca %struct.mm_struct*
%5 = alloca %struct.mm_struct*
%6 = alloca %struct.task_struct*
store %struct.mm_struct* %0, %struct.mm_struct** %4
store %struct.mm_struct* %1, %struct.mm_struct** %5
store %struct.task_struct* %2, %struct.task_struct** %6
ret void
}

LLVM IR (-O2):
%struct.mm_struct = type opaque
%struct.task_struct = type opaque
define void @switch_mm(%struct.mm_struct* nocapture %0, %struct.mm_struct* nocapture %1, %struct.task_struct* nocapture %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int __isatty(int fd) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<__isatty>:
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):
<__isatty>:
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 @__isatty(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 @__isatty(i32 %0) {
%2 = load i32, i32* @ENOSYS
%3 = tail call i32 @__set_errno(i32 %2)
ret i32 -1
}
void SockInit() { ; }


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

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

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

LLVM IR (-O2):
define void @SockInit() {
ret void
}
/* Type definitions */
struct Var {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ pA(char *, char const *, char const *);
void __func_minus_uint(struct Var *avar, const char *areg, const char *lreg,
                       const char *rreg) {
  pA("%s = (%s ^ (-1)) + 1;", areg, lreg);
}


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

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

LLVM IR (-O0):
%struct.Var = type { i32 }
@.str = [22 x i8] c"%s = (%s ^ (-1)) + 1;\00"
define void @__func_minus_uint(%struct.Var* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca %struct.Var*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store %struct.Var* %0, %struct.Var** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %6
%10 = load i8*, i8** %7
%11 = call i32 @pA(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10)
ret void
}

LLVM IR (-O2):
%struct.Var = type { i32 }
@.str = [22 x i8] c"%s = (%s ^ (-1)) + 1;\00"
define void @__func_minus_uint(%struct.Var* nocapture readnone %0, i8* %1, i8* %2, i8* nocapture readnone %3) {
%5 = tail call i32 @pA(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ FOURCC(char, char, char, char);
int /*<<< orphan*/ NodeUnRegisterClass(int /*<<< orphan*/);
void MPG_Done() { NodeUnRegisterClass(FOURCC('M', 'P', 'E', 'G')); }


x86 assembly (clang, -O0):
<MPG_Done>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4d,%edi
mov    $0x50,%esi
mov    $0x45,%edx
mov    $0x47,%ecx
call   1030 <FOURCC@plt>
mov    %eax,%edi
call   1040 <NodeUnRegisterClass@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<MPG_Done>:
push   %rax
mov    $0x4d,%edi
mov    $0x50,%esi
mov    $0x45,%edx
mov    $0x47,%ecx
call   1030 <FOURCC@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <NodeUnRegisterClass@plt>

LLVM IR (-O0):
define void @MPG_Done() {
%1 = call i32 @FOURCC(i8 signext 77, i8 signext 80, i8 signext 69, i8 signext 71)
%2 = call i32 @NodeUnRegisterClass(i32 %1)
ret void
}

LLVM IR (-O2):
define void @MPG_Done() {
%1 = tail call i32 @FOURCC(i8 signext 77, i8 signext 80, i8 signext 69, i8 signext 71)
%2 = tail call i32 @NodeUnRegisterClass(i32 %1)
ret void
}