xunge/DecIR huggingface dataset:
/* Type definitions */
typedef unsigned int uint32_t;

/* Variables and functions */
void _r(uint32_t *a, uint32_t *b, uint32_t *d, unsigned c) {
  *a += *b;
  uint32_t tmp = *a ^ *d;
  *d = (tmp << c) | (tmp >> (32 - c));
}


x86 assembly (clang, -O0):
<_r>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
xor    (%rcx),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x1c(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
mov    $0x20,%ecx
sub    -0x1c(%rbp),%ecx
shr    %cl,%eax
mov    -0x24(%rbp),%ecx
or     %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_r>:
mov    (%rdi),%eax
add    (%rsi),%eax
mov    %eax,(%rdi)
xor    (%rdx),%eax
rol    %cl,%eax
mov    %eax,(%rdx)
ret

LLVM IR (-O0):
define void @_r(i32* %0, i32* %1, i32* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%10 = load i32*, i32** %6
%11 = load i32, i32* %10
%12 = load i32*, i32** %5
%13 = load i32, i32* %12
%14 = add i32 %13, %11
store i32 %14, i32* %12
%15 = load i32*, i32** %5
%16 = load i32, i32* %15
%17 = load i32*, i32** %7
%18 = load i32, i32* %17
%19 = xor i32 %16, %18
store i32 %19, i32* %9
%20 = load i32, i32* %9
%21 = load i32, i32* %8
%22 = shl i32 %20, %21
%23 = load i32, i32* %9
%24 = load i32, i32* %8
%25 = sub i32 32, %24
%26 = lshr i32 %23, %25
%27 = or i32 %22, %26
%28 = load i32*, i32** %7
store i32 %27, i32* %28
ret void
}

LLVM IR (-O2):
define void @_r(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2, i32 %3) {
%5 = load i32, i32* %1
%6 = load i32, i32* %0
%7 = add i32 %6, %5
store i32 %7, i32* %0
%8 = load i32, i32* %2
%9 = xor i32 %8, %7
%10 = shl i32 %9, %3
%11 = sub i32 32, %3
%12 = lshr i32 %9, %11
%13 = or i32 %10, %12
store i32 %13, i32* %2
ret void
}
/* Variables and functions */
char *malloc(int);
int rand();
char *realloc(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
char *fn68() {
  char *result;
  result = malloc(20 + rand() % 20);
  result = realloc(result, 30 + rand() % 20);
  strcpy((char *)result, "fn68");
  return result;
}


x86 assembly (clang, -O0):
<fn68>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x10(%rbp),%rdi
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1e,%esi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn68>:
push   %rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1e,%esi
mov    %rbx,%rdi
call   1050 <realloc@plt>
mov    %rax,%rbx
lea    0xe4f(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"fn68\00"
define i8* @fn68() {
%1 = alloca i8*
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 20
%4 = add nsw i32 20, %3
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 20
%9 = add nsw i32 30, %8
%10 = call i8* @realloc(i8* %6, i32 %9)
store i8* %10, i8** %1
%11 = load i8*, i8** %1
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %1
ret i8* %13
}

LLVM IR (-O2):
@.str = [5 x i8] c"fn68\00"
define i8* @fn68() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 20
%3 = add nsw i32 %2, 20
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 20
%7 = add nsw i32 %6, 30
%8 = tail call i8* @realloc(i8* %4, i32 %7)
%9 = tail call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %8
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int pthread_mutex_unlock(int /*<<< orphan*/ *);
int __attribute__((unused))
___pthread_mutex_unlock(pthread_mutex_t *mutex, char *lname, char *fn, int ln) {
  return pthread_mutex_unlock(mutex);
}


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

x86 assembly (clang, -O2):
<___pthread_mutex_unlock>:
jmp    1030 <pthread_mutex_unlock@plt>

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

LLVM IR (-O2):
define i32 @___pthread_mutex_unlock(i32* %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i32 %3) {
%5 = tail call i32 @pthread_mutex_unlock(i32* %0)
ret i32 %5
}
int test_imm_2Auint16_reg(unsigned short val) {
  return ((val) & (-0x2A << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_2Auint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffffd6,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_2Auint16_reg>:
test   $0xffd6,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_2Auint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, -42
%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_2Auint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -42
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int fun2(int a) { return a; }


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

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

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

LLVM IR (-O2):
define i32 @fun2(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int foo(int, int);
int foo1(int, int);
int foo2(int, double);
int main() {
  if (foo(22, 23) != 45)
    abort();
  if (foo1(1, 2) != 100)
    abort();
  if (foo2(100, 1.2) != 48)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x16,%edi
mov    $0x17,%esi
call   1050 <foo@plt>
cmp    $0x2d,%eax
je     116e <main+0x2e>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x1,%edi
mov    $0x2,%esi
call   1060 <foo1@plt>
cmp    $0x64,%eax
je     118d <main+0x4d>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x64,%edi
movsd  0xe66(%rip),%xmm0
call   1040 <foo2@plt>
cmp    $0x30,%eax
je     11af <main+0x6f>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x16,%edi
mov    $0x17,%esi
call   1050 <foo@plt>
cmp    $0x2d,%eax
jne    1184 <main+0x44>
mov    $0x1,%edi
mov    $0x2,%esi
call   1060 <foo1@plt>
cmp    $0x64,%eax
jne    1184 <main+0x44>
movsd  0xe8f(%rip),%xmm0
mov    $0x64,%edi
call   1040 <foo2@plt>
cmp    $0x30,%eax
jne    1184 <main+0x44>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @foo(i32 22, i32 23)
%3 = icmp ne i32 %2, 45
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = call i32 @foo1(i32 1, i32 2)
%8 = icmp ne i32 %7, 100
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %6
%12 = call i32 @foo2(i32 100, double 1.200000e+00)
%13 = icmp ne i32 %12, 48
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 22, i32 23)
%2 = icmp eq i32 %1, 45
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @foo1(i32 1, i32 2)
%7 = icmp eq i32 %6, 100
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %5
%11 = tail call i32 @foo2(i32 100, double 1.200000e+00)
%12 = icmp eq i32 %11, 48
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 (...) @abort()
unreachable
15: ; preds = %10
ret i32 0
}
void printfSTRING(char *str) {}


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

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

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

LLVM IR (-O2):
define void @printfSTRING(i8* nocapture %0) {
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ type;
};
typedef TYPE_1__ XColormapEvent;

/* Variables and functions */
int get_XColormapEvent_type(void *_p) {
  return (int)((XColormapEvent *)_p)->type;
}


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

x86 assembly (clang, -O2):
<get_XColormapEvent_type>:
mov    (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @get_XColormapEvent_type(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
void printchar(char **str, int c) {
  extern int platform_uart_putc(int c);
  if (str) {
    **str = c;
    ++(*str);
  } else
    (void)platform_uart_putc(c);
}


x86 assembly (clang, -O0):
<printchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114b <printchar+0x3b>
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    1153 <printchar+0x43>
mov    -0xc(%rbp),%edi
call   1030 <platform_uart_putc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printchar>:
test   %rdi,%rdi
je     1120 <printchar+0x10>
mov    (%rdi),%rax
mov    %sil,(%rax)
addq   $0x1,(%rdi)
ret
mov    %esi,%edi
jmp    1030 <platform_uart_putc@plt>

LLVM IR (-O0):
define void @printchar(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 = icmp ne i8** %5, null
br i1 %6, label %7, label %15
7: ; preds = %2
%8 = load i32, i32* %4
%9 = trunc i32 %8 to i8
%10 = load i8**, i8*** %3
%11 = load i8*, i8** %10
store i8 %9, i8* %11
%12 = load i8**, i8*** %3
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %12
br label %18
15: ; preds = %2
%16 = load i32, i32* %4
%17 = call i32 @platform_uart_putc(i32 %16)
br label %18
18: ; preds = %15, %7
ret void
}

LLVM IR (-O2):
define void @printchar(i8** %0, i32 %1) {
%3 = icmp eq i8** %0, null
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = trunc i32 %1 to i8
%6 = load i8*, i8** %0
store i8 %5, i8* %6
%7 = load i8*, i8** %0
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8* %8, i8** %0
br label %11
9: ; preds = %2
%10 = tail call i32 @platform_uart_putc(i32 %1)
br label %11
11: ; preds = %9, %4
ret void
}
int fun893() { return 893; }


x86 assembly (clang, -O0):
<fun893>:
push   %rbp
mov    %rsp,%rbp
mov    $0x37d,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fun893() {
ret i32 893
}

LLVM IR (-O2):
define i32 @fun893() {
ret i32 893
}
int cslchKeyCompare(void *pKey1, void *pKey2) {
  if (pKey1 == pKey2)
    return 0;
  else if (pKey1 < pKey2)
    return -1;
  else
    return 1;
}


x86 assembly (clang, -O0):
<cslchKeyCompare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    1126 <cslchKeyCompare+0x26>
movl   $0x0,-0x4(%rbp)
jmp    1147 <cslchKeyCompare+0x47>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1140 <cslchKeyCompare+0x40>
movl   $0xffffffff,-0x4(%rbp)
jmp    1147 <cslchKeyCompare+0x47>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cslchKeyCompare>:
xor    %ecx,%ecx
xor    %eax,%eax
cmp    %rsi,%rdi
setae  %al
lea    -0x1(%rax,%rax,1),%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @cslchKeyCompare(i8* readnone %0, i8* readnone %1) {
%3 = icmp eq i8* %0, %1
%4 = icmp ult i8* %0, %1
%5 = select i1 %4, i32 -1, i32 1
%6 = select i1 %3, i32 0, i32 %5
ret i32 %6
}
flt(float x, float y) {
  if (x < y)
    return 13;
  else
    return 140;
}


x86 assembly (clang, -O0):
<flt>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    112d <flt+0x2d>
movl   $0xd,-0x4(%rbp)
jmp    1134 <flt+0x34>
movl   $0x8c,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<flt>:
ucomiss %xmm0,%xmm1
mov    $0xd,%ecx
mov    $0x8c,%eax
cmova  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @flt(float %0, float %1) {
%3 = fcmp olt float %0, %1
%4 = select i1 %3, i32 13, i32 140
ret i32 %4
}
/* Type definitions */
struct of_endpoint {
  int dummy;
};
struct device_node {
  int dummy;
};

/* Variables and functions */
int ENOSYS;
int of_graph_parse_endpoint(const struct device_node *node,
                            struct of_endpoint *endpoint) {
  return -ENOSYS;
}


x86 assembly (clang, -O0):
<of_graph_parse_endpoint>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    0x2ed3(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<of_graph_parse_endpoint>:
mov    0x2ee1(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
%struct.device_node = type { i32 }
%struct.of_endpoint = type { i32 }
@ENOSYS = global i32 0
define i32 @of_graph_parse_endpoint(%struct.device_node* %0, %struct.of_endpoint* %1) {
%3 = alloca %struct.device_node*
%4 = alloca %struct.of_endpoint*
store %struct.device_node* %0, %struct.device_node** %3
store %struct.of_endpoint* %1, %struct.of_endpoint** %4
%5 = load i32, i32* @ENOSYS
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
%struct.device_node = type { i32 }
%struct.of_endpoint = type { i32 }
@ENOSYS = global i32 0
define i32 @of_graph_parse_endpoint(%struct.device_node* nocapture readnone %0, %struct.of_endpoint* nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
%4 = sub nsw i32 0, %3
ret i32 %4
}
int freeTTyStat(void *sg) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @freeTTyStat(i8* nocapture readnone %0) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ STDERR_FILENO;
int /*<<< orphan*/ write(int /*<<< orphan*/, char *, int);
void longjmperror(void) {
  (void)write(STDERR_FILENO, "longjmp botch.\n",
              sizeof("longjmp botch.\n") - 1);
}


x86 assembly (clang, -O0):
<longjmperror>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
mov    $0xf,%edx
call   1030 <write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<longjmperror>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
mov    $0xf,%edx
jmp    1030 <write@plt>

LLVM IR (-O0):
@STDERR_FILENO = global i32 0
@.str = [16 x i8] c"longjmp botch.\0A\00"
define void @longjmperror() {
%1 = load i32, i32* @STDERR_FILENO
%2 = call i32 @write(i32 %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 15)
ret void
}

LLVM IR (-O2):
@STDERR_FILENO = global i32 0
@.str = [16 x i8] c"longjmp botch.\0A\00"
define void @longjmperror() {
%1 = load i32, i32* @STDERR_FILENO
%2 = tail call i32 @write(i32 %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 15)
ret void
}
int UnInit(unsigned long fnc) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @UnInit(i64 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ mod(long long, long long);
int main() {
  mod(1LL, 2LL);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <mod@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <mod@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @mod(i64 1, i64 2)
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @mod(i64 1, i64 2)
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
main() {
  unsigned int n = 1;
  int ctr = 0;
  while (n != 0) {
    n = n << 1;
    ctr++;
  }
  printf("Word length is %d\n", ctr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     114e <main+0x3e>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
mov    -0xc(%rbp),%esi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [19 x i8] c"Word length is %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 32)
ret i32 0
}
void lgdt(volatile void *gdtr) {
  __asm__ volatile("lgdt (%0)" ::"r"(gdtr));
  do {
    asm volatile("" ::: "memory");
  } while (0);
}


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

x86 assembly (clang, -O2):
<lgdt>:
lgdt   (%rdi)
ret

LLVM IR (-O0):
define void @lgdt(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
br label %4
4: ; preds = %1
br label %5
5: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @lgdt(i8* %0) {
tail call void asm sideeffect "lgdt ($0)", "r,~{dirflag},~{fpsr},~{flags}"(i8* %0)
tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
int test2(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @test2() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void free_x(void *p) { free(p); }


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

x86 assembly (clang, -O2):
<free_x>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_x(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @free(i8* %3)
ret void
}

LLVM IR (-O2):
define void @free_x(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ itob(int, char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  int n, b;
  char s[200];
  n = 15;
  b = 16;
  itob(n, s, b);
  printf("%s\n", s);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xd0,%rsp
mov    %rsp,%rbx
mov    $0xf,%edi
mov    %rbx,%rsi
mov    $0x10,%edx
call   1040 <itob@plt>
lea    0xebc(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [200 x i8]
store i32 0, i32* %1
store i32 15, i32* %2
store i32 16, i32* %3
%5 = load i32, i32* %2
%6 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%7 = load i32, i32* %3
%8 = call i32 @itob(i32 %5, i8* %6, i32 %7)
%9 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [200 x i8]
%2 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%3 = call i32 @itob(i32 15, i8* %2, i32 16)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, unsigned long long);
scalar_t__ rdtsc();
int /*<<< orphan*/ sleep(int);
int main(int argc, char **argv) {
  uint64_t start = rdtsc();
  sleep(1);
  uint64_t end = rdtsc();
  printf("1 second = %llu rdtsc counts\n",
         (long long unsigned int)(end - start));
  exit(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    $0x0,%al
call   1040 <rdtsc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x1,%edi
call   1060 <sleep@plt>
mov    $0x0,%al
call   1040 <rdtsc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
sub    -0x18(%rbp),%rsi
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <rdtsc@plt>
mov    %rax,%rbx
mov    $0x1,%edi
call   1060 <sleep@plt>
xor    %eax,%eax
call   1040 <rdtsc@plt>
sub    %rbx,%rax
lea    0xe9a(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"1 second = %llu rdtsc counts\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i64 (...) @rdtsc()
store i64 %8, i64* %6
%9 = call i32 @sleep(i32 1)
%10 = call i64 (...) @rdtsc()
store i64 %10, i64* %7
%11 = load i64, i64* %7
%12 = load i64, i64* %6
%13 = sub nsw i64 %11, %12
%14 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i64 %13)
%15 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [30 x i8] c"1 second = %llu rdtsc counts\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 (...) @rdtsc()
%4 = tail call i32 @sleep(i32 1)
%5 = tail call i64 (...) @rdtsc()
%6 = sub nsw i64 %5, %3
%7 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i64 %6)
%8 = tail call i32 @exit(i32 0)
unreachable
}
int inter_rodex_sql_init(void) { return 1; }


x86 assembly (clang, -O0):
<inter_rodex_sql_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @inter_rodex_sql_init() {
ret i32 1
}

LLVM IR (-O2):
define i32 @inter_rodex_sql_init() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int const);
void func_0(int const i) { printf("func_0  : %d\n", i); }


x86 assembly (clang, -O0):
<func_0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func_0>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"func_0 : %d\0A\00"
define void @func_0(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"func_0 : %d\0A\00"
define void @func_0(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ slepp(int);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv, char **envp) {
  while (1) {
    fprintf(stderr, "Sleep...\n");
    slepp(1);
  }
  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    0x2e9f(%rip),%rax
mov    (%rax),%edi
lea    0xeb6(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1030 <slepp@plt>
jmp    113a <main+0x1a>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2eb5(%rip),%r14
lea    0xece(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r14),%edi
mov    %rbx,%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1030 <slepp@plt>
jmp    1140 <main+0x20>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [10 x i8] c"Sleep...\0A\00"
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
br label %8
8: ; preds = %3, %8
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @slepp(i32 1)
br label %8
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [10 x i8] c"Sleep...\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
br label %4
4: ; preds = %3, %4
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @slepp(i32 1)
br label %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;

/* Variables and functions */
int /*<<< orphan*/ geteuid();
int /*<<< orphan*/ getuid();
uid_t __getuid(int real) { return real ? getuid() : geteuid(); }


x86 assembly (clang, -O0):
<__getuid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1144 <__getuid+0x24>
mov    $0x0,%al
call   1030 <getuid@plt>
mov    %eax,-0x8(%rbp)
jmp    114e <__getuid+0x2e>
mov    $0x0,%al
call   1040 <geteuid@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__getuid>:
xor    %eax,%eax
test   %edi,%edi
je     112b <__getuid+0xb>
jmp    1030 <getuid@plt>
jmp    1040 <geteuid@plt>

LLVM IR (-O0):
define i32 @__getuid(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @getuid()
br label %9
7: ; preds = %1
%8 = call i32 (...) @geteuid()
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ %6, %5 ], [ %8, %7 ]
ret i32 %10
}

LLVM IR (-O2):
define i32 @__getuid(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @getuid()
br label %7
5: ; preds = %1
%6 = tail call i32 (...) @geteuid()
br label %7
7: ; preds = %5, %3
%8 = phi i32 [ %4, %3 ], [ %6, %5 ]
ret i32 %8
}
__attribute__((no, noclone)) signed __int128 t125_5mul(signed __int128 x) {
  signed __int128 r;
  if (__builtin_mul_overflow(x, (signed __int128)(2), &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t125_5mul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rcx
add    %rdx,%rdx
adc    %rcx,%rcx
seto   %al
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x38(%rbp)
test   $0x1,%al
jne    1156 <t125_5mul+0x46>
jmp    115d <t125_5mul+0x4d>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t125_5mul>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
add    %rdi,%rbx
adc    %rsi,%r14
jno    1129 <t125_5mul+0x19>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %rbx,%rax
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define { i64, i64 } @t125_5mul(i64 %0, i64 %1) {
%3 = alloca i128
%4 = alloca i128
%5 = alloca i128
%6 = alloca i128
%7 = bitcast i128* %4 to { i64, i64 }*
%8 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 0
store i64 %0, i64* %8
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 1
store i64 %1, i64* %9
%10 = load i128, i128* %4
store i128 %10, i128* %5
%11 = load i128, i128* %5
%12 = call { i128, i1 } @llvm.smul.with.overflow.i128(i128 %11, i128 2)
%13 = extractvalue { i128, i1 } %12, 1
%14 = extractvalue { i128, i1 } %12, 0
store i128 %14, i128* %6
br i1 %13, label %15, label %17
15: ; preds = %2
%16 = call i32 (...) @bar()
br label %17
17: ; preds = %15, %2
%18 = load i128, i128* %6
store i128 %18, i128* %3
%19 = bitcast i128* %3 to { i64, i64 }*
%20 = load { i64, i64 }, { i64, i64 }* %19
ret { i64, i64 } %20
}

LLVM IR (-O2):
define { i64, i64 } @t125_5mul(i64 %0, i64 %1) {
%3 = zext i64 %1 to i128
%4 = shl nuw i128 %3, 64
%5 = zext i64 %0 to i128
%6 = or i128 %4, %5
%7 = tail call { i128, i1 } @llvm.smul.with.overflow.i128(i128 %6, i128 2)
%8 = extractvalue { i128, i1 } %7, 1
%9 = extractvalue { i128, i1 } %7, 0
br i1 %8, label %10, label %12
10: ; preds = %2
%11 = tail call i32 (...) @bar()
br label %12
12: ; preds = %10, %2
%13 = trunc i128 %9 to i64
%14 = lshr i128 %9, 64
%15 = trunc i128 %14 to i64
%16 = insertvalue { i64, i64 } poison, i64 %13, 0
%17 = insertvalue { i64, i64 } %16, i64 %15, 1
ret { i64, i64 } %17
}
void *pgeVramAbsolutePointer(void *ptr) {
  return (void *)((unsigned long)ptr | 0x04000000);
}


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

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

LLVM IR (-O0):
define i8* @pgeVramAbsolutePointer(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i64
%5 = or i64 %4, 67108864
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}

LLVM IR (-O2):
define i8* @pgeVramAbsolutePointer(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = or i64 %2, 67108864
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
FILE *openfile(char *opts) {
  FILE *fd = NULL;
  fd = fopen("/dev/cse5361", opts);
  if (!fd) {
    printf("File error opening file\n");
  }
  return fd;
}


x86 assembly (clang, -O0):
<openfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec1(%rip),%rdi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115f <openfile+0x3f>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openfile>:
push   %rbx
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1040 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1144 <openfile+0x24>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"/dev/cse5361\00"
@.str.1 = [25 x i8] c"File error opening file\0A\00"
define i32* @openfile(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
store i32* null, i32** %3
%4 = load i8*, i8** %2
%5 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %4)
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = icmp ne i32* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i32*, i32** %3
ret i32* %11
}

LLVM IR (-O2):
@.str = [13 x i8] c"/dev/cse5361\00"
@str = [24 x i8] c"File error opening file\00"
define noalias i32* @openfile(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i32* %2
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t rot32l16(uint32_t x) { return (x << 16) | (x >> 16); }


x86 assembly (clang, -O0):
<rot32l16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x10,%eax
mov    -0x4(%rbp),%ecx
sar    $0x10,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rot32l16>:
mov    %edi,%eax
shl    $0x10,%eax
sar    $0x10,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @rot32l16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 16
%5 = load i32, i32* %2
%6 = ashr i32 %5, 16
%7 = or i32 %4, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @rot32l16(i32 %0) {
%2 = shl i32 %0, 16
%3 = ashr i32 %0, 16
%4 = or i32 %2, %3
ret i32 %4
}
int test8u(unsigned int x) { return x / 10U <= 0; }


x86 assembly (clang, -O0):
<test8u>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
cmp    $0x0,%eax
setbe  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test8u>:
xor    %eax,%eax
cmp    $0xa,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @test8u(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = udiv i32 %3, 10
%5 = icmp ule i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @test8u(i32 %0) {
%2 = icmp ult i32 %0, 10
%3 = zext i1 %2 to i32
ret i32 %3
}
int right_child(int parent_index) { return (2 * parent_index) + 1; }


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

x86 assembly (clang, -O2):
<right_child>:
lea    (%rdi,%rdi,1),%eax
add    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @right_child(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = or i32 %2, 1
ret i32 %3
}
/* Variables and functions */
int foo(int);
char *test_foo() {
  int result = foo(5150);
  do {
    if (!(result == 5150))
      return "error, result != 5150";
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x141e,%edi
call   1030 <foo@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x141e,-0xc(%rbp)
je     1142 <test_foo+0x32>
lea    0xec7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    114f <test_foo+0x3f>
jmp    1147 <test_foo+0x37>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_foo>:
push   %rax
mov    $0x141e,%edi
call   1030 <foo@plt>
xor    %ecx,%ecx
cmp    $0x141e,%eax
lea    0xed7(%rip),%rax
cmovne %rax,%rcx
mov    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"error, result != 5150\00"
define i8* @test_foo() {
%1 = alloca i8*
%2 = alloca i32
%3 = call i32 @foo(i32 5150)
store i32 %3, i32* %2
br label %4
4: ; preds = %0
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 5150
br i1 %6, label %8, label %7
7: ; preds = %4
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8** %1
br label %10
8: ; preds = %4
br label %9
9: ; preds = %8
store i8* null, i8** %1
br label %10
10: ; preds = %9, %7
%11 = load i8*, i8** %1
ret i8* %11
}

LLVM IR (-O2):
@.str = [22 x i8] c"error, result != 5150\00"
define i8* @test_foo() {
%1 = tail call i32 @foo(i32 5150)
%2 = icmp eq i32 %1, 5150
%3 = select i1 %2, i8* null, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
void _m_vector_internal_null_clear_func(unsigned char *element_ptr) {}


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

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

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

LLVM IR (-O2):
define void @_m_vector_internal_null_clear_func(i8* nocapture %0) {
ret void
}
double _sum_sqr(double current, double new_value) {
  return current + new_value * new_value;
}


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

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

LLVM IR (-O0):
define double @_sum_sqr(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 = load double, double* %4
%8 = call double @llvm.fmuladd.f64(double %6, double %7, double %5)
ret double %8
}

LLVM IR (-O2):
define double @_sum_sqr(double %0, double %1) {
%3 = tail call double @llvm.fmuladd.f64(double %1, double %1, double %0)
ret double %3
}
/* Variables and functions */
int send_instruction(int, unsigned char *, unsigned char);
int set_line(int fd, unsigned char *data, unsigned char line) {
  return send_instruction(fd, data, line);
}


x86 assembly (clang, -O0):
<set_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
movzbl -0x11(%rbp),%edx
call   1030 <send_instruction@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_line>:
jmp    1030 <send_instruction@plt>

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

LLVM IR (-O2):
define i32 @set_line(i32 %0, i8* %1, i8 zeroext %2) {
%4 = tail call i32 @send_instruction(i32 %0, i8* %1, i8 zeroext %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ f(int);
main() {
  f(2);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ my_usleep(int);
int shared_random();
void random_delay() { my_usleep((shared_random() % 2000) * 100); }


x86 assembly (clang, -O0):
<random_delay>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <shared_random@plt>
mov    $0x7d0,%ecx
cltd
idiv   %ecx
imul   $0x64,%edx,%edi
call   1030 <my_usleep@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_delay>:
push   %rax
xor    %eax,%eax
call   1040 <shared_random@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x27,%rcx
add    %edx,%ecx
imul   $0x7d0,%ecx,%ecx
sub    %ecx,%eax
imul   $0x64,%eax,%edi
pop    %rax
jmp    1030 <my_usleep@plt>

LLVM IR (-O0):
define void @random_delay() {
%1 = call i32 (...) @shared_random()
%2 = srem i32 %1, 2000
%3 = mul nsw i32 %2, 100
%4 = call i32 @my_usleep(i32 %3)
ret void
}

LLVM IR (-O2):
define void @random_delay() {
%1 = tail call i32 (...) @shared_random()
%2 = srem i32 %1, 2000
%3 = mul nsw i32 %2, 100
%4 = tail call i32 @my_usleep(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void __attribute__((no)) foo(int x) {
  if (x != 5)
    abort();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x5,-0x4(%rbp)
je     112c <foo+0x1c>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
cmp    $0x5,%edi
jne    1116 <foo+0x6>
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define void @foo(i32 %0) {
%2 = icmp eq i32 %0, 5
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  printf("4 + 2 = %d\n", 4 + 2);
  printf("github");
  printf("Hello world");
  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
mov    $0x6,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
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
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"4 + 2 = %d\0A\00"
@.str.1 = [7 x i8] c"github\00"
@.str.2 = [12 x i8] c"Hello world\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 ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 6)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"4 + 2 = %d\0A\00"
@.str.1 = [7 x i8] c"github\00"
@.str.2 = [12 x i8] c"Hello world\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 6)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int errno;
int my_errno() { return errno; }


x86 assembly (clang, -O0):
<my_errno>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ed5(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_errno>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @my_errno() {
%1 = load i32, i32* @errno
ret i32 %1
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @my_errno() {
%1 = load i32, i32* @errno
ret i32 %1
}