xunge/DecIR huggingface dataset:
int declen(int n) {
  if (n == 0)
    return 1;
  int c = 0;
  if (n < 0) {
    c++;
    n = -n;
  }
  for (; n > 0; n /= 10)
    c++;
  return c;
}


x86 assembly (clang, -O0):
<declen>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <declen+0x1d>
movl   $0x1,-0x4(%rbp)
jmp    1170 <declen+0x70>
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    113f <declen+0x3f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <declen+0x44>
cmpl   $0x0,-0x8(%rbp)
jle    116a <declen+0x6a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1144 <declen+0x44>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<declen>:
test   %edi,%edi
je     1135 <declen+0x35>
mov    %edi,%eax
shr    $0x1f,%eax
mov    %edi,%ecx
neg    %ecx
cmovs  %edi,%ecx
mov    $0xcccccccd,%edx
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
mov    %ecx,%esi
imul   %rdx,%rsi
shr    $0x23,%rsi
cmp    $0x9,%ecx
mov    %esi,%ecx
ja     1120 <declen+0x20>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @declen(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = lshr i32 %0, 31
%5 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
br label %6
6: ; preds = %3, %6
%7 = phi i32 [ %9, %6 ], [ %4, %3 ]
%8 = phi i32 [ %10, %6 ], [ %5, %3 ]
%9 = add nuw nsw i32 %7, 1
%10 = udiv i32 %8, 10
%11 = icmp ult i32 %8, 10
br i1 %11, label %12, label %6
12: ; preds = %6, %1
%13 = phi i32 [ 1, %1 ], [ %9, %6 ]
ret i32 %13
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef scalar_t__ int8_t;

/* Variables and functions */
float Int8ToFloat_SNORM(const uint8_t input) {
  return (float)((int8_t)input) / 127.0f;
}


x86 assembly (clang, -O0):
<Int8ToFloat_SNORM>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cvtsi2ssq -0x8(%rbp),%xmm0
movss  0xeea(%rip),%xmm1
divss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Int8ToFloat_SNORM>:
cvtsi2ss %rdi,%xmm0
divss  0xef3(%rip),%xmm0
ret

LLVM IR (-O0):
define float @Int8ToFloat_SNORM(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = sitofp i64 %3 to float
%5 = fdiv float %4, 1.270000e+02
ret float %5
}

LLVM IR (-O2):
define float @Int8ToFloat_SNORM(i64 %0) {
%2 = sitofp i64 %0 to float
%3 = fdiv float %2, 1.270000e+02
ret float %3
}
void webif_close(void) {}


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

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

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

LLVM IR (-O2):
define void @webif_close() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ R(int *, int);
void R_r(int *a, int r) { R(a, 1); }


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

x86 assembly (clang, -O2):
<R_r>:
mov    $0x1,%esi
jmp    1030 <R@plt>

LLVM IR (-O0):
define void @R_r(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 = call i32 @R(i32* %5, i32 1)
ret void
}

LLVM IR (-O2):
define void @R_r(i32* %0, i32 %1) {
%3 = tail call i32 @R(i32* %0, i32 1)
ret void
}
/* Variables and functions */
char *strtok_r(char *, char const *, char **);
char *strtok(char *s, const char *delim) {
  static char *lasts;
  return strtok_r(s, delim, &lasts);
}


x86 assembly (clang, -O0):
<strtok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    0x2f01(%rip),%rdx
call   1030 <strtok_r@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtok>:
lea    0x2f19(%rip),%rdx
jmp    1030 <strtok_r@plt>

LLVM IR (-O0):
@strtok.lasts = internal global i8* null
define i8* @strtok(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i8* @strtok_r(i8* %5, i8* %6, i8** @strtok.lasts)
ret i8* %7
}

LLVM IR (-O2):
@strtok.lasts = internal global i8* null
define i8* @strtok(i8* %0, i8* nocapture %1) {
%3 = tail call i8* @strtok_r(i8* %0, i8* %1, i8** @strtok.lasts)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ EX_USAGE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void emit_help(void) {
  fputs("Usage: getsockname [-4 | -6] [-s] [-u] host port\n", stderr);
  exit(EX_USAGE);
}


x86 assembly (clang, -O0):
<emit_help>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
lea    0xecc(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<emit_help>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"Usage: getsockname [-4 | -6] [-s] [-u] host port\0A\00"
@stderr = global i32 0
@EX_USAGE = global i32 0
define void @emit_help() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EX_USAGE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@.str = [50 x i8] c"Usage: getsockname [-4 | -6] [-s] [-u] host port\0A\00"
@stderr = global i32 0
@EX_USAGE = global i32 0
define void @emit_help() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EX_USAGE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
void posix_class2P_UPPER() {}


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

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

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

LLVM IR (-O2):
define void @posix_class2P_UPPER() {
ret void
}
/* Variables and functions */
int gleIntLoadCore_1_5_Version_3_1();
int gleIntLoadCore_1_5_Base() {
  int bIsLoaded = gleIntLoadCore_1_5_Version_3_1();
  return bIsLoaded;
}


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

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

LLVM IR (-O0):
define i32 @gleIntLoadCore_1_5_Base() {
%1 = alloca i32
%2 = call i32 (...) @gleIntLoadCore_1_5_Version_3_1()
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @gleIntLoadCore_1_5_Base() {
%1 = tail call i32 (...) @gleIntLoadCore_1_5_Version_3_1()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ pause();
int /*<<< orphan*/ printf(char *, int);
short main() {
  short ret;
  void *p;
  short i = 1;
  printf("sizeof(int)"
         " %d\n",
         (sizeof(short)));
  pause();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movw   $0x1,-0x12(%rbp)
lea    0xecb(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <pause@plt>
xor    %eax,%eax
cwtl
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [16 x i8] c"sizeof(int) %d\0A\00"
define signext i16 @main() {
%1 = alloca i16
%2 = alloca i8*
%3 = alloca i16
store i16 1, i16* %3
%4 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 2)
%5 = call i32 (...) @pause()
ret i16 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"sizeof(int) %d\0A\00"
define signext i16 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 2)
%2 = tail call i32 (...) @pause()
ret i16 0
}
/* Variables and functions */
int /*<<< orphan*/ SIGKILL;
int /*<<< orphan*/ kill(int, int /*<<< orphan*/);
void kill_process(int pid) { kill(pid, SIGKILL); }


x86 assembly (clang, -O0):
<kill_process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
call   1030 <kill@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kill_process>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
jmp    1030 <kill@plt>

LLVM IR (-O0):
@SIGKILL = global i32 0
define void @kill_process(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGKILL
%5 = call i32 @kill(i32 %3, i32 %4)
ret void
}

LLVM IR (-O2):
@SIGKILL = global i32 0
define void @kill_process(i32 %0) {
%2 = load i32, i32* @SIGKILL
%3 = tail call i32 @kill(i32 %0, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ platform_set_tls_base(int /*<<< orphan*/);
__attribute__((always_)) void crt_init_tls(void) {
  (void)platform_set_tls_base(0);
}


x86 assembly (clang, -O0):
<crt_init_tls>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <platform_set_tls_base@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<crt_init_tls>:
xor    %edi,%edi
jmp    1030 <platform_set_tls_base@plt>

LLVM IR (-O0):
define void @crt_init_tls() {
%1 = call i32 @platform_set_tls_base(i32 0)
ret void
}

LLVM IR (-O2):
define void @crt_init_tls() {
%1 = tail call i32 @platform_set_tls_base(i32 0)
ret void
}
int sum(int n) {
  int sum = 0;
  for (int i = 0; i < n; i++)
    sum += i;
  return sum;
}


x86 assembly (clang, -O0):
<sum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1138 <sum+0x38>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <sum+0x15>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum>:
test   %edi,%edi
jle    1118 <sum+0x18>
lea    -0x1(%rdi),%eax
lea    -0x2(%rdi),%ecx
imul   %rax,%rcx
shr    %rcx
lea    (%rcx,%rdi,1),%eax
add    $0xffffffff,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @sum(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %13
3: ; preds = %1
%4 = add nsw i32 %0, -1
%5 = zext i32 %4 to i33
%6 = add nsw i32 %0, -2
%7 = zext i32 %6 to i33
%8 = mul i33 %5, %7
%9 = lshr i33 %8, 1
%10 = trunc i33 %9 to i32
%11 = add i32 %10, %0
%12 = add i32 %11, -1
br label %13
13: ; preds = %3, %1
%14 = phi i32 [ 0, %1 ], [ %12, %3 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ f5();
void f4() { f5(); }


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

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

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

LLVM IR (-O2):
define void @f4() {
%1 = tail call i32 (...) @f5()
ret void
}
/* Variables and functions */
int fact(int);
int /*<<< orphan*/ printn(int);
void main() {
  int x;
  x = fact(6);
  printn(x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x6,%edi
call   1040 <fact@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <printn@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x6,%edi
call   1040 <fact@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <printn@plt>

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = call i32 @fact(i32 6)
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @printn(i32 %3)
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @fact(i32 6)
%2 = tail call i32 @printn(i32 %1)
ret void
}
/* Variables and functions */
int func_in_foo();
int main(int argc, char **argv) { return func_in_foo(); }


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)
mov    $0x0,%al
call   1030 <func_in_foo@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
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 (...) @func_in_foo()
ret i32 %6
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @func_in_foo()
ret i32 %3
}
unsigned int f2u1(double x) {
  union {
    double f;
    unsigned int u[2];
  } cvt;
  cvt.f = x;
  return cvt.u[1];
}


x86 assembly (clang, -O0):
<f2u1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2u1>:
movq   %xmm0,%rax
shr    $0x20,%rax
ret

LLVM IR (-O0):
%union.anon = type { double }
define i32 @f2u1(double %0) {
%2 = alloca double
%3 = alloca %union.anon
store double %0, double* %2
%4 = load double, double* %2
%5 = bitcast %union.anon* %3 to double*
store double %4, double* %5
%6 = bitcast %union.anon* %3 to [2 x i32]*
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%8 = load i32, i32* %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @f2u1(double %0) {
%2 = bitcast double %0 to i64
%3 = lshr i64 %2, 32
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
int setsockopt(int, int, int, char *, int);
int SetSockOpt(int fd, int level, int option, int yesno) {
  return setsockopt(fd, level, option, (char *)&yesno, sizeof yesno);
}


x86 assembly (clang, -O0):
<SetSockOpt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    -0x10(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetSockOpt>:
push   %rax
mov    %ecx,0x4(%rsp)
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @SetSockOpt(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = bitcast i32* %8 to i8*
%13 = call i32 @setsockopt(i32 %9, i32 %10, i32 %11, i8* %12, i32 4)
ret i32 %13
}

LLVM IR (-O2):
define i32 @SetSockOpt(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
store i32 %3, i32* %5
%6 = bitcast i32* %5 to i8*
%7 = call i32 @setsockopt(i32 %0, i32 %1, i32 %2, i8* %6, i32 4)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ usleep(unsigned long);
void sleep_msec(unsigned long msec) { usleep(msec * 1000); }


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

x86 assembly (clang, -O2):
<sleep_msec>:
imul   $0x3e8,%rdi,%rdi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @sleep_msec(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = mul i64 %3, 1000
%5 = call i32 @usleep(i64 %4)
ret void
}

LLVM IR (-O2):
define void @sleep_msec(i64 %0) {
%2 = mul i64 %0, 1000
%3 = tail call i32 @usleep(i64 %2)
ret void
}
/* Variables and functions */
bool ptr_is_aligned(void *p) {
  uintptr_t x;
  x = (uintptr_t)p;
  return (x & (uintptr_t)7) == 0;
}


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

x86 assembly (clang, -O2):
<ptr_is_aligned>:
xor    %eax,%eax
test   $0x7,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @ptr_is_aligned(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = ptrtoint i8* %4 to i64
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = and i64 %6, 7
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @ptr_is_aligned(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = and i64 %2, 7
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
struct sysinfo {
  int dummy;
};

/* Variables and functions */
int sysinfo(struct sysinfo *);
int main(void) {
  struct sysinfo info;
  return sysinfo(&info);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %rsp,%rdi
call   1030 <sysinfo@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.sysinfo = type { i32 }
define i32 @main() {
%1 = alloca %struct.sysinfo
%2 = bitcast %struct.sysinfo* %1 to i8*
%3 = call i32 @sysinfo(%struct.sysinfo* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ DeinitFields();
void SwitchFrom_TMS7(void) { DeinitFields(); }


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

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

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

LLVM IR (-O2):
define void @SwitchFrom_TMS7() {
%1 = tail call i32 (...) @DeinitFields()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cfree(char *);
scalar_t__ cmalloc(int);
int /*<<< orphan*/ init();
int /*<<< orphan*/ scanf(char *, char *);
int do1() {
  int i = 0;
  init();
  char *a = (char *)cmalloc(sizeof(char) * 256);
  char *b = (char *)cmalloc(sizeof(char) * 256);
  scanf("%s", a);
  cfree(b);
}


x86 assembly (clang, -O0):
<do1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <init@plt>
mov    $0x100,%edi
call   1040 <cmalloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x100,%edi
call   1040 <cmalloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe83(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x18(%rbp),%rdi
call   1060 <cfree@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do1>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <init@plt>
mov    $0x100,%edi
call   1040 <cmalloc@plt>
mov    %rax,%r14
mov    $0x100,%edi
call   1040 <cmalloc@plt>
mov    %rax,%rbx
lea    0xe94(%rip),%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <cfree@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @do1() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %2
%5 = call i32 (...) @init()
%6 = call i64 @cmalloc(i32 256)
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %3
%8 = call i64 @cmalloc(i32 256)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %4
%10 = load i8*, i8** %3
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i8*, i8** %4
%13 = call i32 @cfree(i8* %12)
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @do1() {
%1 = tail call i32 (...) @init()
%2 = tail call i64 @cmalloc(i32 256)
%3 = inttoptr i64 %2 to i8*
%4 = tail call i64 @cmalloc(i32 256)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%7 = tail call i32 @cfree(i8* %5)
ret i32 undef
}
void startMjpgStreamer(int width, int height, int port) {}


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

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

LLVM IR (-O0):
define void @startMjpgStreamer(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret void
}

LLVM IR (-O2):
define void @startMjpgStreamer(i32 %0, i32 %1, i32 %2) {
ret void
}
void *front_imp() {}


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

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

LLVM IR (-O0):
define i8* @front_imp() {
%1 = alloca i8*
%2 = load i8*, i8** %1
ret i8* %2
}

LLVM IR (-O2):
define noalias i8* @front_imp() {
ret i8* undef
}
/* Variables and functions */
long atoi(char *);
int /*<<< orphan*/ no_dead_local_store();
int main(int argc, char *argv[]) {
  long i, n;
  n = atoi(argv[1]);
  for (i = 0; i < n; i++)
    no_dead_local_store();
  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    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    1175 <main+0x55>
mov    $0x0,%al
call   1030 <no_dead_local_store@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    114f <main+0x2f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
test   %rax,%rax
jle    114d <main+0x2d>
mov    %rax,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <no_dead_local_store@plt>
add    $0xffffffffffffffff,%rbx
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
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 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i64 @atoi(i8* %10)
store i64 %11, i64* %7
store i64 0, i64* %6
br label %12
12: ; preds = %18, %2
%13 = load i64, i64* %6
%14 = load i64, i64* %7
%15 = icmp slt i64 %13, %14
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = call i32 (...) @no_dead_local_store()
br label %18
18: ; preds = %16
%19 = load i64, i64* %6
%20 = add nsw i64 %19, 1
store i64 %20, i64* %6
br label %12
21: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i64 @atoi(i8* %4)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %2, %7
%8 = phi i64 [ %10, %7 ], [ 0, %2 ]
%9 = tail call i32 (...) @no_dead_local_store()
%10 = add nuw nsw i64 %8, 1
%11 = icmp eq i64 %10, %5
br i1 %11, label %12, label %7
12: ; preds = %7, %2
ret i32 0
}
/* Variables and functions */
int Bsearch(int *, int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int ara[6] = {1, 3, 4, 6, 8, 10};
  int index = Bsearch(ara, 6, 10);
  printf("%d\n", index);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x6,%esi
mov    $0xa,%edx
call   1030 <Bsearch@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xee5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x6,%esi
mov    $0xa,%edx
call   1030 <Bsearch@plt>
lea    0xec4(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.ara = [6 x i32] [i32 1, i32 3, i32 4, i32 6, i32 8, i32 10]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [6 x i32]* %2 to i8*
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%6 = call i32 @Bsearch(i32* %5, i32 6, i32 10)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@__const.main.ara = [6 x i32] [i32 1, i32 3, i32 4, i32 6, i32 8, i32 10]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%4 = call i32 @Bsearch(i32* %3, i32 6, i32 10)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ xmemcpy(char *, char const *, size_t);
size_t xstrlen(char const *);
char *xstrdup(const char *str) {
  size_t len = xstrlen(str);
  char *dup = (char *)malloc(sizeof(char) * (len + 1));
  xmemcpy(dup, str, len);
  dup[len] = 0;
  return dup;
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <xstrlen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <xmemcpy@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1050 <xstrlen@plt>
mov    %rax,%r15
lea    0x1(%rax),%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <xmemcpy@plt>
movb   $0x0,(%rbx,%r15,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @xstrlen(i8* %5)
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = add i64 %7, 1
%9 = mul i64 1, %8
%10 = trunc i64 %9 to i32
%11 = call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to i8*
store i8* %12, i8** %4
%13 = load i8*, i8** %4
%14 = load i8*, i8** %2
%15 = load i64, i64* %3
%16 = call i32 @xmemcpy(i8* %13, i8* %14, i64 %15)
%17 = load i8*, i8** %4
%18 = load i64, i64* %3
%19 = getelementptr inbounds i8, i8* %17, i64 %18
store i8 0, i8* %19
%20 = load i8*, i8** %4
ret i8* %20
}

LLVM IR (-O2):
define i8* @xstrdup(i8* %0) {
%2 = tail call i64 @xstrlen(i8* %0)
%3 = trunc i64 %2 to i32
%4 = add i32 %3, 1
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to i8*
%7 = tail call i32 @xmemcpy(i8* %6, i8* %0, i64 %2)
%8 = getelementptr inbounds i8, i8* %6, i64 %2
store i8 0, i8* %8
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int main(void) {
  float f = (float)1 / (float)10;
  printf("%0.1f\n", f);
}


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

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"%0.1f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), float 0x3FB99999A0000000)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void pb(char *s, int o) { printf("%02x", 255 & *(char *)((int)s + o)); }


x86 assembly (clang, -O0):
<pb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    -0xc(%rbp),%eax
cltq
movsbl (%rax),%esi
and    $0xff,%esi
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pb>:
movslq %edi,%rax
movslq %esi,%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xedf(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%02x\00"
define void @pb(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 = ptrtoint i8* %5 to i32
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = and i32 255, %12
%14 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %13)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%02x\00"
define void @pb(i8* %0, i32 %1) {
%3 = ptrtoint i8* %0 to i64
%4 = trunc i64 %3 to i32
%5 = add nsw i32 %4, %1
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %9)
ret void
}
/* Type definitions */
struct hiena_svc {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct hiena_svc *);
void hiena_svc_cleanup(struct hiena_svc *svc) {
  if (svc != NULL) {
    free(svc);
  }
}


x86 assembly (clang, -O0):
<hiena_svc_cleanup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <hiena_svc_cleanup+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hiena_svc_cleanup>:
test   %rdi,%rdi
je     111a <hiena_svc_cleanup+0xa>
jmp    1030 <free@plt>
ret

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

LLVM IR (-O2):
%struct.hiena_svc = type { i32 }
define void @hiena_svc_cleanup(%struct.hiena_svc* %0) {
%2 = icmp eq %struct.hiena_svc* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(%struct.hiena_svc* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
double M2z_z(double, double, double, double);
double M3y_z(double sign, double xi, double et, double qq) {
  return M2z_z(sign, xi, et, qq);
}


x86 assembly (clang, -O0):
<M3y_z>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
call   1030 <M2z_z@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M3y_z>:
jmp    1030 <M2z_z@plt>

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

LLVM IR (-O2):
define double @M3y_z(double %0, double %1, double %2, double %3) {
%5 = tail call double @M2z_z(double %0, double %1, double %2, double %3)
ret double %5
}
void fnvArith128mul(struct Arith128 *kOut, const struct Arith128 *kIn) {
  *((__uint128_t *)kOut) *= *((__uint128_t *)kIn);
}


x86 assembly (clang, -O0):
<fnvArith128mul>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    0x8(%rax),%rcx
mov    -0x8(%rbp),%rdx
mov    %rdx,-0x20(%rbp)
mov    (%rdx),%rax
mov    0x8(%rdx),%rsi
mov    %rax,%r8
imul   %rcx,%r8
mul    %rdi
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,-0x18(%rbp)
mov    %rdx,%rcx
mov    -0x18(%rbp),%rdx
add    %r8,%rcx
imul   %rdi,%rsi
add    %rsi,%rcx
mov    %rdx,(%rax)
mov    %rcx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnvArith128mul>:
mov    (%rsi),%rcx
mov    (%rdi),%rax
mov    0x8(%rsi),%rsi
imul   %rax,%rsi
mul    %rcx
imul   0x8(%rdi),%rcx
add    %rsi,%rdx
add    %rdx,%rcx
mov    %rax,(%rdi)
mov    %rcx,0x8(%rdi)
ret

LLVM IR (-O0):
%struct.Arith128 = type opaque
define void @fnvArith128mul(%struct.Arith128* %0, %struct.Arith128* %1) {
%3 = alloca %struct.Arith128*
%4 = alloca %struct.Arith128*
store %struct.Arith128* %0, %struct.Arith128** %3
store %struct.Arith128* %1, %struct.Arith128** %4
%5 = load %struct.Arith128*, %struct.Arith128** %4
%6 = bitcast %struct.Arith128* %5 to i128*
%7 = load i128, i128* %6
%8 = load %struct.Arith128*, %struct.Arith128** %3
%9 = bitcast %struct.Arith128* %8 to i128*
%10 = load i128, i128* %9
%11 = mul i128 %10, %7
store i128 %11, i128* %9
ret void
}

LLVM IR (-O2):
%struct.Arith128 = type opaque
define void @fnvArith128mul(%struct.Arith128* nocapture %0, %struct.Arith128* nocapture %1) {
%3 = bitcast %struct.Arith128* %1 to i128*
%4 = load i128, i128* %3
%5 = bitcast %struct.Arith128* %0 to i128*
%6 = load i128, i128* %5
%7 = mul i128 %6, %4
store i128 %7, i128* %5
ret void
}
/* Variables and functions */
double stb_rand();
double stb_frand(void) { return stb_rand() / ((double)(1 << 16) * (1 << 16)); }


x86 assembly (clang, -O0):
<stb_frand>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <stb_rand@plt>
movsd  0xedd(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<stb_frand>:
push   %rax
xor    %eax,%eax
call   1030 <stb_rand@plt>
mulsd  0xee0(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @stb_frand() {
%1 = call double (...) @stb_rand()
%2 = fdiv double %1, 0x41F0000000000000
ret double %2
}

LLVM IR (-O2):
define double @stb_frand() {
%1 = tail call double (...) @stb_rand()
%2 = fmul double %1, 0x3DF0000000000000
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int pthread_self();
void *thread_func_dummy(void *args) {
  printf("Running thread %d...\n", pthread_self());
  return NULL;
}


x86 assembly (clang, -O0):
<thread_func_dummy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    %eax,%esi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_func_dummy>:
push   %rax
xor    %eax,%eax
call   1040 <pthread_self@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [22 x i8] c"Running thread %d...\0A\00"
define noalias i8* @thread_func_dummy(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @pthread_self()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i8* null
}
double difficultyRating(void) { return 4.0; }


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

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

LLVM IR (-O0):
define double @difficultyRating() {
ret double 4.000000e+00
}

LLVM IR (-O2):
define double @difficultyRating() {
ret double 4.000000e+00
}
main() {
  struct {
    int a, b, c;
  } a;
  a.a = 1;
  a.b = 2;
  a.c = 3;
  return f(&a) == 3 ? 0 : 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x2,-0xc(%rbp)
movl   $0x3,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <f@plt>
mov    %eax,%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x3,%edx
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movabs $0x200000001,%rax
mov    %rax,0x8(%rsp)
movl   $0x3,0x10(%rsp)
lea    0x8(%rsp),%rdi
xor    %eax,%eax
call   1030 <f@plt>
xor    %ecx,%ecx
cmp    $0x3,%eax
setne  %cl
mov    %ecx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.anon = type { i32, i32, i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.anon
store i32 0, i32* %1
%3 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 0
store i32 1, i32* %3
%4 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 1
store i32 2, i32* %4
%5 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 2
store i32 3, i32* %5
%6 = call i32 (%struct.anon*, ...) bitcast (i32 (...)* @f to i32 (%struct.anon*, ...)*)(%struct.anon* %2)
%7 = icmp eq i32 %6, 3
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 0, i32 1
ret i32 %9
}

LLVM IR (-O2):
%struct.anon = type { i32, i32, i32 }
define i32 @main() {
%1 = alloca %struct.anon
%2 = bitcast %struct.anon* %1 to i8*
%3 = getelementptr inbounds %struct.anon, %struct.anon* %1, i64 0, i32 0
store i32 1, i32* %3
%4 = getelementptr inbounds %struct.anon, %struct.anon* %1, i64 0, i32 1
store i32 2, i32* %4
%5 = getelementptr inbounds %struct.anon, %struct.anon* %1, i64 0, i32 2
store i32 3, i32* %5
%6 = call i32 (%struct.anon*, ...) bitcast (i32 (...)* @f to i32 (%struct.anon*, ...)*)(%struct.anon* %1)
%7 = icmp ne i32 %6, 3
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
char *ltrim2(int /*<<< orphan*/);
int /*<<< orphan*/ rtrim2(char *);
char *trim(char *str) { return ltrim2(rtrim2(str)); }


x86 assembly (clang, -O0):
<trim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <rtrim2@plt>
mov    %eax,%edi
call   1040 <ltrim2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trim>:
push   %rax
call   1030 <rtrim2@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <ltrim2@plt>

LLVM IR (-O0):
define i8* @trim(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @rtrim2(i8* %3)
%5 = call i8* @ltrim2(i32 %4)
ret i8* %5
}

LLVM IR (-O2):
define i8* @trim(i8* %0) {
%2 = tail call i32 @rtrim2(i8* %0)
%3 = tail call i8* @ltrim2(i32 %2)
ret i8* %3
}
int read(f, b, l)
char *b;
{ return (0); }


x86 assembly (clang, -O0):
<read>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @read(i32 %0, i8* nocapture readnone %1, i32 %2) {
ret i32 0
}
/* Type definitions */
struct list_head {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ INIT_LIST_HEAD(struct list_head *);
int /*<<< orphan*/ list_replace(struct list_head *, struct list_head *);
void list_replace_init(struct list_head *old, struct list_head *nelm) {
  list_replace(old, nelm);
  INIT_LIST_HEAD(old);
}


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

x86 assembly (clang, -O2):
<list_replace_init>:
push   %rbx
mov    %rdi,%rbx
call   1040 <list_replace@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <INIT_LIST_HEAD@plt>

LLVM IR (-O0):
%struct.list_head = type { i32 }
define void @list_replace_init(%struct.list_head* %0, %struct.list_head* %1) {
%3 = alloca %struct.list_head*
%4 = alloca %struct.list_head*
store %struct.list_head* %0, %struct.list_head** %3
store %struct.list_head* %1, %struct.list_head** %4
%5 = load %struct.list_head*, %struct.list_head** %3
%6 = load %struct.list_head*, %struct.list_head** %4
%7 = call i32 @list_replace(%struct.list_head* %5, %struct.list_head* %6)
%8 = load %struct.list_head*, %struct.list_head** %3
%9 = call i32 @INIT_LIST_HEAD(%struct.list_head* %8)
ret void
}

LLVM IR (-O2):
%struct.list_head = type { i32 }
define void @list_replace_init(%struct.list_head* %0, %struct.list_head* %1) {
%3 = tail call i32 @list_replace(%struct.list_head* %0, %struct.list_head* %1)
%4 = tail call i32 @INIT_LIST_HEAD(%struct.list_head* %0)
ret void
}
void ff_hevc_put_hevc_uni_qpel_v12_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_qpel_v12_12_sse4() {
ret void
}
void dobro(int *A, int *B) {
  *A *= 2;
  *B *= 2;
}


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

x86 assembly (clang, -O2):
<dobro>:
shll   (%rdi)
shll   (%rsi)
ret

LLVM IR (-O0):
define void @dobro(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %5
%7 = mul nsw i32 %6, 2
store i32 %7, i32* %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = mul nsw i32 %9, 2
store i32 %10, i32* %8
ret void
}

LLVM IR (-O2):
define void @dobro(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = shl nsw i32 %3, 1
store i32 %4, i32* %0
%5 = load i32, i32* %1
%6 = shl nsw i32 %5, 1
store i32 %6, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int a[10] = {1, 2}, *pa = a;
  printf("a : %d \n", a[3]);
  printf("test\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
movl   $0x1,-0x30(%rbp)
movl   $0x2,-0x2c(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x24(%rbp),%esi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [9 x i8] c"a : %d \0A\00"
@.str.1 = [6 x i8] c"test\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32*
store i32 0, i32* %1
%4 = bitcast [10 x i32]* %2 to i8*
%5 = bitcast i8* %4 to <{ i32, i32, [8 x i32] }>*
%6 = getelementptr inbounds <{ i32, i32, [8 x i32] }>, <{ i32, i32, [8 x i32] }>* %5, i32 0, i32 0
store i32 1, i32* %6
%7 = getelementptr inbounds <{ i32, i32, [8 x i32] }>, <{ i32, i32, [8 x i32] }>* %5, i32 0, i32 1
store i32 2, i32* %7
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
store i32* %8, i32** %3
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 3
%10 = load i32, i32* %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"a : %d \0A\00"
@str = [5 x i8] c"test\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 0)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}