#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int initialize_varbprec_solution(int, int, char *);
int /*<<< orphan*/ printf(char *, ...);
char *read_solution_banner_and_string(int /*<<< orphan*/ *, int, int *, int *);
int /*<<< orphan*/ scanf(char *, int *);
int strlen(char *);
int call_initialize_varbprec_solution(char *name, int *index) {
  FILE *fp;
  char *sol;
  int fail, len, nc, nv;
  fp = fopen(name, "r");
  if (fp == NULL) {
    printf("File with name %s could not be opened for reading!\n", name);
    *index = -1;
    fail = -1;
  } else {
    printf("Give the index of the start solution : ");
    scanf("%d", index);
    sol = read_solution_banner_and_string(fp, *index, &len, &nv);
    printf("Solution %d :\n%s\n", *index, sol);
    nc = strlen(sol);
    fail = initialize_varbprec_solution(nv, nc, sol);
  }
  fclose(fp);
  return fail;
}


x86 assembly (clang, -O0):
<call_initialize_varbprec_solution>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11c7 <call_initialize_varbprec_solution+0x57>
mov    -0x8(%rbp),%rsi
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
movl   $0xffffffff,(%rax)
movl   $0xffffffff,-0x24(%rbp)
jmp    1236 <call_initialize_varbprec_solution+0xc6>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe7e(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    -0x28(%rbp),%rdx
lea    -0x30(%rbp),%rcx
call   1080 <read_solution_banner_and_string@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rdx
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x30(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1070 <initialize_varbprec_solution@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_initialize_varbprec_solution>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xe7a(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%r14
test   %rax,%rax
je     11f6 <call_initialize_varbprec_solution+0x86>
lea    0xe9c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb6(%rip),%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
mov    (%r15),%esi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %r14,%rdi
call   1080 <read_solution_banner_and_string@plt>
mov    %rax,%rbx
mov    (%r15),%esi
lea    0xe8f(%rip),%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    0x8(%rsp),%edi
mov    %eax,%esi
mov    %rbx,%rdx
call   1070 <initialize_varbprec_solution@plt>
mov    %eax,%ebx
jmp    1213 <call_initialize_varbprec_solution+0xa3>
lea    0xe05(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0xffffffff,(%r15)
mov    $0xffffffff,%ebx
mov    %r14,%rdi
call   1030 <fclose@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [52 x i8] c"File with name %s could not be opened for reading!\0A\00"
@.str.2 = [40 x i8] c"Give the index of the start solution : \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [18 x i8] c"Solution %d :\0A%s\0A\00"
define i32 @call_initialize_varbprec_solution(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
%11 = load i8*, i8** %3
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %12, i32** %5
%13 = load i32*, i32** %5
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %19
15: ; preds = %2
%16 = load i8*, i8** %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = load i32*, i32** %4
store i32 -1, i32* %18
store i32 -1, i32* %7
br label %37
19: ; preds = %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%21 = load i32*, i32** %4
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %21)
%23 = load i32*, i32** %5
%24 = load i32*, i32** %4
%25 = load i32, i32* %24
%26 = call i8* @read_solution_banner_and_string(i32* %23, i32 %25, i32* %8, i32* %10)
store i8* %26, i8** %6
%27 = load i32*, i32** %4
%28 = load i32, i32* %27
%29 = load i8*, i8** %6
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %28, i8* %29)
%31 = load i8*, i8** %6
%32 = call i32 @strlen(i8* %31)
store i32 %32, i32* %9
%33 = load i32, i32* %10
%34 = load i32, i32* %9
%35 = load i8*, i8** %6
%36 = call i32 @initialize_varbprec_solution(i32 %33, i32 %34, i8* %35)
store i32 %36, i32* %7
br label %37
37: ; preds = %19, %15
%38 = load i32*, i32** %5
%39 = call i32 @fclose(i32* %38)
%40 = load i32, i32* %7
ret i32 %40
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [52 x i8] c"File with name %s could not be opened for reading!\0A\00"
@.str.2 = [40 x i8] c"Give the index of the start solution : \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [18 x i8] c"Solution %d :\0A%s\0A\00"
define i32 @call_initialize_varbprec_solution(i8* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i8* %0)
store i32 -1, i32* %1
br label %21
11: ; preds = %2
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%14 = load i32, i32* %1
%15 = call i8* @read_solution_banner_and_string(i32* %7, i32 %14, i32* %3, i32* %4)
%16 = load i32, i32* %1
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %16, i8* %15)
%18 = call i32 @strlen(i8* %15)
%19 = load i32, i32* %4
%20 = call i32 @initialize_varbprec_solution(i32 %19, i32 %18, i8* %15)
br label %21
21: ; preds = %11, %9
%22 = phi i32 [ -1, %9 ], [ %20, %11 ]
%23 = call i32 @fclose(i32* %7)
ret i32 %22
}