#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 copy_container_to_start_system();
int copy_start_system_to_container();
int define_output_file();
int /*<<< orphan*/ printf(char *, ...);
int read_named_linear_product_start_system(int, char *);
int read_named_start_without_solutions(int, char *);
int read_target_system_without_solutions();
int /*<<< orphan*/ scanf(char *, char *);
int solcon_scan_solution_banner();
scalar_t__ strlen(char *);
int syscon_sort_embed_symbols(int *);
int read_file_names(int kind) {
  int fail, n, dim;
  char start[80], ch;
  if (kind < 4)
    fail = read_target_system_without_solutions();
  printf("\nReading the name of the file for the start system...");
  printf("\nGive a string of characters : ");
  scanf("%s", start);
  scanf("%c", &ch);
  fail = define_output_file();
  n = (int)strlen(start);
  if (kind == 2)
    fail = read_named_linear_product_start_system(n, start);
  else
    fail = read_named_start_without_solutions(n, start);
  if (kind >= 3)
    fail = solcon_scan_solution_banner();
  if (kind == 4) {
    fail = copy_start_system_to_container();
    fail = syscon_sort_embed_symbols(&dim);
    printf("the top dimension is %d\n", dim);
    fail = copy_container_to_start_system();
  }
  return fail;
}


x86 assembly (clang, -O0):
<read_file_names>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
jge    11cf <read_file_names+0x1f>
mov    $0x0,%al
call   10b0 <read_target_system_without_solutions@plt>
mov    %eax,-0x8(%rbp)
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xe60(%rip),%rdi
call   10c0 <scanf@plt>
lea    0xe57(%rip),%rdi
lea    -0x61(%rbp),%rsi
call   10c0 <scanf@plt>
mov    $0x0,%al
call   1060 <define_output_file@plt>
mov    %eax,-0x8(%rbp)
lea    -0x60(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x2,-0x4(%rbp)
jne    123f <read_file_names+0x8f>
mov    -0xc(%rbp),%edi
lea    -0x60(%rbp),%rsi
call   1080 <read_named_linear_product_start_system@plt>
mov    %eax,-0x8(%rbp)
jmp    124e <read_file_names+0x9e>
mov    -0xc(%rbp),%edi
lea    -0x60(%rbp),%rsi
call   10d0 <read_named_start_without_solutions@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x3,-0x4(%rbp)
jl     1262 <read_file_names+0xb2>
mov    $0x0,%al
call   1050 <solcon_scan_solution_banner@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x4,-0x4(%rbp)
jne    129d <read_file_names+0xed>
mov    $0x0,%al
call   10a0 <copy_start_system_to_container@plt>
mov    %eax,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
call   1070 <syscon_sort_embed_symbols@plt>
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%esi
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1090 <copy_container_to_start_system@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_file_names>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %edi,%ebx
cmp    $0x3,%edi
jg     11c5 <read_file_names+0x15>
xor    %eax,%eax
call   10b0 <read_target_system_without_solutions@plt>
lea    0xe34(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe5c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe6e(%rip),%rdi
lea    0x10(%rsp),%r14
mov    %r14,%rsi
call   10c0 <scanf@plt>
lea    0xe5d(%rip),%rdi
lea    0xb(%rsp),%rsi
call   10c0 <scanf@plt>
xor    %eax,%eax
call   1060 <define_output_file@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    0x10(%rsp),%rsi
mov    %eax,%edi
cmp    $0x2,%ebx
jne    1228 <read_file_names+0x78>
call   1080 <read_named_linear_product_start_system@plt>
jmp    1268 <read_file_names+0xb8>
call   10d0 <read_named_start_without_solutions@plt>
cmp    $0x3,%ebx
jl     1268 <read_file_names+0xb8>
xor    %eax,%eax
call   1050 <solcon_scan_solution_banner@plt>
cmp    $0x4,%ebx
jne    1268 <read_file_names+0xb8>
xor    %eax,%eax
call   10a0 <copy_start_system_to_container@plt>
lea    0xc(%rsp),%rdi
call   1070 <syscon_sort_embed_symbols@plt>
mov    0xc(%rsp),%esi
lea    0xe02(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1090 <copy_container_to_start_system@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [54 x i8] c"\0AReading the name of the file for the start system...\00"
@.str.1 = [32 x i8] c"\0AGive a string of characters : \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [25 x i8] c"the top dimension is %d\0A\00"
define i32 @read_file_names(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [80 x i8]
%7 = alloca i8
store i32 %0, i32* %2
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 4
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 (...) @read_target_system_without_solutions()
store i32 %11, i32* %3
br label %12
12: ; preds = %10, %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%15 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %15)
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%18 = call i32 (...) @define_output_file()
store i32 %18, i32* %3
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%20 = call i64 @strlen(i8* %19)
%21 = trunc i64 %20 to i32
store i32 %21, i32* %4
%22 = load i32, i32* %2
%23 = icmp eq i32 %22, 2
br i1 %23, label %24, label %28
24: ; preds = %12
%25 = load i32, i32* %4
%26 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%27 = call i32 @read_named_linear_product_start_system(i32 %25, i8* %26)
store i32 %27, i32* %3
br label %32
28: ; preds = %12
%29 = load i32, i32* %4
%30 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%31 = call i32 @read_named_start_without_solutions(i32 %29, i8* %30)
store i32 %31, i32* %3
br label %32
32: ; preds = %28, %24
%33 = load i32, i32* %2
%34 = icmp sge i32 %33, 3
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 (...) @solcon_scan_solution_banner()
store i32 %36, i32* %3
br label %37
37: ; preds = %35, %32
%38 = load i32, i32* %2
%39 = icmp eq i32 %38, 4
br i1 %39, label %40, label %46
40: ; preds = %37
%41 = call i32 (...) @copy_start_system_to_container()
store i32 %41, i32* %3
%42 = call i32 @syscon_sort_embed_symbols(i32* %5)
store i32 %42, i32* %3
%43 = load i32, i32* %5
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %43)
%45 = call i32 (...) @copy_container_to_start_system()
store i32 %45, i32* %3
br label %46
46: ; preds = %40, %37
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
@.str = [54 x i8] c"\0AReading the name of the file for the start system...\00"
@.str.1 = [32 x i8] c"\0AGive a string of characters : \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [25 x i8] c"the top dimension is %d\0A\00"
define i32 @read_file_names(i32 %0) {
%2 = alloca i32
%3 = alloca [80 x i8]
%4 = alloca i8
%5 = bitcast i32* %2 to i8*
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%7 = icmp slt i32 %0, 4
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = tail call i32 (...) @read_target_system_without_solutions()
br label %10
10: ; preds = %8, %1
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%15 = call i32 (...) @define_output_file()
%16 = call i64 @strlen(i8* %6)
%17 = trunc i64 %16 to i32
%18 = icmp eq i32 %0, 2
br i1 %18, label %19, label %21
19: ; preds = %10
%20 = call i32 @read_named_linear_product_start_system(i32 %17, i8* %6)
br label %33
21: ; preds = %10
%22 = call i32 @read_named_start_without_solutions(i32 %17, i8* %6)
%23 = icmp sgt i32 %0, 2
br i1 %23, label %24, label %33
24: ; preds = %21
%25 = call i32 (...) @solcon_scan_solution_banner()
%26 = icmp eq i32 %0, 4
br i1 %26, label %27, label %33
27: ; preds = %24
%28 = call i32 (...) @copy_start_system_to_container()
%29 = call i32 @syscon_sort_embed_symbols(i32* %2)
%30 = load i32, i32* %2
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %30)
%32 = call i32 (...) @copy_container_to_start_system()
br label %33
33: ; preds = %21, %19, %27, %24
%34 = phi i32 [ %32, %27 ], [ %25, %24 ], [ %20, %19 ], [ %22, %21 ]
ret i32 %34
}