#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_data(double *data, int size) {
  printf("\nx(i)\t\tf(x(i))\n");
  for (int i = 0; i < size; i++)
    printf("%f\t%f\n", data[i * 2], data[i * 2 + 1]);
  printf("\n");
}


x86 assembly (clang, -O0):
<print_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1183 <print_data+0x73>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0xea2(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1134 <print_data+0x24>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_data>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xec4(%rip),%rdi
call   1040 <puts@plt>
test   %ebp,%ebp
jle    117e <print_data+0x4e>
mov    %ebp,%r15d
shl    $0x4,%r15
xor    %ebp,%ebp
lea    0xea4(%rip),%r14
nopl   0x0(%rax)
movsd  (%rbx,%rbp,1),%xmm0
movsd  0x8(%rbx,%rbp,1),%xmm1
mov    %r14,%rdi
mov    $0x2,%al
call   1050 <printf@plt>
add    $0x10,%rbp
cmp    %rbp,%r15
jne    1160 <print_data+0x30>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"\0Ax(i)\09\09f(x(i))\0A\00"
@.str.1 = [7 x i8] c"%f\09%f\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @print_data(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %7
7: ; preds = %26, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %29
11: ; preds = %7
%12 = load double*, double** %3
%13 = load i32, i32* %5
%14 = mul nsw i32 %13, 2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds double, double* %12, i64 %15
%17 = load double, double* %16
%18 = load double*, double** %3
%19 = load i32, i32* %5
%20 = mul nsw i32 %19, 2
%21 = add nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds double, double* %18, i64 %22
%24 = load double, double* %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %17, double %24)
br label %26
26: ; preds = %11
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %7
29: ; preds = %7
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"%f\09%f\0A\00"
@str = [15 x i8] c"\0Ax(i)\09\09f(x(i))\00"
define void @print_data(double* nocapture %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = zext i32 %1 to i64
br label %9
7: ; preds = %9, %2
%8 = tail call i32 @putchar(i32 10)
ret void
9: ; preds = %5, %9
%10 = phi i64 [ 0, %5 ], [ %18, %9 ]
%11 = shl nuw nsw i64 %10, 1
%12 = getelementptr inbounds double, double* %0, i64 %11
%13 = load double, double* %12
%14 = or i64 %11, 1
%15 = getelementptr inbounds double, double* %0, i64 %14
%16 = load double, double* %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %13, double %16)
%18 = add nuw nsw i64 %10, 1
%19 = icmp eq i64 %18, %6
br i1 %19, label %7, label %9
}