#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 /*<<< orphan*/ scanf(char *, int *);
int solcon_length_solution_diagnostics(int, int *);
int solcon_length_solution_intro(int, int *);
int solcon_length_solution_vector(int, int *);
int solcon_length_standard_solution_string(int, int *);
int solcon_number_of_standard_solutions(int *);
int solcon_read_standard_solutions();
int solcon_write_solution_diagnostics(int, int, char *);
int solcon_write_solution_intro(int, int, char *);
int solcon_write_solution_vector(int, int, char *);
int solcon_write_standard_solution_string(int, int, char *);
void test_solution_strings(void) {
  int len, fail, k, n, n0, n1, n2;
  fail = solcon_read_standard_solutions();
  fail = solcon_number_of_standard_solutions(&len);
  printf("Number of solutions : %d\n", len);
  printf("Give solution number : ");
  scanf("%d", &k);
  fail = solcon_length_standard_solution_string(k, &n);
  fail = solcon_length_solution_intro(k, &n0);
  fail = solcon_length_solution_vector(k, &n1);
  fail = solcon_length_solution_diagnostics(k, &n2);
  printf("Length of solution %d : %d = %d + %d + %d\n", k, n, n0, n1, n2);
  {
    char s[n + 1], s0[n0 + 1], s1[n1 + 1], s2[n2 + 1];
    fail = solcon_write_standard_solution_string(k, n, s);
    printf("Solution %d as string :\n%s\n", k, s);
    fail = solcon_write_solution_intro(k, n0, s0);
    printf("introduction to solution %d :\n%s", k, s0);
    fail = solcon_write_solution_vector(k, n1, s1);
    printf("vector in the solution %d :\n%s", k, s1);
    fail = solcon_write_solution_diagnostics(k, n2, s2);
    printf("diagnostics of the solution %d :\n%s", k, s2);
  }
}


x86 assembly (clang, -O0):
<test_solution_strings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
xor    %eax,%eax
mov    %al,-0x69(%rbp)
call   10b0 <solcon_read_standard_solutions@plt>
mov    %eax,-0x8(%rbp)
lea    -0x4(%rbp),%rdi
call   1090 <solcon_number_of_standard_solutions@plt>
mov    %eax,%ecx
mov    -0x69(%rbp),%al
mov    %ecx,-0x8(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe10(%rip),%rdi
call   1070 <printf@plt>
mov    -0x69(%rbp),%al
lea    0xe1b(%rip),%rdi
call   1070 <printf@plt>
lea    0xe27(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   10e0 <scanf@plt>
mov    -0xc(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   10a0 <solcon_length_standard_solution_string@plt>
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x14(%rbp),%rsi
call   10c0 <solcon_length_solution_intro@plt>
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1060 <solcon_length_solution_vector@plt>
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x1c(%rbp),%rsi
call   1050 <solcon_length_solution_diagnostics@plt>
mov    %eax,%ecx
mov    -0x69(%rbp),%al
mov    %ecx,-0x8(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
lea    0xdc8(%rip),%rdi
call   1070 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x68(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %rax,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rcx
sub    %rsi,%rcx
mov    %rcx,-0x60(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %rax,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rcx
sub    %rsi,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %rax,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rcx
sub    %rsi,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <solcon_write_standard_solution_string@plt>
mov    -0x68(%rbp),%rdx
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
lea    0xd43(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x60(%rbp),%rdx
mov    -0xc(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <solcon_write_solution_intro@plt>
mov    -0x60(%rbp),%rdx
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
lea    0xd38(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x58(%rbp),%rdx
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%esi
call   10d0 <solcon_write_solution_vector@plt>
mov    -0x58(%rbp),%rdx
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
lea    0xd32(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x50(%rbp),%rdx
mov    -0xc(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1080 <solcon_write_solution_diagnostics@plt>
mov    -0x50(%rbp),%rdx
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
lea    0xd2a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_solution_strings>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   10b0 <solcon_read_standard_solutions@plt>
lea    -0x40(%rbp),%rdi
call   1090 <solcon_number_of_standard_solutions@plt>
mov    -0x40(%rbp),%esi
lea    0xe15(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe21(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe2b(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   10e0 <scanf@plt>
mov    -0x2c(%rbp),%edi
lea    -0x3c(%rbp),%rsi
call   10a0 <solcon_length_standard_solution_string@plt>
mov    -0x2c(%rbp),%edi
lea    -0x38(%rbp),%rsi
call   10c0 <solcon_length_solution_intro@plt>
mov    -0x2c(%rbp),%edi
lea    -0x34(%rbp),%rsi
call   1060 <solcon_length_solution_vector@plt>
mov    -0x2c(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1050 <solcon_length_solution_diagnostics@plt>
mov    -0x2c(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    -0x38(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    -0x30(%rbp),%r9d
lea    0xddd(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rsp,%r13
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%r12
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%r15
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    -0x2c(%rbp),%edi
mov    -0x3c(%rbp),%esi
mov    %rbx,%rdx
call   1030 <solcon_write_standard_solution_string@plt>
mov    -0x2c(%rbp),%esi
lea    0xd8a(%rip),%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    -0x2c(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    %r12,%rdx
call   1040 <solcon_write_solution_intro@plt>
mov    -0x2c(%rbp),%esi
lea    0xd84(%rip),%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    -0x2c(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    %r15,%rdx
call   10d0 <solcon_write_solution_vector@plt>
mov    -0x2c(%rbp),%esi
lea    0xd83(%rip),%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    -0x2c(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    %r14,%rdx
call   1080 <solcon_write_solution_diagnostics@plt>
mov    -0x2c(%rbp),%esi
lea    0xd80(%rip),%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r13,%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"Number of solutions : %d\0A\00"
@.str.1 = [24 x i8] c"Give solution number : \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [43 x i8] c"Length of solution %d : %d = %d + %d + %d\0A\00"
@.str.4 = [28 x i8] c"Solution %d as string :\0A%s\0A\00"
@.str.5 = [33 x i8] c"introduction to solution %d :\0A%s\00"
@.str.6 = [31 x i8] c"vector in the solution %d :\0A%s\00"
@.str.7 = [36 x i8] c"diagnostics of the solution %d :\0A%s\00"
define void @test_solution_strings() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = call i32 (...) @solcon_read_standard_solutions()
store i32 %13, i32* %2
%14 = call i32 @solcon_number_of_standard_solutions(i32* %1)
store i32 %14, i32* %2
%15 = load i32, i32* %1
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%19 = load i32, i32* %3
%20 = call i32 @solcon_length_standard_solution_string(i32 %19, i32* %4)
store i32 %20, i32* %2
%21 = load i32, i32* %3
%22 = call i32 @solcon_length_solution_intro(i32 %21, i32* %5)
store i32 %22, i32* %2
%23 = load i32, i32* %3
%24 = call i32 @solcon_length_solution_vector(i32 %23, i32* %6)
store i32 %24, i32* %2
%25 = load i32, i32* %3
%26 = call i32 @solcon_length_solution_diagnostics(i32 %25, i32* %7)
store i32 %26, i32* %2
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = load i32, i32* %5
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i32 %27, i32 %28, i32 %29, i32 %30, i32 %31)
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
%35 = zext i32 %34 to i64
%36 = call i8* @llvm.stacksave()
store i8* %36, i8** %8
%37 = alloca i8, i64 %35
store i64 %35, i64* %9
%38 = load i32, i32* %5
%39 = add nsw i32 %38, 1
%40 = zext i32 %39 to i64
%41 = alloca i8, i64 %40
store i64 %40, i64* %10
%42 = load i32, i32* %6
%43 = add nsw i32 %42, 1
%44 = zext i32 %43 to i64
%45 = alloca i8, i64 %44
store i64 %44, i64* %11
%46 = load i32, i32* %7
%47 = add nsw i32 %46, 1
%48 = zext i32 %47 to i64
%49 = alloca i8, i64 %48
store i64 %48, i64* %12
%50 = load i32, i32* %3
%51 = load i32, i32* %4
%52 = call i32 @solcon_write_standard_solution_string(i32 %50, i32 %51, i8* %37)
store i32 %52, i32* %2
%53 = load i32, i32* %3
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i32 %53, i8* %37)
%55 = load i32, i32* %3
%56 = load i32, i32* %5
%57 = call i32 @solcon_write_solution_intro(i32 %55, i32 %56, i8* %41)
store i32 %57, i32* %2
%58 = load i32, i32* %3
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 %58, i8* %41)
%60 = load i32, i32* %3
%61 = load i32, i32* %6
%62 = call i32 @solcon_write_solution_vector(i32 %60, i32 %61, i8* %45)
store i32 %62, i32* %2
%63 = load i32, i32* %3
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i32 %63, i8* %45)
%65 = load i32, i32* %3
%66 = load i32, i32* %7
%67 = call i32 @solcon_write_solution_diagnostics(i32 %65, i32 %66, i8* %49)
store i32 %67, i32* %2
%68 = load i32, i32* %3
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0), i32 %68, i8* %49)
%70 = load i8*, i8** %8
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Number of solutions : %d\0A\00"
@.str.1 = [24 x i8] c"Give solution number : \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [43 x i8] c"Length of solution %d : %d = %d + %d + %d\0A\00"
@.str.4 = [28 x i8] c"Solution %d as string :\0A%s\0A\00"
@.str.5 = [33 x i8] c"introduction to solution %d :\0A%s\00"
@.str.6 = [31 x i8] c"vector in the solution %d :\0A%s\00"
@.str.7 = [36 x i8] c"diagnostics of the solution %d :\0A%s\00"
define void @test_solution_strings() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = tail call i32 (...) @solcon_read_standard_solutions()
%14 = call i32 @solcon_number_of_standard_solutions(i32* %1)
%15 = load i32, i32* %1
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%19 = load i32, i32* %2
%20 = call i32 @solcon_length_standard_solution_string(i32 %19, i32* %3)
%21 = load i32, i32* %2
%22 = call i32 @solcon_length_solution_intro(i32 %21, i32* %4)
%23 = load i32, i32* %2
%24 = call i32 @solcon_length_solution_vector(i32 %23, i32* %5)
%25 = load i32, i32* %2
%26 = call i32 @solcon_length_solution_diagnostics(i32 %25, i32* %6)
%27 = load i32, i32* %2
%28 = load i32, i32* %3
%29 = load i32, i32* %4
%30 = load i32, i32* %5
%31 = load i32, i32* %6
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i32 %27, i32 %28, i32 %29, i32 %30, i32 %31)
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
%35 = zext i32 %34 to i64
%36 = call i8* @llvm.stacksave()
%37 = alloca i8, i64 %35
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
%40 = zext i32 %39 to i64
%41 = alloca i8, i64 %40
%42 = load i32, i32* %5
%43 = add nsw i32 %42, 1
%44 = zext i32 %43 to i64
%45 = alloca i8, i64 %44
%46 = load i32, i32* %6
%47 = add nsw i32 %46, 1
%48 = zext i32 %47 to i64
%49 = alloca i8, i64 %48
%50 = load i32, i32* %2
%51 = load i32, i32* %3
%52 = call i32 @solcon_write_standard_solution_string(i32 %50, i32 %51, i8* %37)
%53 = load i32, i32* %2
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i32 %53, i8* %37)
%55 = load i32, i32* %2
%56 = load i32, i32* %4
%57 = call i32 @solcon_write_solution_intro(i32 %55, i32 %56, i8* %41)
%58 = load i32, i32* %2
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 %58, i8* %41)
%60 = load i32, i32* %2
%61 = load i32, i32* %5
%62 = call i32 @solcon_write_solution_vector(i32 %60, i32 %61, i8* %45)
%63 = load i32, i32* %2
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i32 %63, i8* %45)
%65 = load i32, i32* %2
%66 = load i32, i32* %6
%67 = call i32 @solcon_write_solution_diagnostics(i32 %65, i32 %66, i8* %49)
%68 = load i32, i32* %2
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0), i32 %68, i8* %49)
ret void
}