#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 *);
int solcon_append_standard_solution_string(int, int, char *);
int /*<<< orphan*/ solcon_clear_standard_solutions();
int solcon_dimension_of_standard_solutions(int *);
int solcon_length_standard_solution_string(int, int *);
int solcon_number_of_standard_solutions(int *);
int solcon_read_standard_solutions();
int solcon_write_standard_solution_string(int, int, char *);
int /*<<< orphan*/ solcon_write_standard_solutions();
void parse_solution_strings(void) {
  int fail, len, dim;
  fail = solcon_read_standard_solutions();
  fail = solcon_number_of_standard_solutions(&len);
  fail = solcon_dimension_of_standard_solutions(&dim);
  {
    char *solutions[len];
    int nc[len];
    int k;
    for (k = 0; k < len; k++) {
      fail = solcon_length_standard_solution_string(k + 1, &nc[k]);
      solutions[k] = (char *)calloc(nc[k] + 1, sizeof(char));
      fail =
          solcon_write_standard_solution_string(k + 1, nc[k] + 1, solutions[k]);
    }
    printf("\nCheck for all solution strings ...\n");
    do {
      printf("Give a number less than %d (0 to quit) : ", len + 1);
      scanf("%d", &k);
      if ((k <= 0) || (k > len))
        break;
      printf("Solution %d :\n%s\n", k, solutions[k - 1]);
    } while (k > 0);
    printf("\nClearing the solution container ...\n");
    solcon_clear_standard_solutions();
    printf("\nAppending the solution strings to the container ...\n");
    for (k = 0; k < len; k++)
      fail =
          solcon_append_standard_solution_string(dim, nc[k] + 1, solutions[k]);
    printf("\nThe solutions in the container :\n");
    solcon_write_standard_solutions();
  }
}


x86 assembly (clang, -O0):
<parse_solution_strings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
xor    %eax,%eax
call   10c0 <solcon_read_standard_solutions@plt>
mov    %eax,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1080 <solcon_number_of_standard_solutions@plt>
mov    %eax,-0x4(%rbp)
lea    -0xc(%rbp),%rdi
call   10b0 <solcon_dimension_of_standard_solutions@plt>
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12ac <parse_solution_strings+0xfc>
mov    -0x38(%rbp),%rsi
mov    -0x2c(%rbp),%edi
add    $0x1,%edi
movslq -0x2c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
call   1090 <solcon_length_standard_solution_string@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%rax
mov    %ecx,-0x4(%rbp)
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
add    $0x1,%edi
mov    $0x1,%esi
call   1070 <calloc@plt>
mov    -0x38(%rbp),%rcx
mov    %rax,%rsi
mov    -0x40(%rbp),%rax
movslq -0x2c(%rbp),%rdx
mov    %rsi,(%rax,%rdx,8)
mov    -0x2c(%rbp),%edi
add    $0x1,%edi
movslq -0x2c(%rbp),%rdx
mov    (%rcx,%rdx,4),%esi
add    $0x1,%esi
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
call   1030 <solcon_write_standard_solution_string@plt>
mov    %eax,-0x4(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1228 <parse_solution_strings+0x78>
lea    0xd4d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
lea    0xd5e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd7a(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   10d0 <scanf@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    12f4 <parse_solution_strings+0x144>
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    12f9 <parse_solution_strings+0x149>
jmp    1325 <parse_solution_strings+0x175>
mov    -0x40(%rbp),%rax
mov    -0x2c(%rbp),%esi
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd3e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x2c(%rbp)
jg     12ba <parse_solution_strings+0x10a>
lea    0xd38(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <solcon_clear_standard_solutions@plt>
lea    0xd49(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    138e <parse_solution_strings+0x1de>
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    -0xc(%rbp),%edi
movslq -0x2c(%rbp),%rdx
mov    (%rcx,%rdx,4),%esi
add    $0x1,%esi
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
call   1060 <solcon_append_standard_solution_string@plt>
mov    %eax,-0x4(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    134f <parse_solution_strings+0x19f>
lea    0xd2b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10a0 <solcon_write_standard_solutions@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_solution_strings>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   10d0 <solcon_read_standard_solutions@plt>
lea    -0x30(%rbp),%rdi
call   1090 <solcon_number_of_standard_solutions@plt>
lea    -0x34(%rbp),%rdi
call   10c0 <solcon_dimension_of_standard_solutions@plt>
mov    %rsp,-0x40(%rbp)
mov    -0x30(%rbp),%eax
mov    %rsp,%r13
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
mov    -0x30(%rbp),%eax
mov    %rsp,%r12
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%r12
mov    %r12,%rsp
movl   $0x0,-0x2c(%rbp)
test   %eax,%eax
jle    1274 <parse_solution_strings+0xb4>
xor    %r15d,%r15d
mov    %r12,%rbx
nop
lea    0x1(%r15),%r14
mov    %r14d,%edi
mov    %rbx,%rsi
call   10a0 <solcon_length_standard_solution_string@plt>
mov    (%rbx),%edi
add    $0x1,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,0x0(%r13,%r15,8)
mov    (%rbx),%esi
add    $0x1,%esi
mov    %r14d,%edi
mov    %rax,%rdx
call   1030 <solcon_write_standard_solution_string@plt>
mov    %r14d,-0x2c(%rbp)
add    $0x4,%rbx
mov    %r14,%r15
cmp    -0x30(%rbp),%r14d
jl     1230 <parse_solution_strings+0x70>
lea    0xdc4(%rip),%rdi
call   1050 <puts@plt>
lea    0xda3(%rip),%r15
lea    -0x2c(%rbp),%rbx
lea    0xd9b(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    -0x30(%rbp),%esi
add    $0x1,%esi
lea    0xd53(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   10e0 <scanf@plt>
mov    -0x2c(%rbp),%esi
test   %esi,%esi
jle    12e3 <parse_solution_strings+0x123>
cmp    -0x30(%rbp),%esi
jg     12e3 <parse_solution_strings+0x123>
lea    -0x1(%rsi),%eax
mov    0x0(%r13,%rax,8),%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmpl   $0x0,-0x2c(%rbp)
jg     12a0 <parse_solution_strings+0xe0>
lea    0xd79(%rip),%rdi
call   1050 <puts@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <solcon_clear_standard_solutions@plt>
lea    0xd89(%rip),%rdi
call   1050 <puts@plt>
movl   $0x0,-0x2c(%rbp)
cmpl   $0x0,-0x30(%rbp)
jle    1345 <parse_solution_strings+0x185>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    -0x34(%rbp),%edi
movslq %ebx,%rax
mov    (%r12,%rax,4),%esi
add    $0x1,%esi
mov    0x0(%r13,%rax,8),%rdx
call   1070 <solcon_append_standard_solution_string@plt>
mov    -0x2c(%rbp),%ebx
add    $0x1,%ebx
mov    %ebx,-0x2c(%rbp)
cmp    -0x30(%rbp),%ebx
jl     1320 <parse_solution_strings+0x160>
lea    0xd71(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   10b0 <solcon_write_standard_solutions@plt>
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 = [37 x i8] c"\0ACheck for all solution strings ...\0A\00"
@.str.1 = [42 x i8] c"Give a number less than %d (0 to quit) : \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [18 x i8] c"Solution %d :\0A%s\0A\00"
@.str.4 = [38 x i8] c"\0AClearing the solution container ...\0A\00"
@.str.5 = [54 x i8] c"\0AAppending the solution strings to the container ...\0A\00"
@.str.6 = [35 x i8] c"\0AThe solutions in the container :\0A\00"
define void @parse_solution_strings() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32
%8 = call i32 (...) @solcon_read_standard_solutions()
store i32 %8, i32* %1
%9 = call i32 @solcon_number_of_standard_solutions(i32* %2)
store i32 %9, i32* %1
%10 = call i32 @solcon_dimension_of_standard_solutions(i32* %3)
store i32 %10, i32* %1
%11 = load i32, i32* %2
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %4
%14 = alloca i8*, i64 %12
store i64 %12, i64* %5
%15 = load i32, i32* %2
%16 = zext i32 %15 to i64
%17 = alloca i32, i64 %16
store i64 %16, i64* %6
store i32 0, i32* %7
br label %18
18: ; preds = %51, %0
%19 = load i32, i32* %7
%20 = load i32, i32* %2
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %54
22: ; preds = %18
%23 = load i32, i32* %7
%24 = add nsw i32 %23, 1
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %17, i64 %26
%28 = call i32 @solcon_length_standard_solution_string(i32 %24, i32* %27)
store i32 %28, i32* %1
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %17, i64 %30
%32 = load i32, i32* %31
%33 = add nsw i32 %32, 1
%34 = call i64 @calloc(i32 %33, i32 1)
%35 = inttoptr i64 %34 to i8*
%36 = load i32, i32* %7
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8*, i8** %14, i64 %37
store i8* %35, i8** %38
%39 = load i32, i32* %7
%40 = add nsw i32 %39, 1
%41 = load i32, i32* %7
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i32, i32* %17, i64 %42
%44 = load i32, i32* %43
%45 = add nsw i32 %44, 1
%46 = load i32, i32* %7
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8*, i8** %14, i64 %47
%49 = load i8*, i8** %48
%50 = call i32 @solcon_write_standard_solution_string(i32 %40, i32 %45, i8* %49)
store i32 %50, i32* %1
br label %51
51: ; preds = %22
%52 = load i32, i32* %7
%53 = add nsw i32 %52, 1
store i32 %53, i32* %7
br label %18
54: ; preds = %18
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %56
56: ; preds = %76, %54
%57 = load i32, i32* %2
%58 = add nsw i32 %57, 1
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %58)
%60 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%61 = load i32, i32* %7
%62 = icmp sle i32 %61, 0
br i1 %62, label %67, label %63
63: ; preds = %56
%64 = load i32, i32* %7
%65 = load i32, i32* %2
%66 = icmp sgt i32 %64, %65
br i1 %66, label %67, label %68
67: ; preds = %63, %56
br label %79
68: ; preds = %63
%69 = load i32, i32* %7
%70 = load i32, i32* %7
%71 = sub nsw i32 %70, 1
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8*, i8** %14, i64 %72
%74 = load i8*, i8** %73
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %69, i8* %74)
br label %76
76: ; preds = %68
%77 = load i32, i32* %7
%78 = icmp sgt i32 %77, 0
br i1 %78, label %56, label %79
79: ; preds = %76, %67
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
%81 = call i32 (...) @solcon_clear_standard_solutions()
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %7
br label %83
83: ; preds = %99, %79
%84 = load i32, i32* %7
%85 = load i32, i32* %2
%86 = icmp slt i32 %84, %85
br i1 %86, label %87, label %102
87: ; preds = %83
%88 = load i32, i32* %3
%89 = load i32, i32* %7
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i32, i32* %17, i64 %90
%92 = load i32, i32* %91
%93 = add nsw i32 %92, 1
%94 = load i32, i32* %7
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds i8*, i8** %14, i64 %95
%97 = load i8*, i8** %96
%98 = call i32 @solcon_append_standard_solution_string(i32 %88, i32 %93, i8* %97)
store i32 %98, i32* %1
br label %99
99: ; preds = %87
%100 = load i32, i32* %7
%101 = add nsw i32 %100, 1
store i32 %101, i32* %7
br label %83
102: ; preds = %83
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0))
%104 = call i32 (...) @solcon_write_standard_solutions()
%105 = load i8*, i8** %4
ret void
}

LLVM IR (-O2):
@.str.1 = [42 x i8] c"Give a number less than %d (0 to quit) : \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [18 x i8] c"Solution %d :\0A%s\0A\00"
@str = [36 x i8] c"\0ACheck for all solution strings ...\00"
@str.7 = [37 x i8] c"\0AClearing the solution container ...\00"
@str.8 = [53 x i8] c"\0AAppending the solution strings to the container ...\00"
@str.9 = [34 x i8] c"\0AThe solutions in the container :\00"
define void @parse_solution_strings() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = tail call i32 (...) @solcon_read_standard_solutions()
%7 = call i32 @solcon_number_of_standard_solutions(i32* %1)
%8 = call i32 @solcon_dimension_of_standard_solutions(i32* %2)
%9 = load i32, i32* %1
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
%12 = alloca i8*, i64 %10
%13 = load i32, i32* %1
%14 = zext i32 %13 to i64
%15 = alloca i32, i64 %14
%16 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%17 = icmp sgt i32 %13, 0
br i1 %17, label %18, label %34
18: ; preds = %0, %18
%19 = phi i32 [ %20, %18 ], [ 0, %0 ]
%20 = add nuw nsw i32 %19, 1
%21 = zext i32 %19 to i64
%22 = getelementptr inbounds i32, i32* %15, i64 %21
%23 = call i32 @solcon_length_standard_solution_string(i32 %20, i32* %22)
%24 = load i32, i32* %22
%25 = add nsw i32 %24, 1
%26 = call i64 @calloc(i32 %25, i32 1)
%27 = inttoptr i64 %26 to i8*
%28 = getelementptr inbounds i8*, i8** %12, i64 %21
store i8* %27, i8** %28
%29 = load i32, i32* %22
%30 = add nsw i32 %29, 1
%31 = call i32 @solcon_write_standard_solution_string(i32 %20, i32 %30, i8* %27)
store i32 %20, i32* %3
%32 = load i32, i32* %1
%33 = icmp slt i32 %20, %32
br i1 %33, label %18, label %34
34: ; preds = %18, %0
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
br label %36
36: ; preds = %46, %34
%37 = load i32, i32* %1
%38 = add nsw i32 %37, 1
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %38)
%40 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%41 = load i32, i32* %3
%42 = icmp slt i32 %41, 1
%43 = load i32, i32* %1
%44 = icmp sgt i32 %41, %43
%45 = select i1 %42, i1 true, i1 %44
br i1 %45, label %54, label %46
46: ; preds = %36
%47 = add nsw i32 %41, -1
%48 = zext i32 %47 to i64
%49 = getelementptr inbounds i8*, i8** %12, i64 %48
%50 = load i8*, i8** %49
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %41, i8* %50)
%52 = load i32, i32* %3
%53 = icmp sgt i32 %52, 0
br i1 %53, label %36, label %54
54: ; preds = %36, %46
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.7, i64 0, i64 0))
%56 = call i32 (...) @solcon_clear_standard_solutions()
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.8, i64 0, i64 0))
store i32 0, i32* %3
%58 = load i32, i32* %1
%59 = icmp sgt i32 %58, 0
br i1 %59, label %60, label %74
60: ; preds = %54, %60
%61 = phi i32 [ %71, %60 ], [ 0, %54 ]
%62 = load i32, i32* %2
%63 = sext i32 %61 to i64
%64 = getelementptr inbounds i32, i32* %15, i64 %63
%65 = load i32, i32* %64
%66 = add nsw i32 %65, 1
%67 = getelementptr inbounds i8*, i8** %12, i64 %63
%68 = load i8*, i8** %67
%69 = call i32 @solcon_append_standard_solution_string(i32 %62, i32 %66, i8* %68)
%70 = load i32, i32* %3
%71 = add nsw i32 %70, 1
store i32 %71, i32* %3
%72 = load i32, i32* %1
%73 = icmp slt i32 %71, %72
br i1 %73, label %60, label %74
74: ; preds = %60, %54
%75 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.9, i64 0, i64 0))
%76 = call i32 (...) @solcon_write_standard_solutions()
ret void
}