#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 *, double);
int phc_sols(int n, int r, int m, double s[m]) {
  int i, j, k = 0;
  printf("Dimension of solution vectors : %d.\n", n);
  printf("Number of solutions : %d.\n", r);
  for (i = 0; i < r; i++) {
    printf("solution %d : \n", i + 1);
    for (j = 0; j < n; j++) {
      printf("  %.15lf", s[k++]);
      printf("  %.15lf\n", s[k++]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<phc_sols>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
cvtsi2sdl -0x8(%rbp),%xmm0
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f1 <phc_sols+0xe1>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11de <phc_sols+0xce>
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x24(%rbp)
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x24(%rbp)
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    117e <phc_sols+0x6e>
jmp    11e3 <phc_sols+0xd3>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1155 <phc_sols+0x45>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<phc_sols>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,0x10(%rsp)
mov    %esi,%ebx
mov    %edi,%r13d
cvtsi2sd %edi,%xmm0
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
lea    0xedf(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,0xc(%rsp)
test   %ebx,%ebx
jle    11ed <phc_sols+0xdd>
addq   $0x8,0x10(%rsp)
xor    %r15d,%r15d
lea    0xee9(%rip),%rbp
lea    0xeeb(%rip),%rbx
xor    %r14d,%r14d
mov    %r13d,0x8(%rsp)
jmp    118c <phc_sols+0x7c>
nopl   0x0(%rax,%rax,1)
cmp    0xc(%rsp),%r14d
mov    0x8(%rsp),%r13d
je     11ed <phc_sols+0xdd>
add    $0x1,%r14d
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
test   %r13d,%r13d
jle    1180 <phc_sols+0x70>
movslq %r15d,%rax
mov    0x10(%rsp),%rcx
lea    (%rcx,%rax,8),%r12
cs nopw 0x0(%rax,%rax,1)
nop
movsd  -0x8(%r12),%xmm0
mov    %rbp,%rdi
call   1030 <printf@plt>
movsd  (%r12),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x10,%r12
add    $0x2,%r15d
add    $0xffffffff,%r13d
jne    11c0 <phc_sols+0xb0>
jmp    1180 <phc_sols+0x70>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [37 x i8] c"Dimension of solution vectors : %d.\0A\00"
@.str.1 = [27 x i8] c"Number of solutions : %d.\0A\00"
@.str.2 = [16 x i8] c"solution %d : \0A\00"
@.str.3 = [9 x i8] c" %.15lf\00"
@.str.4 = [10 x i8] c" %.15lf\0A\00"
define i32 @phc_sols(i32 %0, i32 %1, i32 %2, double* nocapture %3) {
%5 = sitofp i32 %0 to double
%6 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), double %5)
%7 = sitofp i32 %1 to double
%8 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), double %7)
%9 = icmp sgt i32 %1, 0
br i1 %9, label %10, label %38
10: ; preds = %4
%11 = icmp sgt i32 %0, 0
br label %17
12: ; preds = %25
%13 = trunc i64 %32 to i32
br label %14
14: ; preds = %12, %17
%15 = phi i32 [ %18, %17 ], [ %13, %12 ]
%16 = icmp eq i32 %20, %1
br i1 %16, label %38, label %17
17: ; preds = %10, %14
%18 = phi i32 [ 0, %10 ], [ %15, %14 ]
%19 = phi i32 [ 0, %10 ], [ %20, %14 ]
%20 = add nuw nsw i32 %19, 1
%21 = sitofp i32 %20 to double
%22 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), double %21)
br i1 %11, label %23, label %14
23: ; preds = %17
%24 = sext i32 %18 to i64
br label %25
25: ; preds = %23, %25
%26 = phi i64 [ %24, %23 ], [ %32, %25 ]
%27 = phi i32 [ 0, %23 ], [ %36, %25 ]
%28 = add nsw i64 %26, 1
%29 = getelementptr inbounds double, double* %3, i64 %26
%30 = load double, double* %29
%31 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), double %30)
%32 = add nsw i64 %26, 2
%33 = getelementptr inbounds double, double* %3, i64 %28
%34 = load double, double* %33
%35 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), double %34)
%36 = add nuw nsw i32 %27, 1
%37 = icmp eq i32 %36, %0
br i1 %37, label %12, label %25
38: ; preds = %14, %4
ret i32 0
}