xunge/DecIR huggingface dataset:
/* Variables and functions */
int foo(int, int, int);
int main() {
  int a, b, c;
  a = 2;
  b = 1;
  c = 3;
  int d = 4;
  int *p = &d;
  int i;
  for (i = 0; i < 12345; i++) {
    *p = foo(a, b, c);
  }
  return *p;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x3,-0x10(%rbp)
movl   $0x4,-0x14(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x3039,-0x24(%rbp)
jge    117b <main+0x6b>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <foo@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114a <main+0x3a>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x3039,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x2,%edi
mov    $0x1,%esi
mov    $0x3,%edx
call   1030 <foo@plt>
add    $0xffffffff,%ebx
jne    1120 <main+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @foo(i32 2, i32 1, i32 3)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 12345
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 %3
}
unsigned char LopAdj_OFILM(unsigned char UcDirSel_OFILM) { return 0; }


x86 assembly (clang, -O0):
<LopAdj_OFILM>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
xor    %eax,%eax
movzbl %al,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define zeroext i8 @LopAdj_OFILM(i8 zeroext %0) {
ret i8 0
}
/* Variables and functions */
int /*<<< orphan*/ f(char *);
int g(void) {
  f("TESTING");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"TESTING\00"
define i32 @g() {
%1 = call i32 @f(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"TESTING\00"
define i32 @g() {
%1 = tail call i32 @f(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int WhatBitOS() {
  if (sizeof(int *) == 4)
    return 32;
  else if (sizeof(int *) == 8)
    return 64;
  else
    return (sizeof(int *) * 8);
}


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

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

LLVM IR (-O0):
define i32 @WhatBitOS() {
ret i32 64
}

LLVM IR (-O2):
define i32 @WhatBitOS() {
ret i32 64
}
/* Variables and functions */
int stcli_d(char *, int);
int stci_d(char *string, int i) { return stcli_d(string, i); }


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

x86 assembly (clang, -O2):
<stci_d>:
jmp    1030 <stcli_d@plt>

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

LLVM IR (-O2):
define i32 @stci_d(i8* %0, i32 %1) {
%3 = tail call i32 @stcli_d(i8* %0, i32 %1)
ret i32 %3
}
int anc_hs_dev_register(struct anc_dev *dev, void *codec_data) { return 0; }


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

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

LLVM IR (-O0):
%struct.anc_dev = type opaque
define i32 @anc_hs_dev_register(%struct.anc_dev* %0, i8* %1) {
%3 = alloca %struct.anc_dev*
%4 = alloca i8*
store %struct.anc_dev* %0, %struct.anc_dev** %3
store i8* %1, i8** %4
ret i32 0
}

LLVM IR (-O2):
%struct.anc_dev = type opaque
define i32 @anc_hs_dev_register(%struct.anc_dev* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int f2(int);
int __attribute__((no)) f1(int i) { return f2(i) + 10; }


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <f2@plt>
add    $0xa,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
push   %rax
call   1030 <f2@plt>
add    $0xa,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @f1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @f2(i32 %3)
%5 = add nsw i32 %4, 10
ret i32 %5
}

LLVM IR (-O2):
define i32 @f1(i32 %0) {
%2 = tail call i32 @f2(i32 %0)
%3 = add nsw i32 %2, 10
ret i32 %3
}
/* Variables and functions */
long long llabs(long long j) { return (j < 0 ? -j : j); }


x86 assembly (clang, -O0):
<llabs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1122 <llabs+0x22>
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    112a <llabs+0x2a>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @llabs(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i64, i64* %2
%7 = sub nsw i64 0, %6
br label %10
8: ; preds = %1
%9 = load i64, i64* %2
br label %10
10: ; preds = %8, %5
%11 = phi i64 [ %7, %5 ], [ %9, %8 ]
ret i64 %11
}

LLVM IR (-O2):
define i64 @llabs(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
ret i64 %2
}
/* Type definitions */
struct RPyOpaque_ThreadLock {
  int dummy;
};

/* Variables and functions */
int RPyThreadAcquireLockTimed(struct RPyOpaque_ThreadLock *, int,
                              int /*<<< orphan*/);
int RPyThreadAcquireLock(struct RPyOpaque_ThreadLock *lock, int waitflag) {
  return RPyThreadAcquireLockTimed(lock, waitflag ? -1 : 0, 0);
}


x86 assembly (clang, -O0):
<RPyThreadAcquireLock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
xor    %esi,%esi
mov    $0xffffffff,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
xor    %edx,%edx
call   1030 <RPyThreadAcquireLockTimed@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RPyThreadAcquireLock>:
neg    %esi
sbb    %esi,%esi
xor    %edx,%edx
jmp    1030 <RPyThreadAcquireLockTimed@plt>

LLVM IR (-O0):
%struct.RPyOpaque_ThreadLock = type { i32 }
define i32 @RPyThreadAcquireLock(%struct.RPyOpaque_ThreadLock* %0, i32 %1) {
%3 = alloca %struct.RPyOpaque_ThreadLock*
%4 = alloca i32
store %struct.RPyOpaque_ThreadLock* %0, %struct.RPyOpaque_ThreadLock** %3
store i32 %1, i32* %4
%5 = load %struct.RPyOpaque_ThreadLock*, %struct.RPyOpaque_ThreadLock** %3
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -1, i32 0
%10 = call i32 @RPyThreadAcquireLockTimed(%struct.RPyOpaque_ThreadLock* %5, i32 %9, i32 0)
ret i32 %10
}

LLVM IR (-O2):
%struct.RPyOpaque_ThreadLock = type { i32 }
define i32 @RPyThreadAcquireLock(%struct.RPyOpaque_ThreadLock* %0, i32 %1) {
%3 = icmp ne i32 %1, 0
%4 = sext i1 %3 to i32
%5 = tail call i32 @RPyThreadAcquireLockTimed(%struct.RPyOpaque_ThreadLock* %0, i32 %4, i32 0)
ret i32 %5
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void ADCIntDisable(uint32_t ui32Base, uint32_t ui32SequenceNum) {
  ;
  ;
  (*((volatile uint32_t *)(ui32Base + 0x00000008))) &= ~(1 << ui32SequenceNum);
}


x86 assembly (clang, -O0):
<ADCIntDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
xor    $0xffffffff,%edx
mov    -0x4(%rbp),%eax
add    $0x8,%eax
cltq
mov    (%rax),%ecx
and    %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADCIntDisable>:
mov    %esi,%ecx
mov    $0xfffffffe,%eax
rol    %cl,%eax
movslq %edi,%rcx
and    %eax,0x8(%rcx)
ret

LLVM IR (-O0):
define void @ADCIntDisable(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = shl i32 1, %5
%7 = xor i32 %6, -1
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 8
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = load volatile i32, i32* %11
%13 = and i32 %12, %7
store volatile i32 %13, i32* %11
ret void
}

LLVM IR (-O2):
define void @ADCIntDisable(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = xor i32 %3, -1
%5 = add nsw i32 %0, 8
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
%9 = and i32 %8, %4
store volatile i32 %9, i32* %7
ret void
}
main() {
  struct {
    int i, j;
  } x[] = {[1 ... 5] = {1, 2}};
  if (x[0].i || x[0].j)
    abort();
  for (int i = 1; i < 6; i++)
    if (x[i].i != 1 || x[i].j != 2)
      abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xec6(%rip),%rsi
mov    $0x30,%edx
call   1040 <memcpy@plt>
cmpl   $0x0,-0x40(%rbp)
jne    1158 <main+0x38>
cmpl   $0x0,-0x3c(%rbp)
je     115d <main+0x3d>
call   1030 <abort@plt>
movl   $0x1,-0x44(%rbp)
cmpl   $0x6,-0x44(%rbp)
jge    11a4 <main+0x84>
movslq -0x44(%rbp),%rax
cmpl   $0x1,-0x40(%rbp,%rax,8)
jne    118c <main+0x6c>
movslq -0x44(%rbp),%rax
cmpl   $0x2,-0x3c(%rbp,%rax,8)
je     1191 <main+0x71>
call   1030 <abort@plt>
jmp    1196 <main+0x76>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1164 <main+0x44>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.anon = type { i32, i32 }
@__const.main.x = [6 x %struct.anon] [%struct.anon zeroinitializer, %struct.anon { i32 1, i32 2 }, %struct.anon { i32 1, i32 2 }, %struct.anon { i32 1, i32 2 }, %struct.anon { i32 1, i32 2 }, %struct.anon { i32 1, i32 2 }]
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x %struct.anon]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [6 x %struct.anon]* %2 to i8*
%5 = getelementptr inbounds [6 x %struct.anon], [6 x %struct.anon]* %2, i64 0, i64 0
%6 = getelementptr inbounds %struct.anon, %struct.anon* %5, i32 0, i32 0
%7 = load i32, i32* %6
%8 = icmp ne i32 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %0
%10 = getelementptr inbounds [6 x %struct.anon], [6 x %struct.anon]* %2, i64 0, i64 0
%11 = getelementptr inbounds %struct.anon, %struct.anon* %10, i32 0, i32 1
%12 = load i32, i32* %11
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %9, %0
unreachable
15: ; preds = %9
store i32 1, i32* %3
br label %16
16: ; preds = %35, %15
%17 = load i32, i32* %3
%18 = icmp slt i32 %17, 6
br i1 %18, label %19, label %38
19: ; preds = %16
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [6 x %struct.anon], [6 x %struct.anon]* %2, i64 0, i64 %21
%23 = getelementptr inbounds %struct.anon, %struct.anon* %22, i32 0, i32 0
%24 = load i32, i32* %23
%25 = icmp ne i32 %24, 1
br i1 %25, label %33, label %26
26: ; preds = %19
%27 = load i32, i32* %3
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [6 x %struct.anon], [6 x %struct.anon]* %2, i64 0, i64 %28
%30 = getelementptr inbounds %struct.anon, %struct.anon* %29, i32 0, i32 1
%31 = load i32, i32* %30
%32 = icmp ne i32 %31, 2
br i1 %32, label %33, label %34
33: ; preds = %26, %19
unreachable
34: ; preds = %26
br label %35
35: ; preds = %34
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 1
store i32 %37, i32* %3
br label %16
38: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int sumar(int a, int b) { return a + b; }


x86 assembly (clang, -O0):
<sumar>:
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):
<sumar>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @sumar(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 @sumar(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
scalar_t__ clear_caps();
int /*<<< orphan*/ xerror(char *);
void xclear_caps(void) {
  if (clear_caps() != 0)
    xerror("clear capabilities");
}


x86 assembly (clang, -O0):
<xclear_caps>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <clear_caps@plt>
cmp    $0x0,%rax
je     1141 <xclear_caps+0x21>
lea    0xec4(%rip),%rdi
call   1040 <xerror@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<xclear_caps>:
push   %rax
xor    %eax,%eax
call   1030 <clear_caps@plt>
test   %rax,%rax
je     113a <xclear_caps+0x1a>
lea    0xecc(%rip),%rdi
pop    %rax
jmp    1040 <xerror@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [19 x i8] c"clear capabilities\00"
define void @xclear_caps() {
%1 = call i64 (...) @clear_caps()
%2 = icmp ne i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @xerror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"clear capabilities\00"
define void @xclear_caps() {
%1 = tail call i64 (...) @clear_caps()
%2 = icmp eq i64 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @xerror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret void
}
int compare(const void *a, const void *b) {
  int *aa = (int *)a;
  int *bb = (int *)b;
  if (*aa > *bb)
    return 1;
  if (*aa == *bb)
    return 0;
  return -1;
}


x86 assembly (clang, -O0):
<compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jle    113a <compare+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    115f <compare+0x5f>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jne    1158 <compare+0x58>
movl   $0x0,-0x4(%rbp)
jmp    115f <compare+0x5f>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
xor    %edx,%edx
cmp    %ecx,%eax
setne  %dl
neg    %edx
cmp    %ecx,%eax
mov    $0x1,%eax
cmovle %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sgt i32 %5, %6
%8 = icmp ne i32 %5, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
unsigned short njDecode16(const unsigned char *pos) {
  return (pos[0] << 8) | pos[1];
}


x86 assembly (clang, -O0):
<njDecode16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<njDecode16>:
movzwl (%rdi),%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
define zeroext i16 @njDecode16(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 = zext i8 %5 to i32
%7 = shl i32 %6, 8
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = or i32 %7, %11
%13 = trunc i32 %12 to i16
ret i16 %13
}

LLVM IR (-O2):
define zeroext i16 @njDecode16(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i16
%4 = shl nuw i16 %3, 8
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i16
%8 = or i16 %4, %7
ret i16 %8
}
void ff_hevc_put_hevc_bi_qpel_hv12_8_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_qpel_hv12_8_sse4() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("hello world!!");
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [14 x i8] c"hello world!!\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
unsigned long TimerCapture1Get(unsigned long ulBase) {

  ;
  return (*((volatile unsigned long *)(ulBase + 0x00000034)));
}


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

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

LLVM IR (-O0):
define i64 @TimerCapture1Get(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 %3, 52
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @TimerCapture1Get(i64 %0) {
%2 = add i64 %0, 52
%3 = inttoptr i64 %2 to i64*
%4 = load volatile i64, i64* %3
ret i64 %4
}
/* Variables and functions */
int f6(int *);
int f7(int *p) { return f6(p); }


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

x86 assembly (clang, -O2):
<f7>:
jmp    1030 <f6@plt>

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

LLVM IR (-O2):
define i32 @f7(i32* %0) {
%2 = tail call i32 @f6(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void __attribute__((no)) foo(int i, const char *x) {
  if (i >= 4)
    abort();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x4(%rbp)
jl     1130 <foo+0x20>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @foo(i32 %0, i8* nocapture readnone %1) {
%3 = icmp sgt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @abort()
unreachable
6: ; preds = %2
ret void
}
/* Variables and functions */
int LINES;
int nc_LINES(void) { return LINES; }


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

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

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

LLVM IR (-O2):
@LINES = global i32 0
define i32 @nc_LINES() {
%1 = load i32, i32* @LINES
ret i32 %1
}
double id_grad(double x) { return 1.0; }


x86 assembly (clang, -O0):
<id_grad>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @id_grad(double %0) {
%2 = alloca double
store double %0, double* %2
ret double 1.000000e+00
}

LLVM IR (-O2):
define double @id_grad(double %0) {
ret double 1.000000e+00
}
int test_imm_E2int32_mem(int *val) {
  return ((*val) & (0xE2 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_E2int32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 226
%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_E2int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 226
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
long fastftol(float f) { return (long)f; }


x86 assembly (clang, -O0):
<fastftol>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
cvttss2si -0x4(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fastftol>:
cvttss2si %xmm0,%rax
ret

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

LLVM IR (-O2):
define i64 @fastftol(float %0) {
%2 = fptosi float %0 to i64
ret i64 %2
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};
typedef int int32_t;

/* Variables and functions */
int32_t time_diff_msec(struct timeval start, struct timeval end) {
  return ((end.tv_sec - start.tv_sec) * 1000 +
          (end.tv_usec - start.tv_usec) / 1000);
}


x86 assembly (clang, -O0):
<time_diff_msec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    -0x8(%rbp),%eax
imul   $0x3e8,%eax,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_diff_msec>:
mov    %rsi,%rax
sub    %edi,%esi
shr    $0x20,%rdi
shr    $0x20,%rax
imul   $0x3e8,%esi,%ecx
sub    %edi,%eax
cltq
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @time_diff_msec(i64 %0, i64 %1) {
%3 = alloca %struct.timeval
%4 = alloca %struct.timeval
%5 = bitcast %struct.timeval* %3 to i64*
store i64 %0, i64* %5
%6 = bitcast %struct.timeval* %4 to i64*
store i64 %1, i64* %6
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 0
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%10 = load i32, i32* %9
%11 = sub nsw i32 %8, %10
%12 = mul nsw i32 %11, 1000
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 1
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%16 = load i32, i32* %15
%17 = sub nsw i32 %14, %16
%18 = sdiv i32 %17, 1000
%19 = add nsw i32 %12, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @time_diff_msec(i64 %0, i64 %1) {
%3 = trunc i64 %0 to i32
%4 = lshr i64 %0, 32
%5 = trunc i64 %4 to i32
%6 = trunc i64 %1 to i32
%7 = lshr i64 %1, 32
%8 = trunc i64 %7 to i32
%9 = sub nsw i32 %6, %3
%10 = mul nsw i32 %9, 1000
%11 = sub nsw i32 %8, %5
%12 = sdiv i32 %11, 1000
%13 = add nsw i32 %12, %10
ret i32 %13
}
/* Type definitions */
struct client {
  int dummy;
};

/* Variables and functions */
struct client *get_existent_client(int);
int /*<<< orphan*/ remove_client(struct client *);
void remove_client_fd(int s) {
  struct client *c = get_existent_client(s);
  if (c != 0)
    remove_client(c);
}


x86 assembly (clang, -O0):
<remove_client_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <get_existent_client@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114b <remove_client_fd+0x2b>
mov    -0x10(%rbp),%rdi
call   1030 <remove_client@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_client_fd>:
push   %rax
call   1040 <get_existent_client@plt>
test   %rax,%rax
je     1134 <remove_client_fd+0x14>
mov    %rax,%rdi
pop    %rax
jmp    1030 <remove_client@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.client = type { i32 }
define void @remove_client_fd(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.client*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call %struct.client* @get_existent_client(i32 %4)
store %struct.client* %5, %struct.client** %3
%6 = load %struct.client*, %struct.client** %3
%7 = icmp ne %struct.client* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load %struct.client*, %struct.client** %3
%10 = call i32 @remove_client(%struct.client* %9)
br label %11
11: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
%struct.client = type { i32 }
define void @remove_client_fd(i32 %0) {
%2 = tail call %struct.client* @get_existent_client(i32 %0)
%3 = icmp eq %struct.client* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @remove_client(%struct.client* %2)
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int greater(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i = 10;
  int j = 20;
  int k = greater(i, j);
  printf("The larger value is %d\n", k);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x14,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <greater@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [24 x i8] c"The larger value is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
store i32 20, i32* %3
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = call i32 @greater(i32 %5, i32 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"The larger value is %d\0A\00"
define i32 @main() {
%1 = tail call i32 @greater(i32 10, i32 20)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int getDivisors(unsigned long);
int /*<<< orphan*/ printf(char *, unsigned long);
int main(int argc, char *argv[]) {
  int divisors = 0;
  unsigned long i = 0;
  unsigned long next = 1;
  do {
    i += next++;
    divisors = getDivisors(i);
  } while (divisors <= 500);
  printf("Result: %lu\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <getDivisors@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1f4,-0x14(%rbp)
jle    114d <main+0x2d>
mov    -0x20(%rbp),%rsi
lea    0xe78(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
xor    %r14d,%r14d
nopl   0x0(%rax)
add    %rbx,%r14
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <getDivisors@plt>
cmp    $0x1f5,%eax
jl     1130 <main+0x10>
lea    0xeb3(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"Result: %lu\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ 0, %2 ], [ %7, %3 ]
%5 = phi i64 [ 1, %2 ], [ %6, %3 ]
%6 = add i64 %5, 1
%7 = add i64 %5, %4
%8 = tail call i32 @getDivisors(i64 %7)
%9 = icmp slt i32 %8, 501
br i1 %9, label %3, label %10
10: ; preds = %3
%11 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 %7)
ret i32 0
}
/* Type definitions */
struct dns_socket {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dns_so_destroy(struct dns_socket *);
int /*<<< orphan*/ free(struct dns_socket *);
void dns_so_close(struct dns_socket *so) {
  if (!so)
    return;
  dns_so_destroy(so);
  free(so);
}


x86 assembly (clang, -O0):
<dns_so_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113c <dns_so_close+0x1c>
jmp    114e <dns_so_close+0x2e>
mov    -0x8(%rbp),%rdi
call   1040 <dns_so_destroy@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dns_so_close>:
test   %rdi,%rdi
je     1137 <dns_so_close+0x17>
push   %rbx
mov    %rdi,%rbx
call   1040 <dns_so_destroy@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
%struct.dns_socket = type { i32 }
define void @dns_so_close(%struct.dns_socket* %0) {
%2 = alloca %struct.dns_socket*
store %struct.dns_socket* %0, %struct.dns_socket** %2
%3 = load %struct.dns_socket*, %struct.dns_socket** %2
%4 = icmp ne %struct.dns_socket* %3, null
br i1 %4, label %6, label %5
5: ; preds = %1
br label %11
6: ; preds = %1
%7 = load %struct.dns_socket*, %struct.dns_socket** %2
%8 = call i32 @dns_so_destroy(%struct.dns_socket* %7)
%9 = load %struct.dns_socket*, %struct.dns_socket** %2
%10 = call i32 @free(%struct.dns_socket* %9)
br label %11
11: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
%struct.dns_socket = type { i32 }
define void @dns_so_close(%struct.dns_socket* %0) {
%2 = icmp eq %struct.dns_socket* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @dns_so_destroy(%struct.dns_socket* %0)
%5 = tail call i32 @free(%struct.dns_socket* %0)
br label %6
6: ; preds = %1, %3
ret void
}
int stuffuchar(unsigned char data, unsigned char *buffer,
               unsigned short *index) {
  buffer[*index] = data;
  *index += 1;
  return (*index);
}


x86 assembly (clang, -O0):
<stuffuchar>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x1(%rbp),%dl
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movzwl (%rcx),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
movzwl (%rax),%ecx
add    $0x1,%ecx
mov    %cx,(%rax)
mov    -0x18(%rbp),%rax
movzwl (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stuffuchar>:
movzwl (%rdx),%eax
mov    %dil,(%rsi,%rax,1)
movzwl (%rdx),%eax
add    $0x1,%eax
mov    %ax,(%rdx)
movzwl %ax,%eax
ret

LLVM IR (-O0):
define i32 @stuffuchar(i8 zeroext %0, i8* %1, i16* %2) {
%4 = alloca i8
%5 = alloca i8*
%6 = alloca i16*
store i8 %0, i8* %4
store i8* %1, i8** %5
store i16* %2, i16** %6
%7 = load i8, i8* %4
%8 = load i8*, i8** %5
%9 = load i16*, i16** %6
%10 = load i16, i16* %9
%11 = zext i16 %10 to i64
%12 = getelementptr inbounds i8, i8* %8, i64 %11
store i8 %7, i8* %12
%13 = load i16*, i16** %6
%14 = load i16, i16* %13
%15 = zext i16 %14 to i32
%16 = add nsw i32 %15, 1
%17 = trunc i32 %16 to i16
store i16 %17, i16* %13
%18 = load i16*, i16** %6
%19 = load i16, i16* %18
%20 = zext i16 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
define i32 @stuffuchar(i8 zeroext %0, i8* nocapture writeonly %1, i16* nocapture %2) {
%4 = load i16, i16* %2
%5 = zext i16 %4 to i64
%6 = getelementptr inbounds i8, i8* %1, i64 %5
store i8 %0, i8* %6
%7 = load i16, i16* %2
%8 = add i16 %7, 1
store i16 %8, i16* %2
%9 = zext i16 %8 to i32
ret i32 %9
}
/* Variables and functions */
void stub1(int, short);
void testClosureISrV(void (*closure)(int, short), int a1, short a2) {
  if (closure != NULL)
    (*closure)(a1, a2);
}


x86 assembly (clang, -O0):
<testClosureISrV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dx,%ax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %ax,-0xe(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     112e <testClosureISrV+0x2e>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%edi
movswl -0xe(%rbp),%esi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testClosureISrV>:
test   %rdi,%rdi
je     1111 <testClosureISrV+0x11>
mov    %rdi,%rax
movswl %dx,%ecx
mov    %esi,%edi
mov    %ecx,%esi
jmp    *%rax
ret

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

LLVM IR (-O2):
define void @testClosureISrV(void (i32, i16)* %0, i32 %1, i16 signext %2) {
%4 = icmp eq void (i32, i16)* %0, null
br i1 %4, label %6, label %5
5: ; preds = %3
tail call void %0(i32 %1, i16 signext %2)
br label %6
6: ; preds = %5, %3
ret void
}
/* Type definitions */
struct eembed_allocator {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(void *);
void eembed_system_free(struct eembed_allocator *ea, void *ptr) {
  (void)ea;
  free(ptr);
}


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

x86 assembly (clang, -O2):
<eembed_system_free>:
mov    %rsi,%rdi
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.eembed_allocator = type { i32 }
define void @eembed_system_free(%struct.eembed_allocator* nocapture readnone %0, i8* nocapture %1) {
%3 = tail call i32 @free(i8* %1)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int version_supported(uint32_t version) {
  if (version == 0x1 || version == 0x2 || version == 0x3 || version == 0x4 ||
      version == 0x5 || version == 0x6 || version == 0x7)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<version_supported>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     114d <version_supported+0x4d>
cmpl   $0x2,-0x8(%rbp)
je     114d <version_supported+0x4d>
cmpl   $0x3,-0x8(%rbp)
je     114d <version_supported+0x4d>
cmpl   $0x4,-0x8(%rbp)
je     114d <version_supported+0x4d>
cmpl   $0x5,-0x8(%rbp)
je     114d <version_supported+0x4d>
cmpl   $0x6,-0x8(%rbp)
je     114d <version_supported+0x4d>
cmpl   $0x7,-0x8(%rbp)
jne    1159 <version_supported+0x59>
movl   $0x1,-0x4(%rbp)
jmp    1160 <version_supported+0x60>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<version_supported>:
add    $0xffffffff,%edi
xor    %eax,%eax
cmp    $0x7,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @version_supported(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 7
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ sh_veu_init();
int sh_veu_probe(int /*<<< orphan*/, int /*<<< orphan*/);
int shveu_open(void) {
  int ret = 0;
  ret = sh_veu_probe(0, 0);
  if (ret < 0)
    return ret;
  sh_veu_init();
  return 0;
}


x86 assembly (clang, -O0):
<shveu_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
xor    %esi,%esi
mov    %esi,%edi
call   1040 <sh_veu_probe@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1150 <shveu_open+0x30>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115e <shveu_open+0x3e>
mov    $0x0,%al
call   1030 <sh_veu_init@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shveu_open>:
push   %rbx
xor    %ebx,%ebx
xor    %edi,%edi
xor    %esi,%esi
call   1040 <sh_veu_probe@plt>
test   %eax,%eax
js     1139 <shveu_open+0x19>
xor    %eax,%eax
call   1030 <sh_veu_init@plt>
jmp    113b <shveu_open+0x1b>
mov    %eax,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @shveu_open() {
%1 = tail call i32 @sh_veu_probe(i32 0, i32 0)
%2 = icmp slt i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @sh_veu_init()
br label %5
5: ; preds = %0, %3
%6 = phi i32 [ 0, %3 ], [ %1, %0 ]
ret i32 %6
}
/* Variables and functions */
int U_WMRCORENONE_get(char *);
int U_WMRAD_get(void) { return U_WMRCORENONE_get("U_WMRAD"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMRAD\00"
define i32 @U_WMRAD_get() {
%1 = call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMRAD\00"
define i32 @U_WMRAD_get() {
%1 = tail call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
char *mpfr_get_patches();
int /*<<< orphan*/ printf(char *, char const *);
void patches(void) {
  const char *p = mpfr_get_patches();
  printf("MPFR patches: %s\n", p[0] ? p : "[none]");
}


x86 assembly (clang, -O0):
<patches>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <mpfr_get_patches@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1150 <patches+0x30>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1160 <patches+0x40>
lea    0xebb(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1160 <patches+0x40>
mov    -0x10(%rbp),%rsi
lea    0xe95(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<patches>:
push   %rax
xor    %eax,%eax
call   1030 <mpfr_get_patches@plt>
cmpb   $0x0,(%rax)
lea    0xee0(%rip),%rsi
cmovne %rax,%rsi
lea    0xec3(%rip),%rdi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"MPFR patches: %s\0A\00"
@.str.1 = [7 x i8] c"[none]\00"
define void @patches() {
%1 = alloca i8*
%2 = call i8* (...) @mpfr_get_patches()
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = load i8*, i8** %1
br label %11
10: ; preds = %0
br label %11
11: ; preds = %10, %8
%12 = phi i8* [ %9, %8 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), %10 ]
%13 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %12)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"MPFR patches: %s\0A\00"
@.str.1 = [7 x i8] c"[none]\00"
define void @patches() {
%1 = tail call i8* (...) @mpfr_get_patches()
%2 = load i8, i8* %1
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
int main() {
  write(1, "arst\n", 5);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
lea    0xed5(%rip),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rsi
mov    $0x1,%edi
mov    $0x5,%edx
call   1030 <write@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"arst\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @write(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"arst\0A\00"
define i32 @main() {
%1 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
ret i32 0
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ time;
};
struct TYPE_4__ {
  TYPE_1__ xproperty;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
unsigned long get_XEvent_xproperty_time(void *_p) {
  return (unsigned long)((XEvent *)_p)->xproperty.time;
}


x86 assembly (clang, -O0):
<get_XEvent_xproperty_time>:
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_xproperty_time>:
mov    (%rdi),%rax
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i64 }
define i64 @get_XEvent_xproperty_time(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
ret i64 %7
}

LLVM IR (-O2):
define i64 @get_XEvent_xproperty_time(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
/* Variables and functions */
int five();
char *test_add_five() {
  int out = five() + five();
  do {
    if (!(out == 10))
      return "error, five + five != 10";
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_add_five>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <five@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <five@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
je     114d <test_add_five+0x3d>
lea    0xebc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    115a <test_add_five+0x4a>
jmp    1152 <test_add_five+0x42>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_add_five>:
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <five@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <five@plt>
add    %ebp,%eax
cmp    $0xa,%eax
lea    0xecf(%rip),%rax
cmovne %rax,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [25 x i8] c"error, five + five != 10\00"
define i8* @test_add_five() {
%1 = tail call i32 (...) @five()
%2 = tail call i32 (...) @five()
%3 = add nsw i32 %2, %1
%4 = icmp eq i32 %3, 10
%5 = select i1 %4, i8* null, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0)
ret i8* %5
}