xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void cleanUp(char **bufferPtr, int numOfLines) {
  if (bufferPtr != NULL) {
    for (unsigned int i = 0; i < numOfLines; i++) {
      free(bufferPtr[i]);
    }
  }
}


x86 assembly (clang, -O0):
<cleanUp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1160 <cleanUp+0x50>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    115b <cleanUp+0x4b>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1131 <cleanUp+0x21>
jmp    1160 <cleanUp+0x50>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanUp>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1142 <cleanUp+0x32>
test   %esi,%esi
je     1142 <cleanUp+0x32>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <cleanUp+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @cleanUp(i8** %0, i32 %1) {
%3 = icmp ne i8** %0, null
%4 = icmp ne i32 %1, 0
%5 = and i1 %3, %4
br i1 %5, label %6, label %15
6: ; preds = %2
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %13, %8 ]
%10 = getelementptr inbounds i8*, i8** %0, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32 @free(i8* %11)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %7
br i1 %14, label %15, label %8
15: ; preds = %8, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128d;

/* Variables and functions */
int /*<<< orphan*/ _mm_min_sd(int /*<<< orphan*/, int /*<<< orphan*/);
__m128d test_mm_min_sd(__m128d A, __m128d B) { return _mm_min_sd(A, B); }


x86 assembly (clang, -O0):
<test_mm_min_sd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <_mm_min_sd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_mm_min_sd>:
jmp    1030 <_mm_min_sd@plt>

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

LLVM IR (-O2):
define i32 @test_mm_min_sd(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_min_sd(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int setns(int /*<<< orphan*/, int /*<<< orphan*/);
int main(void) { return setns(0, 0); }


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

x86 assembly (clang, -O2):
<main>:
xor    %edi,%edi
xor    %esi,%esi
jmp    1030 <setns@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @setns(i32 0, i32 0)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void bottom(int i) { assert(i < 42); }


x86 assembly (clang, -O0):
<bottom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x2a,-0x4(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bottom>:
xor    %eax,%eax
cmp    $0x2a,%edi
setl   %al
mov    %eax,%edi
jmp    1030 <assert@plt>

LLVM IR (-O0):
define void @bottom(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 42
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
ret void
}

LLVM IR (-O2):
define void @bottom(i32 %0) {
%2 = icmp slt i32 %0, 42
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
ret void
}
vdloge(errnum, errsev) int *errnum, *errsev;
{}


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

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

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

LLVM IR (-O2):
define i32 @vdloge(i32* nocapture readnone %0, i32* nocapture readnone %1) {
ret i32 undef
}
int clickplc_exe_InterruptReturn_enc(void *obj, unsigned char *stream) {
  int encsize = 4;
  stream[0] = 0x00;
  stream[1] = 0x19;
  stream[2] = 0xff;
  stream[3] = 0xff;
  return (encsize);
}


x86 assembly (clang, -O0):
<clickplc_exe_InterruptReturn_enc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x4,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movb   $0x19,0x1(%rax)
mov    -0x10(%rbp),%rax
movb   $0xff,0x2(%rax)
mov    -0x10(%rbp),%rax
movb   $0xff,0x3(%rax)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clickplc_exe_InterruptReturn_enc>:
movl   $0xffff1900,(%rsi)
mov    $0x4,%eax
ret

LLVM IR (-O0):
define i32 @clickplc_exe_InterruptReturn_enc(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 4, i32* %5
%6 = load i8*, i8** %4
%7 = getelementptr inbounds i8, i8* %6, i64 0
store i8 0, i8* %7
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8 25, i8* %9
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 2
store i8 -1, i8* %11
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 3
store i8 -1, i8* %13
%14 = load i32, i32* %5
ret i32 %14
}

LLVM IR (-O2):
define i32 @clickplc_exe_InterruptReturn_enc(i8* nocapture readnone %0, i8* nocapture writeonly %1) {
store i8 0, i8* %1
%3 = getelementptr inbounds i8, i8* %1, i64 1
store i8 25, i8* %3
%4 = getelementptr inbounds i8, i8* %1, i64 2
store i8 -1, i8* %4
%5 = getelementptr inbounds i8, i8* %1, i64 3
store i8 -1, i8* %5
ret i32 4
}
void mat2_multiplyScalar(float *dst, float b) {
  dst[0] = dst[0] * b;
  dst[1] = dst[1] * b;
  dst[2] = dst[2] * b;
  dst[3] = dst[3] * b;
}


x86 assembly (clang, -O0):
<mat2_multiplyScalar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mulss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mulss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
mulss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movss  0xc(%rax),%xmm0
mulss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mat2_multiplyScalar>:
movups (%rdi),%xmm1
shufps $0x0,%xmm0,%xmm0
mulps  %xmm1,%xmm0
movups %xmm0,(%rdi)
ret

LLVM IR (-O0):
define void @mat2_multiplyScalar(float* %0, float %1) {
%3 = alloca float*
%4 = alloca float
store float* %0, float** %3
store float %1, float* %4
%5 = load float*, float** %3
%6 = getelementptr inbounds float, float* %5, i64 0
%7 = load float, float* %6
%8 = load float, float* %4
%9 = fmul float %7, %8
%10 = load float*, float** %3
%11 = getelementptr inbounds float, float* %10, i64 0
store float %9, float* %11
%12 = load float*, float** %3
%13 = getelementptr inbounds float, float* %12, i64 1
%14 = load float, float* %13
%15 = load float, float* %4
%16 = fmul float %14, %15
%17 = load float*, float** %3
%18 = getelementptr inbounds float, float* %17, i64 1
store float %16, float* %18
%19 = load float*, float** %3
%20 = getelementptr inbounds float, float* %19, i64 2
%21 = load float, float* %20
%22 = load float, float* %4
%23 = fmul float %21, %22
%24 = load float*, float** %3
%25 = getelementptr inbounds float, float* %24, i64 2
store float %23, float* %25
%26 = load float*, float** %3
%27 = getelementptr inbounds float, float* %26, i64 3
%28 = load float, float* %27
%29 = load float, float* %4
%30 = fmul float %28, %29
%31 = load float*, float** %3
%32 = getelementptr inbounds float, float* %31, i64 3
store float %30, float* %32
ret void
}

LLVM IR (-O2):
define void @mat2_multiplyScalar(float* nocapture %0, float %1) {
%3 = bitcast float* %0 to <4 x float>*
%4 = load <4 x float>, <4 x float>* %3
%5 = insertelement <4 x float> poison, float %1, i64 0
%6 = shufflevector <4 x float> %5, <4 x float> poison, <4 x i32> zeroinitializer
%7 = fmul <4 x float> %4, %6
%8 = bitcast float* %0 to <4 x float>*
store <4 x float> %7, <4 x float>* %8
ret void
}
int dstLongAtput(int idx, int value) { return (*((int *)(idx)) = value); }


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

x86 assembly (clang, -O2):
<dstLongAtput>:
mov    %esi,%eax
movslq %edi,%rcx
mov    %esi,(%rcx)
ret

LLVM IR (-O0):
define i32 @dstLongAtput(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
store i32 %5, i32* %8
ret i32 %5
}

LLVM IR (-O2):
define i32 @dstLongAtput(i32 %0, i32 returned %1) {
%3 = sext i32 %0 to i64
%4 = inttoptr i64 %3 to i32*
store i32 %1, i32* %4
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ is_multicast_ether_addr(void const *);
int /*<<< orphan*/ is_zero_ether_addr(void const *);
int is_valid_ether_addr(const void *addr) {
  return ((!is_multicast_ether_addr(addr)) && (!is_zero_ether_addr(addr)));
}


x86 assembly (clang, -O0):
<is_valid_ether_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <is_multicast_ether_addr@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
jne    1159 <is_valid_ether_addr+0x39>
mov    -0x8(%rbp),%rdi
call   1040 <is_zero_ether_addr@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_valid_ether_addr>:
push   %rbx
mov    %rdi,%rbx
call   1030 <is_multicast_ether_addr@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
je     1133 <is_valid_ether_addr+0x13>
pop    %rbx
ret
mov    %rbx,%rdi
call   1040 <is_zero_ether_addr@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_valid_ether_addr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @is_multicast_ether_addr(i8* %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @is_zero_ether_addr(i8* %7)
%9 = icmp ne i32 %8, 0
%10 = xor i1 %9, true
br label %11
11: ; preds = %6, %1
%12 = phi i1 [ false, %1 ], [ %10, %6 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @is_valid_ether_addr(i8* %0) {
%2 = tail call i32 @is_multicast_ether_addr(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i32 @is_zero_ether_addr(i8* %0)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
void flush_stdout(int level) {
  fprintf(stdout, "\n");
  fflush(stdout);
}


x86 assembly (clang, -O0):
<flush_stdout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flush_stdout>:
push   %rbx
mov    0x2eb8(%rip),%rbx
mov    (%rbx),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
pop    %rbx
jmp    1040 <fflush@plt>

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

LLVM IR (-O2):
@stdout = global i32 0
@.str = [2 x i8] c"\0A\00"
define void @flush_stdout(i32 %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdout
%5 = tail call i32 @fflush(i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void main() { printf("Hello World!\n"); }


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

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

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

LLVM IR (-O2):
@str = [13 x i8] c"Hello World!\00"
define void @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int input = 0;
  printf("Please input an integer: ");
  scanf("%d", &input);
  printf("Input integer sub 6 is: %d\n", input - 6);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
add    $0xfffffffa,%esi
lea    0xec7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Please input an integer: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [28 x i8] c"Input integer sub 6 is: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 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 = sub nsw i32 %5, 6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"Please input an integer: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [28 x i8] c"Input integer sub 6 is: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 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 = add nsw i32 %5, -6
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void cls(void) { printf("\33[2J"); }


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"\1B[2J\00"
define void @cls() {
%1 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[2J\00"
define void @cls() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ KIOCSOUND;
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/, int /*<<< orphan*/);
void libpcspeak_release(int device) { ioctl(device, KIOCSOUND, 0); }


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

x86 assembly (clang, -O2):
<libpcspeak_release>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
jmp    1030 <ioctl@plt>

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

LLVM IR (-O2):
@KIOCSOUND = global i32 0
define void @libpcspeak_release(i32 %0) {
%2 = load i32, i32* @KIOCSOUND
%3 = tail call i32 @ioctl(i32 %0, i32 %2, i32 0)
ret void
}
int init_config(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @init_config() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int open(char const *, int);
int /*<<< orphan*/ stderr;
int sopen(const char *pathname, int flags) {
  int fd;
  fd = open(pathname, flags);
  if (fd == -1) {
    fprintf(stderr, "cannot open()\n");
    exit(EXIT_FAILURE);
  }
  return (fd);
}


x86 assembly (clang, -O0):
<sopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <open@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
jne    117b <sopen+0x4b>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
lea    0xe98(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sopen>:
push   %rax
call   1040 <open@plt>
cmp    $0xffffffff,%eax
je     113d <sopen+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [15 x i8] c"cannot open()\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @sopen(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @open(i8* %6, i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @EXIT_FAILURE
%15 = call i32 @exit(i32 %14)
unreachable
16: ; preds = %2
%17 = load i32, i32* %5
ret i32 %17
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"cannot open()\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @sopen(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @open(i8* %0, i32 %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %2
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ Widget;

/* Variables and functions */
int /*<<< orphan*/ DoLayout(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ True;
void Resize(Widget w) { DoLayout(w, True); }


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

x86 assembly (clang, -O2):
<Resize>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
jmp    1030 <DoLayout@plt>

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

LLVM IR (-O2):
@True = global i32 0
define void @Resize(i32 %0) {
%2 = load i32, i32* @True
%3 = tail call i32 @DoLayout(i32 %0, i32 %2)
ret void
}
int main(void) { return ((int[]){1, 2, 3, 4})[1]; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x2,-0x10(%rbp)
movl   $0x3,-0xc(%rbp)
movl   $0x4,-0x8(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i32]
store i32 0, i32* %1
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
store i32 1, i32* %3
%4 = getelementptr inbounds i32, i32* %3, i64 1
store i32 2, i32* %4
%5 = getelementptr inbounds i32, i32* %4, i64 1
store i32 3, i32* %5
%6 = getelementptr inbounds i32, i32* %5, i64 1
store i32 4, i32* %6
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 1
%8 = load i32, i32* %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @main() {
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ find(char *);
void find_index_small_test() {
  find("benchmarks"
       ".index.small");
}


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

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

LLVM IR (-O0):
@.str = [23 x i8] c"benchmarks.index.small\00"
define void @find_index_small_test() {
%1 = call i32 @find(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"benchmarks.index.small\00"
define void @find_index_small_test() {
%1 = tail call i32 @find(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ isTerminalRunning();
scalar_t__ terminalName();
int whiptailPresentOnly();
int whiptailPresent() {
  int lWhiptailPresent;
  lWhiptailPresent = whiptailPresentOnly();
  if (lWhiptailPresent && (isTerminalRunning() || terminalName())) {
    return lWhiptailPresent;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<whiptailPresent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <whiptailPresentOnly@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1179 <whiptailPresent+0x49>
mov    $0x0,%al
call   1040 <isTerminalRunning@plt>
cmp    $0x0,%rax
jne    116e <whiptailPresent+0x3e>
mov    $0x0,%al
call   1050 <terminalName@plt>
cmp    $0x0,%rax
je     1179 <whiptailPresent+0x49>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1180 <whiptailPresent+0x50>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<whiptailPresent>:
push   %rbx
xor    %eax,%eax
call   1030 <whiptailPresentOnly@plt>
test   %eax,%eax
je     1156 <whiptailPresent+0x26>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <isTerminalRunning@plt>
test   %rax,%rax
jne    1158 <whiptailPresent+0x28>
xor    %eax,%eax
call   1050 <terminalName@plt>
test   %rax,%rax
jne    1158 <whiptailPresent+0x28>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @whiptailPresent() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @whiptailPresentOnly()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %14
6: ; preds = %0
%7 = call i64 (...) @isTerminalRunning()
%8 = icmp ne i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = call i64 (...) @terminalName()
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9, %6
%13 = load i32, i32* %2
store i32 %13, i32* %1
br label %15
14: ; preds = %9, %0
store i32 0, i32* %1
br label %15
15: ; preds = %14, %12
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
define i32 @whiptailPresent() {
%1 = tail call i32 (...) @whiptailPresentOnly()
%2 = icmp eq i32 %1, 0
br i1 %2, label %9, label %3
3: ; preds = %0
%4 = tail call i64 (...) @isTerminalRunning()
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = tail call i64 (...) @terminalName()
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %6, %0
br label %10
10: ; preds = %3, %6, %9
%11 = phi i32 [ 0, %9 ], [ %1, %6 ], [ %1, %3 ]
ret i32 %11
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(char *const, char const *, int);
char *make_name(const char *buffer, int len) {
  char *const name = (char *)malloc(len + 1);
  memcpy(name, buffer, len);
  name[len] = 0;
  return name;
}


x86 assembly (clang, -O0):
<make_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_name>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%r15d
mov    %rdi,%r14
lea    0x1(%r15),%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1030 <memcpy@plt>
movslq %r15d,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @make_name(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = add nsw i32 %6, 1
%8 = call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = call i32 @memcpy(i8* %10, i8* %11, i32 %12)
%14 = load i8*, i8** %5
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
store i8 0, i8* %17
%18 = load i8*, i8** %5
ret i8* %18
}

LLVM IR (-O2):
define i8* @make_name(i8* %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @memcpy(i8* %5, i8* %0, i32 %1)
%7 = sext i32 %1 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
store i8 0, i8* %8
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void os_term(int exit_code) { exit(exit_code); }


x86 assembly (clang, -O0):
<os_term>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<os_term>:
push   %rax
call   1030 <exit@plt>

LLVM IR (-O0):
define void @os_term(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
define void @os_term(i32 %0) {
%2 = tail call i32 @exit(i32 %0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
extern int make_dgram_client_socket(void) {
  return socket(AF_INET, SOCK_DGRAM, 0);
}


x86 assembly (clang, -O0):
<make_dgram_client_socket>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
mov    0x2ebc(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <socket@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_dgram_client_socket>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
jmp    1030 <socket@plt>

LLVM IR (-O0):
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
define i32 @make_dgram_client_socket() {
%1 = load i32, i32* @AF_INET
%2 = load i32, i32* @SOCK_DGRAM
%3 = call i32 @socket(i32 %1, i32 %2, i32 0)
ret i32 %3
}

LLVM IR (-O2):
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
define i32 @make_dgram_client_socket() {
%1 = load i32, i32* @AF_INET
%2 = load i32, i32* @SOCK_DGRAM
%3 = tail call i32 @socket(i32 %1, i32 %2, i32 0)
ret i32 %3
}
/* Variables and functions */
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
void strncpy_exactly_matching_buffer(char *y) {
  char x[4];
  strncpy(x, y, 4);
  if (strlen(x) > 4)
    (void)*(int *)0;
}


x86 assembly (clang, -O0):
<strncpy_exactly_matching_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
lea    -0xc(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x4,%eax
jle    1150 <strncpy_exactly_matching_buffer+0x30>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncpy_exactly_matching_buffer>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rsi
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <strncpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @strncpy_exactly_matching_buffer(i8* %0) {
%2 = alloca i8*
%3 = alloca [4 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 @strncpy(i8* %4, i8* %5, i32 4)
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%8 = call i32 @strlen(i8* %7)
%9 = icmp sgt i32 %8, 4
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load i32, i32* null
br label %12
12: ; preds = %10, %1
ret void
}

LLVM IR (-O2):
define void @strncpy_exactly_matching_buffer(i8* %0) {
%2 = alloca [4 x i8]
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%4 = call i32 @strncpy(i8* %3, i8* %0, i32 4)
%5 = call i32 @strlen(i8* %3)
ret void
}
int socket_v_abi(void) { return 0x20120804; }


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

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

LLVM IR (-O0):
define i32 @socket_v_abi() {
ret i32 538052612
}

LLVM IR (-O2):
define i32 @socket_v_abi() {
ret i32 538052612
}
void tty_init(void) {}


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

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

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

LLVM IR (-O2):
define void @tty_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ *read_line(int, char *, int);
void read_one_line(int sockfd) {
  char message[60];
  if (read_line(sockfd, message, 60) == NULL) {
    perror("Couldn't read a line of text");
  } else {
    printf("Text line from server: %s", message);
  }
}


x86 assembly (clang, -O0):
<read_one_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x3c,%edx
call   1040 <read_line@plt>
cmp    $0x0,%rax
jne    1167 <read_one_line+0x37>
lea    0xea3(%rip),%rdi
call   1050 <perror@plt>
jmp    1177 <read_one_line+0x47>
lea    -0x40(%rbp),%rsi
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_one_line>:
sub    $0x48,%rsp
mov    %rsp,%rsi
mov    $0x3c,%edx
call   1040 <read_line@plt>
test   %rax,%rax
je     115a <read_one_line+0x2a>
lea    0xed0(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
add    $0x48,%rsp
ret
lea    0xe9f(%rip),%rdi
call   1050 <perror@plt>
add    $0x48,%rsp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Couldn't read a line of text\00"
@.str.1 = [26 x i8] c"Text line from server: %s\00"
define void @read_one_line(i32 %0) {
%2 = alloca i32
%3 = alloca [60 x i8]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = getelementptr inbounds [60 x i8], [60 x i8]* %3, i64 0, i64 0
%6 = call i32* @read_line(i32 %4, i8* %5, i32 60)
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %13
10: ; preds = %1
%11 = getelementptr inbounds [60 x i8], [60 x i8]* %3, i64 0, i64 0
%12 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %11)
br label %13
13: ; preds = %10, %8
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"Couldn't read a line of text\00"
@.str.1 = [26 x i8] c"Text line from server: %s\00"
define void @read_one_line(i32 %0) {
%2 = alloca [60 x i8]
%3 = getelementptr inbounds [60 x i8], [60 x i8]* %2, i64 0, i64 0
%4 = call i32* @read_line(i32 %0, i8* %3, i32 60)
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %10
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %3)
br label %10
10: ; preds = %8, %6
ret void
}
void g_date_get_monday_week_of_year() {}


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

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

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

LLVM IR (-O2):
define void @g_date_get_monday_week_of_year() {
ret void
}
void param_set_int(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<param_set_int>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<param_set_int>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.param_set_int = [14 x i8] c"param_set_int\00"
define void @param_set_int() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__func__.param_set_int, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.param_set_int = [14 x i8] c"param_set_int\00"
define void @param_set_int() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__func__.param_set_int, i64 0, i64 0))
ret void
}
/* Type definitions */
struct iw_request_info {
  int dummy;
};

/* Variables and functions */
int IW_EV_LCP_LEN;
int iwe_stream_lcp_len(struct iw_request_info *info) { return IW_EV_LCP_LEN; }


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

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

LLVM IR (-O0):
%struct.iw_request_info = type { i32 }
@IW_EV_LCP_LEN = global i32 0
define i32 @iwe_stream_lcp_len(%struct.iw_request_info* %0) {
%2 = alloca %struct.iw_request_info*
store %struct.iw_request_info* %0, %struct.iw_request_info** %2
%3 = load i32, i32* @IW_EV_LCP_LEN
ret i32 %3
}

LLVM IR (-O2):
%struct.iw_request_info = type { i32 }
@IW_EV_LCP_LEN = global i32 0
define i32 @iwe_stream_lcp_len(%struct.iw_request_info* nocapture readnone %0) {
%2 = load i32, i32* @IW_EV_LCP_LEN
ret i32 %2
}
/* Variables and functions */
size_t strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
void strncpy_contents_Good() {
  char src[5] = "test";
  char dst[10];
  strncpy(dst, src, 5);
  int a[5];
  a[strlen(dst)] = 0;
}


x86 assembly (clang, -O0):
<strncpy_contents_Good>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed2(%rip),%eax
mov    %eax,-0x5(%rbp)
mov    0xecd(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0xf(%rbp),%rdi
lea    -0x5(%rbp),%rsi
mov    $0x5,%edx
call   1030 <strncpy@plt>
lea    -0xf(%rbp),%rdi
call   1040 <strlen@plt>
movl   $0x0,-0x30(%rbp,%rax,4)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncpy_contents_Good>:
sub    $0x18,%rsp
movb   $0x0,0xc(%rsp)
movl   $0x74736574,0x8(%rsp)
74
lea    0xe(%rsp),%rdi
lea    0x8(%rsp),%rsi
mov    $0x5,%edx
call   1030 <strncpy@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.strncpy_contents_Good.src = [5 x i8] c"test\00"
define void @strncpy_contents_Good() {
%1 = alloca [5 x i8]
%2 = alloca [10 x i8]
%3 = alloca [5 x i32]
%4 = bitcast [5 x i8]* %1 to i8*
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%7 = call i32 @strncpy(i8* %5, i8* %6, i32 5)
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%9 = call i64 @strlen(i8* %8)
%10 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 %9
store i32 0, i32* %10
ret void
}

LLVM IR (-O2):
@__const.strncpy_contents_Good.src = [5 x i8] c"test\00"
define void @strncpy_contents_Good() {
%1 = alloca [5 x i8]
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = call i32 @strncpy(i8* %4, i8* %3, i32 5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr, "Usage:\n"
                  "  -w target\n"
                  "  -A (auth query only)\n"
                  "  -t TYPE\n"
                  "  -n nsname:ipno (WARNING on fail)\n"
                  "  -N nsname:ipno (CRITICAL on fail)\n"
                  "  -e expectation\n"
                  "  -C (critical on sync fail)\n"
                  "  -d (debug)\n");
  exit(3);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x3,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x3,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [183 x i8] c"Usage:\0A -w target\0A -A (auth query only)\0A -t TYPE\0A -n nsname:ipno (WARNING on fail)\0A -N nsname:ipno (CRITICAL on fail)\0A -e expectation\0A -C (critical on sync fail)\0A -d (debug)\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([183 x i8], [183 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [183 x i8] c"Usage:\0A -w target\0A -A (auth query only)\0A -t TYPE\0A -n nsname:ipno (WARNING on fail)\0A -N nsname:ipno (CRITICAL on fail)\0A -e expectation\0A -C (critical on sync fail)\0A -d (debug)\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([183 x i8], [183 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 3)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void bar() { printf("hello from bar\n"); }


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"hello from bar\0A\00"
define void @bar() {
%1 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [15 x i8] c"hello from bar\00"
define void @bar() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret void
}
int buserror(char *data) {
  int *x;
  x = (int *)(data + 1);
  return (*x);
}


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

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

LLVM IR (-O0):
define i32 @buserror(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = bitcast i8* %5 to i32*
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = load i32, i32* %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @buserror(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = bitcast i8* %2 to i32*
%4 = load i32, i32* %3
ret i32 %4
}
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void *check_calloc(size_t num_els, size_t el_size) {
  void *ptr = calloc(num_els, el_size);
  if (!ptr) {
    fprintf(stderr, "check_malloc: out of memory! (fatal)\n");
    exit(-1);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<check_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    117b <check_calloc+0x4b>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
lea    0xe94(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_calloc>:
push   %rax
call   1030 <calloc@plt>
test   %rax,%rax
je     113d <check_calloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"check_malloc: out of memory! (fatal)\0A\00"
define i8* @check_calloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i8* @calloc(i64 %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %15, label %11
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 -1)
unreachable
15: ; preds = %2
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"check_malloc: out of memory! (fatal)\0A\00"
define noalias i8* @check_calloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 -1)
unreachable
9: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int number_mm();
int number_bits(int width) { return number_mm() & ((1 << width) - 1); }


x86 assembly (clang, -O0):
<number_bits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <number_mm@plt>
mov    -0x4(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
sub    $0x1,%ecx
and    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<number_bits>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <number_mm@plt>
mov    $0xffffffff,%edx
mov    %ebx,%ecx
shl    %cl,%edx
not    %edx
and    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @number_bits(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @number_mm()
%4 = load i32, i32* %2
%5 = shl i32 1, %4
%6 = sub nsw i32 %5, 1
%7 = and i32 %3, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @number_bits(i32 %0) {
%2 = tail call i32 (...) @number_mm()
%3 = shl nsw i32 -1, %0
%4 = xor i32 %3, -1
%5 = and i32 %2, %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ delay_us(int);
int /*<<< orphan*/ do_main_tasks(int /*<<< orphan*/);
void delay_ms_maintasks(int ms) {
  int i;
  for (i = 0; i < ms; i++) {
    delay_us(1000 / 8);
    do_main_tasks(0);
  }
}


x86 assembly (clang, -O0):
<delay_ms_maintasks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115d <delay_ms_maintasks+0x3d>
mov    $0x7d,%edi
call   1040 <delay_us@plt>
xor    %edi,%edi
call   1030 <do_main_tasks@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <delay_ms_maintasks+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delay_ms_maintasks>:
push   %rbx
test   %edi,%edi
jle    1146 <delay_ms_maintasks+0x26>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x7d,%edi
call   1040 <delay_us@plt>
xor    %edi,%edi
call   1030 <do_main_tasks@plt>
add    $0xffffffff,%ebx
jne    1130 <delay_ms_maintasks+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @delay_ms_maintasks(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = tail call i32 @delay_us(i32 125)
%6 = tail call i32 @do_main_tasks(i32 0)
%7 = add nuw nsw i32 %4, 1
%8 = icmp eq i32 %7, %0
br i1 %8, label %9, label %3
9: ; preds = %3, %1
ret void
}