#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 */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int solcon_append_dobldobl_solution_string(int, int, char *);
int solcon_dimension_of_dobldobl_solutions(int *);
int solcon_length_dobldobl_solution_string(int, int *);
int solcon_number_of_dobldobl_solutions(int *);
int solcon_read_dobldobl_solutions();
int solcon_write_dobldobl_solution_string(int, int, char *);
int solcon_write_dobldobl_solutions();
void test_dobldobl_container(void) {
  int fail, len, dim, k, nc;
  char *solution;
  char ans;
  fail = solcon_read_dobldobl_solutions();
  fail = solcon_write_dobldobl_solutions();
  fail = solcon_number_of_dobldobl_solutions(&len);
  printf("Number of solutions : %d\n", len);
  fail = solcon_dimension_of_dobldobl_solutions(&dim);
  printf("Dimension of vectors : %d\n", dim);
  printf("\nTesting solution string retrieval ...\n\n");
  printf("Give an index to a solution : ");
  scanf("%d", &k);
  scanf("%c", &ans);
  fail = solcon_length_dobldobl_solution_string(k, &nc);
  solution = (char *)calloc(nc + 1, sizeof(char));
  fail = solcon_write_dobldobl_solution_string(k, nc + 1, solution);
  printf("solution %d :\n%s\n", k, solution);
  printf("hit enter to continue with append ...\n");
  scanf("%c", &ans);
  fail = solcon_append_dobldobl_solution_string(dim, nc + 1, solution);
  printf("solutions after the append :\n");
  fail = solcon_write_dobldobl_solutions();
}


x86 assembly (clang, -O0):
<test_dobldobl_container>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x0,%al
call   1070 <solcon_read_dobldobl_solutions@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1060 <solcon_write_dobldobl_solutions@plt>
mov    %eax,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1080 <solcon_number_of_dobldobl_solutions@plt>
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xc(%rbp),%rdi
call   10b0 <solcon_dimension_of_dobldobl_solutions@plt>
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe64(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   10a0 <scanf@plt>
lea    0xe55(%rip),%rdi
lea    -0x21(%rbp),%rsi
mov    $0x0,%al
call   10a0 <scanf@plt>
mov    -0x10(%rbp),%edi
lea    -0x14(%rbp),%rsi
call   1030 <solcon_length_dobldobl_solution_string@plt>
mov    %eax,-0x4(%rbp)
mov    -0x14(%rbp),%edi
add    $0x1,%edi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x20(%rbp),%rdx
call   1090 <solcon_write_dobldobl_solution_string@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x20(%rbp),%rdx
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xde8(%rip),%rdi
lea    -0x21(%rbp),%rsi
mov    $0x0,%al
call   10a0 <scanf@plt>
mov    -0xc(%rbp),%edi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x20(%rbp),%rdx
call   10c0 <solcon_append_dobldobl_solution_string@plt>
mov    %eax,-0x4(%rbp)
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <solcon_write_dobldobl_solutions@plt>
mov    %eax,-0x4(%rbp)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_dobldobl_container>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
xor    %eax,%eax
call   1080 <solcon_read_dobldobl_solutions@plt>
xor    %eax,%eax
call   1070 <solcon_write_dobldobl_solutions@plt>
lea    0x1c(%rsp),%rdi
call   1090 <solcon_number_of_dobldobl_solutions@plt>
mov    0x1c(%rsp),%esi
lea    0xe24(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x18(%rsp),%rdi
call   10c0 <solcon_dimension_of_dobldobl_solutions@plt>
mov    0x18(%rsp),%esi
lea    0xe22(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe66(%rip),%rdi
call   1040 <puts@plt>
lea    0xe23(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe34(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
lea    0xe24(%rip),%r15
lea    0x17(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
mov    0x10(%rsp),%edi
lea    0xc(%rsp),%rsi
call   1030 <solcon_length_dobldobl_solution_string@plt>
mov    0xc(%rsp),%edi
add    $0x1,%edi
mov    $0x1,%esi
call   1060 <calloc@plt>
mov    %rax,%rbx
mov    0x10(%rsp),%edi
mov    0xc(%rsp),%esi
add    $0x1,%esi
mov    %rax,%rdx
call   10a0 <solcon_write_dobldobl_solution_string@plt>
mov    0x10(%rsp),%esi
lea    0xdd5(%rip),%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdfe(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
mov    0x18(%rsp),%edi
mov    0xc(%rsp),%esi
add    $0x1,%esi
mov    %rbx,%rdx
call   10d0 <solcon_append_dobldobl_solution_string@plt>
lea    0xdf8(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1070 <solcon_write_dobldobl_solutions@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Number of solutions : %d\0A\00"
@.str.1 = [27 x i8] c"Dimension of vectors : %d\0A\00"
@.str.2 = [41 x i8] c"\0ATesting solution string retrieval ...\0A\0A\00"
@.str.3 = [31 x i8] c"Give an index to a solution : \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [18 x i8] c"solution %d :\0A%s\0A\00"
@.str.7 = [39 x i8] c"hit enter to continue with append ...\0A\00"
@.str.8 = [30 x i8] c"solutions after the append :\0A\00"
define void @test_dobldobl_container() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8
%8 = call i32 (...) @solcon_read_dobldobl_solutions()
store i32 %8, i32* %1
%9 = call i32 (...) @solcon_write_dobldobl_solutions()
store i32 %9, i32* %1
%10 = call i32 @solcon_number_of_dobldobl_solutions(i32* %2)
store i32 %10, i32* %1
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 @solcon_dimension_of_dobldobl_solutions(i32* %3)
store i32 %13, i32* %1
%14 = load i32, i32* %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %4)
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %7)
%20 = load i32, i32* %4
%21 = call i32 @solcon_length_dobldobl_solution_string(i32 %20, i32* %5)
store i32 %21, i32* %1
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
%24 = call i64 @calloc(i32 %23, i32 1)
%25 = inttoptr i64 %24 to i8*
store i8* %25, i8** %6
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
%29 = load i8*, i8** %6
%30 = call i32 @solcon_write_dobldobl_solution_string(i32 %26, i32 %28, i8* %29)
store i32 %30, i32* %1
%31 = load i32, i32* %4
%32 = load i8*, i8** %6
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %31, i8* %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0))
%35 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %7)
%36 = load i32, i32* %3
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
%39 = load i8*, i8** %6
%40 = call i32 @solcon_append_dobldobl_solution_string(i32 %36, i32 %38, i8* %39)
store i32 %40, i32* %1
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0))
%42 = call i32 (...) @solcon_write_dobldobl_solutions()
store i32 %42, i32* %1
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Number of solutions : %d\0A\00"
@.str.1 = [27 x i8] c"Dimension of vectors : %d\0A\00"
@.str.3 = [31 x i8] c"Give an index to a solution : \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [18 x i8] c"solution %d :\0A%s\0A\00"
@str = [40 x i8] c"\0ATesting solution string retrieval ...\0A\00"
@str.9 = [38 x i8] c"hit enter to continue with append ...\00"
@str.10 = [29 x i8] c"solutions after the append :\00"
define void @test_dobldobl_container() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = tail call i32 (...) @solcon_read_dobldobl_solutions()
%11 = tail call i32 (...) @solcon_write_dobldobl_solutions()
%12 = call i32 @solcon_number_of_dobldobl_solutions(i32* %1)
%13 = load i32, i32* %1
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = call i32 @solcon_dimension_of_dobldobl_solutions(i32* %2)
%16 = load i32, i32* %2
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %3)
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %5)
%22 = load i32, i32* %3
%23 = call i32 @solcon_length_dobldobl_solution_string(i32 %22, i32* %4)
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
%26 = call i64 @calloc(i32 %25, i32 1)
%27 = inttoptr i64 %26 to i8*
%28 = load i32, i32* %3
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
%31 = call i32 @solcon_write_dobldobl_solution_string(i32 %28, i32 %30, i8* %27)
%32 = load i32, i32* %3
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %32, i8* %27)
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.9, i64 0, i64 0))
%35 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %5)
%36 = load i32, i32* %2
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
%39 = call i32 @solcon_append_dobldobl_solution_string(i32 %36, i32 %38, i8* %27)
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.10, i64 0, i64 0))
%41 = call i32 (...) @solcon_write_dobldobl_solutions()
ret void
}