#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 *, ...);
int sqrt(int);
void printW(double *w, long sizePhi, long n, double C) {
  int i;
  printf("---- w ----\n");
  for (i = 0; i < sizePhi; i++) {
    printf("%f  ", w[i]);
  }
  printf("\n----- xi ----\n");
  for (; i < sizePhi + 2 * n; i++) {
    printf("%f ", 1 / sqrt(2 * C) * w[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printW>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1185 <printW+0x65>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xea5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114e <printW+0x2e>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x24(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rdx
shl    $0x1,%rdx
add    %rdx,%rcx
cmp    %rcx,%rax
jge    11fc <printW+0xdc>
movsd  0xe49(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
lea    0xe43(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1193 <printW+0x73>
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printW>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movsd  %xmm0,(%rsp)
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xea9(%rip),%rdi
call   1040 <puts@plt>
xor    %ebp,%ebp
test   %r15,%r15
jle    119b <printW+0x5b>
lea    0xe8d(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%rbx,%rbp,8),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1180 <printW+0x40>
mov    %r15d,%ebp
lea    0xe73(%rip),%rdi
call   1040 <puts@plt>
lea    (%r15,%r14,2),%r12
cmp    %rbp,%r12
jle    1201 <printW+0xc1>
movsd  (%rsp),%xmm0
addsd  %xmm0,%xmm0
cvttsd2si %xmm0,%r15d
xor    %r13d,%r13d
lea    0xe3d(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %r15d,%edi
call   1060 <sqrt@plt>
lea    0x1(%rax),%ecx
cmp    $0x3,%ecx
cmovae %r13d,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  (%rbx,%rbp,8),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jg     11d0 <printW+0x90>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"---- w ----\0A\00"
@.str.1 = [5 x i8] c"%f \00"
@.str.2 = [16 x i8] c"\0A----- xi ----\0A\00"
@.str.3 = [4 x i8] c"%f \00"
@.str.4 = [2 x i8] c"\0A\00"
define void @printW(double* %0, i64 %1, i64 %2, double %3) {
%5 = alloca double*
%6 = alloca i64
%7 = alloca i64
%8 = alloca double
%9 = alloca i32
store double* %0, double** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store double %3, double* %8
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %9
br label %11
11: ; preds = %23, %4
%12 = load i32, i32* %9
%13 = sext i32 %12 to i64
%14 = load i64, i64* %6
%15 = icmp slt i64 %13, %14
br i1 %15, label %16, label %26
16: ; preds = %11
%17 = load double*, double** %5
%18 = load i32, i32* %9
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
%21 = load double, double* %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %21)
br label %23
23: ; preds = %16
%24 = load i32, i32* %9
%25 = add nsw i32 %24, 1
store i32 %25, i32* %9
br label %11
26: ; preds = %11
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %50, %26
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = load i64, i64* %6
%32 = load i64, i64* %7
%33 = mul nsw i64 2, %32
%34 = add nsw i64 %31, %33
%35 = icmp slt i64 %30, %34
br i1 %35, label %36, label %53
36: ; preds = %28
%37 = load double, double* %8
%38 = fmul double 2.000000e+00, %37
%39 = fptosi double %38 to i32
%40 = call i32 @sqrt(i32 %39)
%41 = sdiv i32 1, %40
%42 = sitofp i32 %41 to double
%43 = load double*, double** %5
%44 = load i32, i32* %9
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %43, i64 %45
%47 = load double, double* %46
%48 = fmul double %42, %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double %48)
br label %50
50: ; preds = %36
%51 = load i32, i32* %9
%52 = add nsw i32 %51, 1
store i32 %52, i32* %9
br label %28
53: ; preds = %28
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%f \00"
@.str.3 = [4 x i8] c"%f \00"
@str = [12 x i8] c"---- w ----\00"
@str.5 = [15 x i8] c"\0A----- xi ----\00"
define void @printW(double* nocapture %0, i64 %1, i64 %2, double %3) {
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%6 = icmp sgt i64 %1, 0
br i1 %6, label %7, label %16
7: ; preds = %4, %7
%8 = phi i64 [ %12, %7 ], [ 0, %4 ]
%9 = getelementptr inbounds double, double* %0, i64 %8
%10 = load double, double* %9
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %1
br i1 %13, label %14, label %7
14: ; preds = %7
%15 = and i64 %1, 4294967295
br label %16
16: ; preds = %14, %4
%17 = phi i64 [ 0, %4 ], [ %15, %14 ]
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.5, i64 0, i64 0))
%19 = shl nsw i64 %2, 1
%20 = add nsw i64 %19, %1
%21 = icmp sgt i64 %20, %17
br i1 %21, label %22, label %38
22: ; preds = %16
%23 = fmul double %3, 2.000000e+00
%24 = fptosi double %23 to i32
br label %25
25: ; preds = %22, %25
%26 = phi i64 [ %17, %22 ], [ %36, %25 ]
%27 = tail call i32 @sqrt(i32 %24)
%28 = add i32 %27, 1
%29 = icmp ult i32 %28, 3
%30 = select i1 %29, i32 %27, i32 0
%31 = sitofp i32 %30 to double
%32 = getelementptr inbounds double, double* %0, i64 %26
%33 = load double, double* %32
%34 = fmul double %33, %31
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double %34)
%36 = add nuw nsw i64 %26, 1
%37 = icmp sgt i64 %20, %36
br i1 %37, label %25, label %38
38: ; preds = %25, %16
%39 = tail call i32 @putchar(i32 10)
ret void
}