xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void int_dump(int *n) { printf("%d\n", *n); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @int_dump(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
void zero(float v[], int k) {
  int i;
  for (i = 0; i < k; i++)
    v[i] = 0.0;
}


x86 assembly (clang, -O0):
<zero>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113c <zero+0x3c>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <zero+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<zero>:
test   %esi,%esi
jle    1126 <zero+0x16>
push   %rax
mov    %esi,%edx
shl    $0x2,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @zero(float* %0, i32 %1) {
%3 = alloca float*
%4 = alloca i32
%5 = alloca i32
store float* %0, float** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %15, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = load float*, float** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds float, float* %11, i64 %13
store float 0.000000e+00, float* %14
br label %15
15: ; preds = %10
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
store i32 %17, i32* %5
br label %6
18: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @zero(float* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = bitcast float* %0 to i8*
%6 = zext i32 %1 to i64
%7 = shl nuw nsw i64 %6, 2
br label %8
8: ; preds = %4, %2
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ bit_swap(int *, int *);
int /*<<< orphan*/ printf(char *, int, int);
int main(void) {
  int a = 10;
  int b = 20;
  printf("before swapping - a = %d, b = %d\n", a, b);
  bit_swap(&a, &b);
  printf(" after swapping - a = %d, b = %d\n", a, b);
  return (EXIT_SUCCESS);
}


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),%esi
mov    -0xc(%rbp),%edx
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <bit_swap@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0xa,0x4(%rsp)
movl   $0x14,(%rsp)
lea    0xec9(%rip),%rdi
mov    $0xa,%esi
mov    $0x14,%edx
call   1030 <printf@plt>
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1040 <bit_swap@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e73(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"before swapping - a = %d, b = %d\0A\00"
@.str.1 = [34 x i8] c" after swapping - a = %d, b = %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
store i32 20, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5)
%7 = call i32 @bit_swap(i32* %2, i32* %3)
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %8, i32 %9)
%11 = load i32, i32* @EXIT_SUCCESS
ret i32 %11
}

LLVM IR (-O2):
@.str = [34 x i8] c"before swapping - a = %d, b = %d\0A\00"
@.str.1 = [34 x i8] c" after swapping - a = %d, b = %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 10, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 20, i32* %2
%5 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 10, i32 20)
%6 = call i32 @bit_swap(i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %8)
%10 = load i32, i32* @EXIT_SUCCESS
ret i32 %10
}
/* Variables and functions */
int longestNonDecSeq(int *, int);
int /*<<< orphan*/ printf(char *, int);
void testLongestNonDecSeq() {
  int xs[] = {5, 3, 4, 8, 6, 7, 8, 8, 9, 4, 3, 1, 2, 3, 4};
  int size = 15;
  printf("Length of longest non-decreasing sequence = %d\n",
         longestNonDecSeq(xs, size));
}


x86 assembly (clang, -O0):
<testLongestNonDecSeq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x40(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x3c,%edx
call   1050 <memcpy@plt>
movl   $0xf,-0x44(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1030 <longestNonDecSeq@plt>
mov    %eax,%esi
lea    0xed3(%rip),%rdi
call   1040 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testLongestNonDecSeq>:
sub    $0x48,%rsp
movups 0xf01(%rip),%xmm0
movups %xmm0,0x2c(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xf,%esi
call   1030 <longestNonDecSeq@plt>
lea    0xed5(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
add    $0x48,%rsp
ret

LLVM IR (-O0):
@__const.testLongestNonDecSeq.xs = [15 x i32] [i32 5, i32 3, i32 4, i32 8, i32 6, i32 7, i32 8, i32 8, i32 9, i32 4, i32 3, i32 1, i32 2, i32 3, i32 4]
@.str = [48 x i8] c"Length of longest non-decreasing sequence = %d\0A\00"
define void @testLongestNonDecSeq() {
%1 = alloca [15 x i32]
%2 = alloca i32
%3 = bitcast [15 x i32]* %1 to i8*
store i32 15, i32* %2
%4 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @longestNonDecSeq(i32* %4, i32 %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@__const.testLongestNonDecSeq.xs = [15 x i32] [i32 5, i32 3, i32 4, i32 8, i32 6, i32 7, i32 8, i32 8, i32 9, i32 4, i32 3, i32 1, i32 2, i32 3, i32 4]
@.str = [48 x i8] c"Length of longest non-decreasing sequence = %d\0A\00"
define void @testLongestNonDecSeq() {
%1 = alloca [15 x i32]
%2 = bitcast [15 x i32]* %1 to i8*
%3 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 0
%4 = call i32 @longestNonDecSeq(i32* %3, i32 15)
%5 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ num;

/* Variables and functions */
int /*<<< orphan*/ SwapWord(char *, int);
unsigned int little2bigui(unsigned int num) {
  SwapWord((char *)&num, sizeof(num));
  return num;
}


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

x86 assembly (clang, -O2):
<little2bigui>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
call   1030 <SwapWord@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @little2bigui(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = bitcast i32* %2 to i8*
%4 = call i32 @SwapWord(i8* %3, i32 4)
%5 = load i32, i32* %2
ret i32 %5
}

LLVM IR (-O2):
define i32 @little2bigui(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = bitcast i32* %2 to i8*
%4 = call i32 @SwapWord(i8* %3, i32 4)
%5 = load i32, i32* %2
ret i32 %5
}
/* Variables and functions */
int baz();
int foobar();
int foo(int a) {
  if (a == 16)
    return foobar() + 9;
  return baz();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x10,-0x8(%rbp)
jne    1147 <foo+0x27>
mov    $0x0,%al
call   1040 <foobar@plt>
add    $0x9,%eax
mov    %eax,-0x4(%rbp)
jmp    1151 <foo+0x31>
mov    $0x0,%al
call   1030 <baz@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
cmp    $0x10,%edi
jne    1132 <foo+0x12>
push   %rax
xor    %eax,%eax
call   1040 <foobar@plt>
add    $0x9,%eax
pop    %rcx
ret
xor    %eax,%eax
jmp    1030 <baz@plt>

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 16
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = call i32 (...) @foobar()
%8 = add nsw i32 %7, 9
store i32 %8, i32* %2
br label %11
9: ; preds = %1
%10 = call i32 (...) @baz()
store i32 %10, i32* %2
br label %11
11: ; preds = %9, %6
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = icmp eq i32 %0, 16
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 (...) @foobar()
%5 = add nsw i32 %4, 9
br label %8
6: ; preds = %1
%7 = tail call i32 (...) @baz()
br label %8
8: ; preds = %6, %3
%9 = phi i32 [ %5, %3 ], [ %7, %6 ]
ret i32 %9
}
/* Type definitions */
struct timeval {
  long long tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/);
long long rtapi_get_time(void) {
  struct timeval tv;
  gettimeofday(&tv, 0);
  return tv.tv_sec * 1000000000LL + tv.tv_usec * 1000;
}


x86 assembly (clang, -O0):
<rtapi_get_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0x3b9aca00,-0x10(%rbp),%rax
3b
imul   $0x3e8,-0x8(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtapi_get_time>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0x3b9aca00,0x8(%rsp),%rcx
9a 3b
movslq 0x10(%rsp),%rax
imul   $0x3e8,%rax,%rax
add    %rcx,%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i32 }
define i64 @rtapi_get_time() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i64, i64* %3
%5 = mul nsw i64 %4, 1000000000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 1000
%9 = sext i32 %8 to i64
%10 = add nsw i64 %5, %9
ret i64 %10
}

LLVM IR (-O2):
%struct.timeval = type { i64, i32 }
define i64 @rtapi_get_time() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i64, i64* %4
%6 = mul nsw i64 %5, 1000000000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = mul nsw i32 %8, 1000
%10 = sext i32 %9 to i64
%11 = add nsw i64 %6, %10
ret i64 %11
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ stderr;
void del_joined_char(char *s) {
  if (s == NULL) {
    fprintf(stderr, "[ERROR] not allocated\n");
    return;
  }
  free(s);
}


x86 assembly (clang, -O0):
<del_joined_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1151 <del_joined_char+0x31>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xeb9(%rip),%rsi
call   1040 <fprintf@plt>
jmp    115a <del_joined_char+0x3a>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<del_joined_char>:
test   %rdi,%rdi
je     112a <del_joined_char+0xa>
jmp    1030 <free@plt>
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
lea    0xec6(%rip),%rsi
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"[ERROR] not allocated\0A\00"
define void @del_joined_char(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %11
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 @free(i8* %9)
br label %11
11: ; preds = %8, %5
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"[ERROR] not allocated\0A\00"
define void @del_joined_char(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %8
6: ; preds = %1
%7 = tail call i32 @free(i8* %0)
br label %8
8: ; preds = %6, %3
ret void
}
/* Type definitions */
typedef int int32_t;
typedef int /*<<< orphan*/ __m128i;
typedef int /*<<< orphan*/ __m128;

/* Variables and functions */
int /*<<< orphan*/ _mm_castps_si128(int /*<<< orphan*/);
int /*<<< orphan*/ _mm_store_si128(int /*<<< orphan*/ *, int /*<<< orphan*/);
extern __attribute__((__gnu___, __always___, __artificial__)) int
_MM_EXTRACT_PS(__m128 vec, const int LANE) {
  __attribute__((aligned(16))) int32_t tmp[4];
  _mm_store_si128((__m128i *)tmp, _mm_castps_si128(vec));
  return tmp[LANE];
}


x86 assembly (clang, -O0):
<_MM_EXTRACT_PS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <_mm_castps_si128@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%esi
call   1040 <_mm_store_si128@plt>
movslq -0x8(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_MM_EXTRACT_PS>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
call   1030 <_mm_castps_si128@plt>
mov    %rsp,%rdi
mov    %eax,%esi
call   1040 <_mm_store_si128@plt>
movslq %ebx,%rax
mov    (%rsp,%rax,4),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @_MM_EXTRACT_PS(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [4 x i32]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%7 = load i32, i32* %3
%8 = call i32 @_mm_castps_si128(i32 %7)
%9 = call i32 @_mm_store_si128(i32* %6, i32 %8)
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 %11
%13 = load i32, i32* %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @_MM_EXTRACT_PS(i32 %0, i32 %1) {
%3 = alloca [4 x i32]
%4 = bitcast [4 x i32]* %3 to i8*
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%6 = tail call i32 @_mm_castps_si128(i32 %0)
%7 = call i32 @_mm_store_si128(i32* %5, i32 %6)
%8 = sext i32 %1 to i64
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 %8
%10 = load i32, i32* %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void _main(long argc, char **argv, char **environ) {
  extern int main();
  exit(main((int)argc, argv, environ));
}


x86 assembly (clang, -O0):
<_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1030 <main@plt>
mov    %eax,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<_main>:
push   %rax
xor    %eax,%eax
call   1030 <main@plt>
mov    %eax,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @_main(i64 %0, i8** %1, i8** %2) {
%4 = alloca i64
%5 = alloca i8**
%6 = alloca i8**
store i64 %0, i64* %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%7 = load i64, i64* %4
%8 = trunc i64 %7 to i32
%9 = load i8**, i8*** %5
%10 = load i8**, i8*** %6
%11 = call i32 (i32, i8**, i8**, ...) bitcast (i32 (...)* @main to i32 (i32, i8**, i8**, ...)*)(i32 %8, i8** %9, i8** %10)
%12 = call i32 @exit(i32 %11)
unreachable
}

LLVM IR (-O2):
define void @_main(i64 %0, i8** %1, i8** %2) {
%4 = trunc i64 %0 to i32
%5 = tail call i32 (i32, i8**, i8**, ...) bitcast (i32 (...)* @main to i32 (i32, i8**, i8**, ...)*)(i32 %4, i8** %1, i8** %2)
%6 = tail call i32 @exit(i32 %5)
unreachable
}
long add1(int n) { return n + 1; }


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

x86 assembly (clang, -O2):
<add1>:
add    $0x1,%edi
movslq %edi,%rax
ret

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

LLVM IR (-O2):
define i64 @add1(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = sext i32 %2 to i64
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ eFree(char *);
char *popString();
int /*<<< orphan*/ pushStringCopy(char *);
char *rtrim(char *);
void basRTrim() {
  char *string;
  char *dest;
  string = popString();
  dest = rtrim(string);
  pushStringCopy(dest);
  eFree(string);
}


x86 assembly (clang, -O0):
<basRTrim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <popString@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <rtrim@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <pushStringCopy@plt>
mov    -0x8(%rbp),%rdi
call   1030 <eFree@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basRTrim>:
push   %rbx
xor    %eax,%eax
call   1050 <popString@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <rtrim@plt>
mov    %rax,%rdi
call   1060 <pushStringCopy@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <eFree@plt>

LLVM IR (-O0):
define void @basRTrim() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i8* (...) @popString()
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = call i8* @rtrim(i8* %4)
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @pushStringCopy(i8* %6)
%8 = load i8*, i8** %1
%9 = call i32 @eFree(i8* %8)
ret void
}

LLVM IR (-O2):
define void @basRTrim() {
%1 = tail call i8* (...) @popString()
%2 = tail call i8* @rtrim(i8* %1)
%3 = tail call i32 @pushStringCopy(i8* %2)
%4 = tail call i32 @eFree(i8* %1)
ret void
}
unsigned int f12(unsigned int x, int y __attribute__((unused))) {
  return (x << (8 * sizeof(unsigned int) - 1)) | (x >> 1);
}


x86 assembly (clang, -O0):
<f12>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1f,%eax
mov    -0x4(%rbp),%ecx
shr    $0x1,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f12(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 = shl i32 %5, 31
%7 = load i32, i32* %3
%8 = lshr i32 %7, 1
%9 = or i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @f12(i32 %0, i32 %1) {
%3 = tail call i32 @llvm.fshl.i32(i32 %0, i32 %0, i32 31)
ret i32 %3
}
/* Variables and functions */
double exp(double);
double cosh(double x) {
  double dexpx;
  dexpx = exp(x);
  return (0.5 * (dexpx + (1.0 / dexpx)));
}


x86 assembly (clang, -O0):
<cosh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  0xecf(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
addsd  %xmm0,%xmm1
movsd  0xeb6(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cosh>:
push   %rax
call   1030 <exp@plt>
movsd  0xee2(%rip),%xmm1
divsd  %xmm0,%xmm1
addsd  %xmm1,%xmm0
mulsd  0xeda(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @cosh(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call double @exp(double %4)
store double %5, double* %3
%6 = load double, double* %3
%7 = load double, double* %3
%8 = fdiv double 1.000000e+00, %7
%9 = fadd double %6, %8
%10 = fmul double 5.000000e-01, %9
ret double %10
}

LLVM IR (-O2):
define double @cosh(double %0) {
%2 = tail call double @exp(double %0)
%3 = fdiv double 1.000000e+00, %2
%4 = fadd double %2, %3
%5 = fmul double %4, 5.000000e-01
ret double %5
}
int smooth_ip(int ip_int, int ib, int packetsize) {
  return (ip_int - ib * (packetsize - 1));
}


x86 assembly (clang, -O0):
<smooth_ip>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
imul   %edx,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<smooth_ip>:
mov    %edi,%eax
add    $0xffffffff,%edx
imul   %esi,%edx
sub    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @smooth_ip(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %2, -1
%5 = mul nsw i32 %4, %1
%6 = sub nsw i32 %0, %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ bar();
int /*<<< orphan*/ foo();
int main(void) {
  foo();
  bar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <foo@plt>
mov    $0x0,%al
call   1030 <bar@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @foo()
%2 = call i32 (...) @bar()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @foo()
%2 = tail call i32 (...) @bar()
ret i32 0
}
/* Variables and functions */
char *dj_string_rstrchr(char *, char);
int /*<<< orphan*/ dj_string_toLowerCase(char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char str[] = "heLlO";
  char *tmp;
  dj_string_toLowerCase(str);
  printf("%s\n", str);
  tmp = dj_string_rstrchr(str, 'd');
  printf("%s\n", tmp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xec2(%rip),%eax
mov    %eax,-0x6(%rbp)
mov    0xebc(%rip),%ax
mov    %ax,-0x2(%rbp)
lea    -0x6(%rbp),%rdi
call   1040 <dj_string_toLowerCase@plt>
lea    -0x6(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
lea    -0x6(%rbp),%rdi
mov    $0x64,%esi
call   1050 <dj_string_rstrchr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movw   $0x4f,0x4(%rsp)
movl   $0x6c4c6568,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <dj_string_toLowerCase@plt>
lea    0xeb2(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1050 <dj_string_rstrchr@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@__const.main.str = [6 x i8] c"heLlO\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%3 = call i32 @dj_string_toLowerCase(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = call i8* @dj_string_rstrchr(i8* %2, i8 signext 100)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}
/* Variables and functions */
int getchar();
int /*<<< orphan*/ isspace(int);
int finalBuffer() {
  int c;
  int flag = 1;
  while ((c = getchar()) != '\n')
    if (!isspace(c))
      flag = 0;
  return flag;
}


x86 assembly (clang, -O0):
<finalBuffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x4(%rbp)
cmp    $0xa,%eax
je     115f <finalBuffer+0x3f>
mov    -0x4(%rbp),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
jne    115a <finalBuffer+0x3a>
movl   $0x0,-0x8(%rbp)
jmp    112f <finalBuffer+0xf>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<finalBuffer>:
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    $0x1,%ebx
cmp    $0xa,%eax
je     1158 <finalBuffer+0x38>
mov    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
mov    %eax,%edi
call   1030 <isspace@plt>
test   %eax,%eax
cmove  %eax,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%eax
jne    1140 <finalBuffer+0x20>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @finalBuffer() {
%1 = tail call i32 (...) @getchar()
%2 = icmp eq i32 %1, 10
br i1 %2, label %11, label %3
3: ; preds = %0, %3
%4 = phi i32 [ %9, %3 ], [ %1, %0 ]
%5 = phi i32 [ %8, %3 ], [ 1, %0 ]
%6 = tail call i32 @isspace(i32 %4)
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i32 0, i32 %5
%9 = tail call i32 (...) @getchar()
%10 = icmp eq i32 %9, 10
br i1 %10, label %11, label %3
11: ; preds = %3, %0
%12 = phi i32 [ 1, %0 ], [ %8, %3 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, int, double);
void sprintf_fixed(int d, double x) {
  char buf[64];
  snprintf(buf, 64, "%*f", d, x);
}


x86 assembly (clang, -O0):
<sprintf_fixed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x4(%rbp),%ecx
movsd  -0x10(%rbp),%xmm0
mov    $0x40,%esi
lea    0xec8(%rip),%rdx
call   1030 <snprintf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sprintf_fixed>:
sub    $0x48,%rsp
mov    %edi,%ecx
lea    0xee3(%rip),%rdx
mov    %rsp,%rdi
mov    $0x40,%esi
call   1030 <snprintf@plt>
add    $0x48,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%*f\00"
define void @sprintf_fixed(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca [64 x i8]
store i32 %0, i32* %3
store double %1, double* %4
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%7 = load i32, i32* %3
%8 = load double, double* %4
%9 = call i32 @snprintf(i8* %6, i32 64, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7, double %8)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%*f\00"
define void @sprintf_fixed(i32 %0, double %1) {
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = call i32 @snprintf(i8* %4, i32 64, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0, double %1)
ret void
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
main() {
  pid_t p = 30056;
  printf("spawned pid %d\n", p);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x7568,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed7(%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
mov    $0x7568,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"spawned pid %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 30056)
ret i32 0
}
void *_Locale_numeric_create(const char *__DUMMY_PAR,
                             struct _Locale_name_hint *hint) {
  return 0;
}


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

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

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

LLVM IR (-O2):
%struct._Locale_name_hint = type opaque
define noalias i8* @_Locale_numeric_create(i8* nocapture readnone %0, %struct._Locale_name_hint* nocapture readnone %1) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int age;
  printf("Please enter your age --> ");
  scanf("%d", &age);
  if (age >= 40)
    printf("Wow, that's old!\n");
  else
    printf("You are still young.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x28,-0x8(%rbp)
jl     1166 <main+0x46>
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
jmp    1172 <main+0x52>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
lea    0xed7(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x28,0x4(%rsp)
lea    0xed9(%rip),%rax
lea    0xebd(%rip),%rdi
cmovge %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Please enter your age --> \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"Wow, that's old!\0A\00"
@.str.3 = [22 x i8] c"You are still young.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = icmp sge i32 %5, 40
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %11
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %11
11: ; preds = %9, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Please enter your age --> \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [21 x i8] c"You are still young.\00"
@str.4 = [17 x i8] c"Wow, that's old!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 39
%7 = select i1 %6, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0)
%8 = call i32 @puts(i8* dereferenceable(1) %7)
ret i32 0
}
/* Type definitions */
struct timeval {
  long long tv_sec;
  long long tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/);
void Platform_GetTimeOfDay(long long *sec, long long *usec) {
  struct timeval tv;
  gettimeofday(&tv, 0);
  *sec = tv.tv_sec;
  *usec = tv.tv_usec;
}


x86 assembly (clang, -O0):
<Platform_GetTimeOfDay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Platform_GetTimeOfDay>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    0x8(%rsp),%rax
mov    %rax,(%rbx)
mov    0x10(%rsp),%rax
mov    %rax,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define void @Platform_GetTimeOfDay(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
%5 = alloca %struct.timeval
store i64* %0, i64** %3
store i64* %1, i64** %4
%6 = call i32 @gettimeofday(%struct.timeval* %5, i32 0)
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
%8 = load i64, i64* %7
%9 = load i64*, i64** %3
store i64 %8, i64* %9
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 1
%11 = load i64, i64* %10
%12 = load i64*, i64** %4
store i64 %11, i64* %12
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define void @Platform_GetTimeOfDay(i64* nocapture writeonly %0, i64* nocapture writeonly %1) {
%3 = alloca %struct.timeval
%4 = bitcast %struct.timeval* %3 to i8*
%5 = call i32 @gettimeofday(%struct.timeval* %3, i32 0)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%7 = load i64, i64* %6
store i64 %7, i64* %0
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
%9 = load i64, i64* %8
store i64 %9, i64* %1
ret void
}
int main() { sizeof(const char *); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void _WaitForOutputEmpty(long port) { usleep(2000000); }


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

x86 assembly (clang, -O2):
<_WaitForOutputEmpty>:
mov    $0x1e8480,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @_WaitForOutputEmpty(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = call i32 @usleep(i32 2000000)
ret void
}

LLVM IR (-O2):
define void @_WaitForOutputEmpty(i64 %0) {
%2 = tail call i32 @usleep(i32 2000000)
ret void
}
int kvm_nlist(void *kd, void *nl) { return (-1); }


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

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

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

LLVM IR (-O2):
define i32 @kvm_nlist(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 -1
}
void get_ScrnCols(int dum1, int dum2) {}


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

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

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

LLVM IR (-O2):
define void @get_ScrnCols(i32 %0, i32 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int towide_euc_impl(int /*<<< orphan*/ *, char const *, unsigned int, int, int,
                    int /*<<< orphan*/, int /*<<< orphan*/);
int towide_euctw(wchar_t *wc, const char *mb, unsigned n) {
  return (towide_euc_impl(wc, mb, n, 0x8e, 4, 0, 0));
}


x86 assembly (clang, -O0):
<towide_euctw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x8e,%ecx
mov    $0x4,%r8d
xor    %r9d,%r9d
movl   $0x0,(%rsp)
call   1030 <towide_euc_impl@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<towide_euctw>:
push   %rax
movl   $0x0,(%rsp)
mov    $0x8e,%ecx
mov    $0x4,%r8d
xor    %r9d,%r9d
call   1030 <towide_euc_impl@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @towide_euctw(i32* %0, i8* %1, i32 %2) {
%4 = tail call i32 @towide_euc_impl(i32* %0, i8* %1, i32 %2, i32 142, i32 4, i32 0, i32 0)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
int main() {
  int i;
  printf("12345");
  for (i = 0; i >= 0; i++)
    ;
  printf("67890\n");
  printf("12345");
  fflush(stdout);
  for (i = 0; i >= 0; i++)
    ;
  printf("67890\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     115f <main+0x3f>
jmp    1151 <main+0x31>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <main+0x22>
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     11a9 <main+0x89>
jmp    119b <main+0x7b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    118c <main+0x6c>
lea    0xe56(%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>

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

LLVM IR (-O2):
@.str = [6 x i8] c"12345\00"
@stdout = global i32 0
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
unreachable
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  char *s = "1234567911";
  printf("abcdefg = %u\n", atoi(s));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,%esi
lea    0xec6(%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
mov    $0x499602e7,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str.1 = [14 x i8] c"abcdefg = %u\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 1234567911)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint64_t;
typedef int /*<<< orphan*/ uint32_t;
typedef scalar_t__ int32_t;

/* Variables and functions */
int32_t int32_comparator(const void *l, const void *r) {
  int32_t lv = (int32_t)(uint32_t)(uint64_t)(l);
  int32_t rv = (int32_t)(uint32_t)(uint64_t)(r);
  if (lv < rv)
    return -1;
  else if (lv == rv)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<int32_comparator>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cltq
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cltq
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    113b <int32_comparator+0x3b>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    115e <int32_comparator+0x5e>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jne    1156 <int32_comparator+0x56>
movq   $0x0,-0x8(%rbp)
jmp    115e <int32_comparator+0x5e>
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int32_comparator>:
movslq %edi,%rax
movslq %esi,%rcx
xor    %edx,%edx
cmp    %rcx,%rax
setne  %dl
mov    $0xffffffffffffffff,%rax
cmovge %rdx,%rax
ret

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

LLVM IR (-O2):
define i64 @int32_comparator(i8* %0, i8* %1) {
%3 = ptrtoint i8* %0 to i64
%4 = shl i64 %3, 32
%5 = ashr exact i64 %4, 32
%6 = ptrtoint i8* %1 to i64
%7 = shl i64 %6, 32
%8 = ashr exact i64 %7, 32
%9 = icmp slt i64 %5, %8
%10 = icmp ne i64 %5, %8
%11 = zext i1 %10 to i64
%12 = select i1 %9, i64 -1, i64 %11
ret i64 %12
}
float identity(const float x) { return x; }


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

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

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

LLVM IR (-O2):
define float @identity(float returned %0) {
ret float %0
}
/* Type definitions */
struct em8051 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *);
int disasm_clr_a(struct em8051 *aCPU, int aPosition, char *aBuffer) {
  sprintf(aBuffer, "CLR   A");
  return 1;
}


x86 assembly (clang, -O0):
<disasm_clr_a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xed2(%rip),%rsi
call   1030 <sprintf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disasm_clr_a>:
movabs $0x41202020524c43,%rax
mov    %rax,(%rdx)
mov    $0x1,%eax
ret

LLVM IR (-O0):
%struct.em8051 = type { i32 }
@.str = [8 x i8] c"CLR A\00"
define i32 @disasm_clr_a(%struct.em8051* %0, i32 %1, i8* %2) {
%4 = alloca %struct.em8051*
%5 = alloca i32
%6 = alloca i8*
store %struct.em8051* %0, %struct.em8051** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
%struct.em8051 = type { i32 }
define i32 @disasm_clr_a(%struct.em8051* nocapture readnone %0, i32 %1, i8* nocapture writeonly %2) {
%4 = bitcast i8* %2 to i64*
store i64 18331195839499331, i64* %4
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *progname) {
  fprintf(stderr, "usage: %s username\n", progname);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"usage: %s username\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"usage: %s username\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}