#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 solcon_retrieve_standard_solution(int, int, int *, double *);
void retrieve_and_write(int n, int k) {
  int i, m, fail;
  double sol[2 * n + 5];
  fail = solcon_retrieve_standard_solution(n, k, &m, sol);
  if (fail == 1)
    printf("some failure occurred...\n");
  else {
    printf("The solution vector :\n");
    for (i = 0; i < n; i++)
      printf(" %.15e  %.15e\n", sol[2 + 2 * i], sol[2 + 2 * i + 1]);
  }
}


x86 assembly (clang, -O0):
<retrieve_and_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
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    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    -0x10(%rbp),%rdx
call   1040 <solcon_retrieve_standard_solution@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    118a <retrieve_and_write+0x6a>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f5 <retrieve_and_write+0xd5>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11f0 <retrieve_and_write+0xd0>
mov    -0x30(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
add    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0xe56(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    119f <retrieve_and_write+0x7f>
jmp    11f5 <retrieve_and_write+0xd5>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<retrieve_and_write>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r14d
mov    %rsp,%r15
lea    (%r14,%r14,1),%eax
add    $0x5,%eax
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%r13
sub    %rax,%r13
mov    %r13,%rsp
lea    -0x2c(%rbp),%rdx
mov    %r13,%rcx
call   1050 <solcon_retrieve_standard_solution@plt>
cmp    $0x1,%eax
jne    117f <retrieve_and_write+0x4f>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
jmp    11c1 <retrieve_and_write+0x91>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
test   %r14d,%r14d
jle    11c1 <retrieve_and_write+0x91>
mov    %r14d,%r12d
shl    $0x4,%r12
xor    %ebx,%ebx
lea    0xe60(%rip),%r14
movsd  0x10(%r13,%rbx,1),%xmm0
movsd  0x18(%r13,%rbx,1),%xmm1
mov    %r14,%rdi
mov    $0x2,%al
call   1040 <printf@plt>
add    $0x10,%rbx
cmp    %rbx,%r12
jne    11a0 <retrieve_and_write+0x70>
mov    %r15,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"some failure occurred...\0A\00"
@.str.1 = [23 x i8] c"The solution vector :\0A\00"
@.str.2 = [15 x i8] c" %.15e %.15e\0A\00"
define void @retrieve_and_write(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
store i32 %0, i32* %3
store i32 %1, i32* %4
%10 = load i32, i32* %3
%11 = mul nsw i32 2, %10
%12 = add nsw i32 %11, 5
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %8
%15 = alloca double, i64 %13
store i64 %13, i64* %9
%16 = load i32, i32* %3
%17 = load i32, i32* %4
%18 = call i32 @solcon_retrieve_standard_solution(i32 %16, i32 %17, i32* %6, double* %15)
store i32 %18, i32* %7
%19 = load i32, i32* %7
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %23
21: ; preds = %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %48
23: ; preds = %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %25
25: ; preds = %44, %23
%26 = load i32, i32* %5
%27 = load i32, i32* %3
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %47
29: ; preds = %25
%30 = load i32, i32* %5
%31 = mul nsw i32 2, %30
%32 = add nsw i32 2, %31
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %15, i64 %33
%35 = load double, double* %34
%36 = load i32, i32* %5
%37 = mul nsw i32 2, %36
%38 = add nsw i32 2, %37
%39 = add nsw i32 %38, 1
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %15, i64 %40
%42 = load double, double* %41
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), double %35, double %42)
br label %44
44: ; preds = %29
%45 = load i32, i32* %5
%46 = add nsw i32 %45, 1
store i32 %46, i32* %5
br label %25
47: ; preds = %25
br label %48
48: ; preds = %47, %21
%49 = load i8*, i8** %8
ret void
}

LLVM IR (-O2):
@.str.2 = [15 x i8] c" %.15e %.15e\0A\00"
@str = [22 x i8] c"The solution vector :\00"
@str.3 = [25 x i8] c"some failure occurred...\00"
define void @retrieve_and_write(i32 %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = shl nsw i32 %0, 1
%6 = add nsw i32 %5, 5
%7 = zext i32 %6 to i64
%8 = tail call i8* @llvm.stacksave()
%9 = alloca double, i64 %7
%10 = call i32 @solcon_retrieve_standard_solution(i32 %0, i32 %1, i32* %3, double* %9)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.3, i64 0, i64 0))
br label %31
14: ; preds = %2
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%16 = icmp sgt i32 %0, 0
br i1 %16, label %17, label %31
17: ; preds = %14
%18 = zext i32 %0 to i64
br label %19
19: ; preds = %17, %19
%20 = phi i64 [ 0, %17 ], [ %29, %19 ]
%21 = shl nuw nsw i64 %20, 1
%22 = add nuw nsw i64 %21, 2
%23 = getelementptr inbounds double, double* %9, i64 %22
%24 = load double, double* %23
%25 = add nuw nsw i64 %21, 3
%26 = getelementptr inbounds double, double* %9, i64 %25
%27 = load double, double* %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), double %24, double %27)
%29 = add nuw nsw i64 %20, 1
%30 = icmp eq i64 %29, %18
br i1 %30, label %31, label %19
31: ; preds = %19, %14, %12
ret void
}