#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 solcon_dimension_of_standard_solutions(int *);
int solcon_number_of_standard_solutions(int *);
int solcon_retrieve_next_standard_solution(int, int *, int *, double *);
void standard_next_retrievals(void) {
  int dim, len, fail;
  fail = solcon_dimension_of_standard_solutions(&dim);
  fail = solcon_number_of_standard_solutions(&len);
  printf("The container has %d solutions of dimension %d.\n", len, dim);
  {
    int i, k, m;
    double sol[2 * dim + 5];
    do {
      fail = solcon_retrieve_next_standard_solution(dim, &k, &m, sol);
      if (fail != 0)
        printf("return value of k is %d\n", k);
      else {
        printf("The solution vector %d :\n", k);
        for (i = 0; i < dim; i++)
          printf(" %.15e  %.15e\n", sol[2 + 2 * i], sol[2 + 2 * i + 1]);
      }
    } while (k > 0);
  }
}


x86 assembly (clang, -O0):
<standard_next_retrievals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x4(%rbp),%rdi
call   1060 <solcon_dimension_of_standard_solutions@plt>
mov    %eax,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
call   1050 <solcon_number_of_standard_solutions@plt>
mov    %eax,-0xc(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
mov    -0x4(%rbp),%esi
lea    0xe91(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%ecx
mov    %ecx,%eax
lea    0x5(%rax,%rax,1),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rcx
mov    -0x4(%rbp),%edi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <solcon_retrieve_next_standard_solution@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11dc <standard_next_retrievals+0x9c>
cvtsi2sdl -0x14(%rbp),%xmm0
lea    0xe61(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    124c <standard_next_retrievals+0x10c>
cvtsi2sdl -0x14(%rbp),%xmm0
lea    0xe62(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1247 <standard_next_retrievals+0x107>
mov    -0x30(%rbp),%rax
mov    -0x10(%rbp),%ecx
shl    $0x1,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%ecx
shl    $0x1,%ecx
add    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0xe32(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11f6 <standard_next_retrievals+0xb6>
jmp    124c <standard_next_retrievals+0x10c>
jmp    1251 <standard_next_retrievals+0x111>
cmpl   $0x0,-0x14(%rbp)
jg     11a3 <standard_next_retrievals+0x63>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<standard_next_retrievals>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    -0x2c(%rbp),%rdi
call   1060 <solcon_dimension_of_standard_solutions@plt>
lea    -0x34(%rbp),%rdi
call   1050 <solcon_number_of_standard_solutions@plt>
cvtsi2sdl -0x34(%rbp),%xmm0
mov    -0x2c(%rbp),%esi
lea    0xe8e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %rsp,-0x40(%rbp)
mov    -0x2c(%rbp),%eax
add    %eax,%eax
add    $0x5,%eax
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rcx
mov    %rcx,%r13
sub    %rax,%r13
mov    %r13,%rsp
neg    %rax
add    %rcx,%rax
add    $0x18,%rax
mov    %rax,-0x48(%rbp)
lea    -0x4c(%rbp),%r15
lea    0xeae(%rip),%rbx
jmp    11d4 <standard_next_retrievals+0x94>
nopl   0x0(%rax,%rax,1)
lea    0xe6a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x30(%rbp)
jle    123a <standard_next_retrievals+0xfa>
mov    -0x2c(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    %r15,%rdx
mov    %r13,%rcx
call   1040 <solcon_retrieve_next_standard_solution@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl -0x30(%rbp),%xmm0
test   %eax,%eax
jne    11c0 <standard_next_retrievals+0x80>
lea    0xe51(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    11ce <standard_next_retrievals+0x8e>
mov    -0x48(%rbp),%r12
xor    %r14d,%r14d
nopl   (%rax)
movsd  -0x8(%r12),%xmm0
movsd  (%r12),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
call   1030 <printf@plt>
add    $0x1,%r14
movslq -0x2c(%rbp),%rax
add    $0x10,%r12
cmp    %rax,%r14
jl     1210 <standard_next_retrievals+0xd0>
jmp    11ce <standard_next_retrievals+0x8e>
mov    -0x40(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [49 x i8] c"The container has %d solutions of dimension %d.\0A\00"
@.str.1 = [25 x i8] c"return value of k is %d\0A\00"
@.str.2 = [26 x i8] c"The solution vector %d :\0A\00"
@.str.3 = [15 x i8] c" %.15e %.15e\0A\00"
define void @standard_next_retrievals() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
%9 = call i32 @solcon_dimension_of_standard_solutions(i32* %1)
store i32 %9, i32* %3
%10 = call i32 @solcon_number_of_standard_solutions(i32* %2)
store i32 %10, i32* %3
%11 = load i32, i32* %2
%12 = sitofp i32 %11 to double
%13 = load i32, i32* %1
%14 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), double %12, i32 %13)
%15 = load i32, i32* %1
%16 = mul nsw i32 2, %15
%17 = add nsw i32 %16, 5
%18 = zext i32 %17 to i64
%19 = call i8* @llvm.stacksave()
store i8* %19, i8** %7
%20 = alloca double, i64 %18
store i64 %18, i64* %8
br label %21
21: ; preds = %58, %0
%22 = load i32, i32* %1
%23 = call i32 @solcon_retrieve_next_standard_solution(i32 %22, i32* %5, i32* %6, double* %20)
store i32 %23, i32* %3
%24 = load i32, i32* %3
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %21
%27 = load i32, i32* %5
%28 = sitofp i32 %27 to double
%29 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), double %28)
br label %57
30: ; preds = %21
%31 = load i32, i32* %5
%32 = sitofp i32 %31 to double
%33 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), double %32)
store i32 0, i32* %4
br label %34
34: ; preds = %53, %30
%35 = load i32, i32* %4
%36 = load i32, i32* %1
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %56
38: ; preds = %34
%39 = load i32, i32* %4
%40 = mul nsw i32 2, %39
%41 = add nsw i32 2, %40
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %20, i64 %42
%44 = load double, double* %43
%45 = load i32, i32* %4
%46 = mul nsw i32 2, %45
%47 = add nsw i32 2, %46
%48 = add nsw i32 %47, 1
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %20, i64 %49
%51 = load double, double* %50
%52 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %44, double %51)
br label %53
53: ; preds = %38
%54 = load i32, i32* %4
%55 = add nsw i32 %54, 1
store i32 %55, i32* %4
br label %34
56: ; preds = %34
br label %57
57: ; preds = %56, %26
br label %58
58: ; preds = %57
%59 = load i32, i32* %5
%60 = icmp sgt i32 %59, 0
br i1 %60, label %21, label %61
61: ; preds = %58
%62 = load i8*, i8** %7
ret void
}

LLVM IR (-O2):
@.str = [49 x i8] c"The container has %d solutions of dimension %d.\0A\00"
@.str.1 = [25 x i8] c"return value of k is %d\0A\00"
@.str.2 = [26 x i8] c"The solution vector %d :\0A\00"
@.str.3 = [15 x i8] c" %.15e %.15e\0A\00"
define void @standard_next_retrievals() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = call i32 @solcon_dimension_of_standard_solutions(i32* %1)
%8 = call i32 @solcon_number_of_standard_solutions(i32* %2)
%9 = load i32, i32* %2
%10 = sitofp i32 %9 to double
%11 = load i32, i32* %1
%12 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), double %10, i32 %11)
%13 = bitcast i32* %3 to i8*
%14 = bitcast i32* %4 to i8*
%15 = load i32, i32* %1
%16 = shl nsw i32 %15, 1
%17 = add nsw i32 %16, 5
%18 = zext i32 %17 to i64
%19 = call i8* @llvm.stacksave()
%20 = alloca double, i64 %18
br label %21
21: ; preds = %47, %0
%22 = load i32, i32* %1
%23 = call i32 @solcon_retrieve_next_standard_solution(i32 %22, i32* %3, i32* %4, double* %20)
%24 = icmp eq i32 %23, 0
%25 = load i32, i32* %3
%26 = sitofp i32 %25 to double
br i1 %24, label %29, label %27
27: ; preds = %21
%28 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), double %26)
br label %47
29: ; preds = %21
%30 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), double %26)
%31 = load i32, i32* %1
%32 = icmp sgt i32 %31, 0
br i1 %32, label %33, label %47
33: ; preds = %29, %33
%34 = phi i64 [ %43, %33 ], [ 0, %29 ]
%35 = shl nuw nsw i64 %34, 1
%36 = add nuw nsw i64 %35, 2
%37 = getelementptr inbounds double, double* %20, i64 %36
%38 = load double, double* %37
%39 = add nuw nsw i64 %35, 3
%40 = getelementptr inbounds double, double* %20, i64 %39
%41 = load double, double* %40
%42 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %38, double %41)
%43 = add nuw nsw i64 %34, 1
%44 = load i32, i32* %1
%45 = sext i32 %44 to i64
%46 = icmp slt i64 %43, %45
br i1 %46, label %33, label %47
47: ; preds = %33, %29, %27
%48 = load i32, i32* %3
%49 = icmp sgt i32 %48, 0
br i1 %49, label %21, label %50
50: ; preds = %47
ret void
}