#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, char *);
int solcon_length_standard_solution_string(int, int *);
int solcon_write_standard_solution_string(int, int, char *);
int write_standard_solution(int index) {
  int fail, nb;
  fail = solcon_length_standard_solution_string(index, &nb);
  {
    char solution[nb];
    fail = solcon_write_standard_solution_string(index, nb, solution);
    printf("\nsolution %d :\n%s\n", index, solution);
  }
  return fail;
}


x86 assembly (clang, -O0):
<write_standard_solution>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0xc(%rbp),%rsi
call   1050 <solcon_length_standard_solution_string@plt>
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x28(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <solcon_write_standard_solution_string@plt>
mov    -0x28(%rbp),%rdx
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe74(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x8(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_standard_solution>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %edi,%r14d
lea    -0x24(%rbp),%rsi
call   1050 <solcon_length_standard_solution_string@plt>
mov    %rsp,%r12
mov    -0x24(%rbp),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    -0x24(%rbp),%esi
mov    %r14d,%edi
mov    %rbx,%rdx
call   1030 <solcon_write_standard_solution_string@plt>
mov    %eax,%r15d
lea    0xe86(%rip),%rdi
mov    %r14d,%esi
mov    %rbx,%rdx
call   1040 <printf@plt>
mov    %r12,%rsp
mov    %r15d,%eax
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"\0Asolution %d :\0A%s\0A\00"
define i32 @write_standard_solution(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = call i32 @solcon_length_standard_solution_string(i32 %7, i32* %4)
store i32 %8, i32* %3
%9 = load i32, i32* %4
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %5
%12 = alloca i8, i64 %10
store i64 %10, i64* %6
%13 = load i32, i32* %2
%14 = load i32, i32* %4
%15 = call i32 @solcon_write_standard_solution_string(i32 %13, i32 %14, i8* %12)
store i32 %15, i32* %3
%16 = load i32, i32* %2
%17 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %16, i8* %12)
%18 = load i8*, i8** %5
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@.str = [19 x i8] c"\0Asolution %d :\0A%s\0A\00"
define i32 @write_standard_solution(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @solcon_length_standard_solution_string(i32 %0, i32* %2)
%5 = load i32, i32* %2
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
%8 = alloca i8, i64 %6
%9 = load i32, i32* %2
%10 = call i32 @solcon_write_standard_solution_string(i32 %0, i32 %9, i8* %8)
%11 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %8)
ret i32 %10
}