#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_write_dobldobl_solutions();
int solcon_write_quaddobl_solutions();
int solcon_write_standard_solutions();
int solve_dobldobl_system(int *, int);
int solve_quaddobl_system(int *, int);
int solve_system(int *, int);
int syscon_read_dobldobl_system();
int syscon_read_quaddobl_system();
int syscon_read_standard_system();
int syscon_write_dobldobl_system();
int syscon_write_quaddobl_system();
int syscon_write_standard_system();
int input_output_on_files(int precision) {
  int fail, rc, nbtasks;
  if (precision == 0) {
    fail = syscon_read_standard_system();
    printf("\nThe system in the container : \n");
    fail = syscon_write_standard_system();
    printf("\nGive the number of tasks : ");
    scanf("%d", &nbtasks);
    fail = solve_system(&rc, nbtasks);
    printf("\nThe root count : %d\n", rc);
    printf("\nThe solutions :\n");
    fail = solcon_write_standard_solutions();
  } else if (precision == 1) {
    fail = syscon_read_dobldobl_system();
    printf("\nThe system in the container : \n");
    fail = syscon_write_dobldobl_system();
    printf("\nGive the number of tasks : ");
    scanf("%d", &nbtasks);
    fail = solve_dobldobl_system(&rc, nbtasks);
    printf("\nThe root count : %d\n", rc);
    printf("\nThe solutions :\n");
    fail = solcon_write_dobldobl_solutions();
  } else if (precision == 2) {
    fail = syscon_read_quaddobl_system();
    printf("\nThe system in the container : \n");
    fail = syscon_write_quaddobl_system();
    printf("\nGive the number of tasks : ");
    scanf("%d", &nbtasks);
    fail = solve_quaddobl_system(&rc, nbtasks);
    printf("\nThe root count : %d\n", rc);
    printf("\nThe solutions :\n");
    fail = solcon_write_quaddobl_solutions();
  }
  return fail;
}


x86 assembly (clang, -O0):
<input_output_on_files>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1272 <input_output_on_files+0x92>
mov    $0x0,%al
call   10d0 <syscon_read_standard_system@plt>
mov    %eax,-0x8(%rbp)
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   10a0 <syscon_write_standard_system@plt>
mov    %eax,-0x8(%rbp)
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe12(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   10c0 <scanf@plt>
mov    -0x10(%rbp),%esi
lea    -0xc(%rbp),%rdi
call   10f0 <solve_system@plt>
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1090 <solcon_write_standard_solutions@plt>
mov    %eax,-0x8(%rbp)
jmp    1385 <input_output_on_files+0x1a5>
cmpl   $0x1,-0x4(%rbp)
jne    12f9 <input_output_on_files+0x119>
mov    $0x0,%al
call   1100 <syscon_read_dobldobl_system@plt>
mov    %eax,-0x8(%rbp)
lea    0xd73(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1040 <syscon_write_dobldobl_system@plt>
mov    %eax,-0x8(%rbp)
lea    0xd7c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd8b(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   10c0 <scanf@plt>
mov    -0x10(%rbp),%esi
lea    -0xc(%rbp),%rdi
call   10b0 <solve_dobldobl_system@plt>
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
lea    0xd6c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd74(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1070 <solcon_write_dobldobl_solutions@plt>
mov    %eax,-0x8(%rbp)
jmp    1380 <input_output_on_files+0x1a0>
cmpl   $0x2,-0x4(%rbp)
jne    137b <input_output_on_files+0x19b>
mov    $0x0,%al
call   1050 <syscon_read_quaddobl_system@plt>
mov    %eax,-0x8(%rbp)
lea    0xcec(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1080 <syscon_write_quaddobl_system@plt>
mov    %eax,-0x8(%rbp)
lea    0xcf5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd04(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   10c0 <scanf@plt>
mov    -0x10(%rbp),%esi
lea    -0xc(%rbp),%rdi
call   10e0 <solve_quaddobl_system@plt>
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
lea    0xce5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xced(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1030 <solcon_write_quaddobl_solutions@plt>
mov    %eax,-0x8(%rbp)
jmp    1380 <input_output_on_files+0x1a0>
jmp    1385 <input_output_on_files+0x1a5>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input_output_on_files>:
push   %rax
cmp    $0x2,%edi
je     1272 <input_output_on_files+0x82>
cmp    $0x1,%edi
je     12dd <input_output_on_files+0xed>
test   %edi,%edi
jne    12db <input_output_on_files+0xeb>
xor    %eax,%eax
call   10e0 <syscon_read_standard_system@plt>
lea    0xe21(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   10b0 <syscon_write_standard_system@plt>
lea    0xdd8(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xde7(%rip),%rdi
mov    %rsp,%rsi
call   10d0 <scanf@plt>
mov    (%rsp),%esi
lea    0x4(%rsp),%rdi
call   1100 <solve_system@plt>
mov    0x4(%rsp),%esi
lea    0xdca(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xdf2(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   10a0 <solcon_write_standard_solutions@plt>
pop    %rcx
ret
xor    %eax,%eax
call   1060 <syscon_read_quaddobl_system@plt>
lea    0xdb6(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1090 <syscon_write_quaddobl_system@plt>
lea    0xd6d(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd7c(%rip),%rdi
mov    %rsp,%rsi
call   10d0 <scanf@plt>
mov    (%rsp),%esi
lea    0x4(%rsp),%rdi
call   10f0 <solve_quaddobl_system@plt>
mov    0x4(%rsp),%esi
lea    0xd5f(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd87(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1030 <solcon_write_quaddobl_solutions@plt>
pop    %rcx
ret
xor    %eax,%eax
call   1110 <syscon_read_dobldobl_system@plt>
lea    0xd4b(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1040 <syscon_write_dobldobl_system@plt>
lea    0xd02(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd11(%rip),%rdi
mov    %rsp,%rsi
call   10d0 <scanf@plt>
mov    (%rsp),%esi
lea    0x4(%rsp),%rdi
call   10c0 <solve_dobldobl_system@plt>
mov    0x4(%rsp),%esi
lea    0xcf4(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd1c(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1080 <solcon_write_dobldobl_solutions@plt>
pop    %rcx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"\0AThe system in the container : \0A\00"
@.str.1 = [29 x i8] c"\0AGive the number of tasks : \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [22 x i8] c"\0AThe root count : %d\0A\00"
@.str.4 = [18 x i8] c"\0AThe solutions :\0A\00"
define i32 @input_output_on_files(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %1
%9 = call i32 (...) @syscon_read_standard_system()
store i32 %9, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (...) @syscon_write_standard_system()
store i32 %11, i32* %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 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), i32* %5)
%14 = load i32, i32* %5
%15 = call i32 @solve_system(i32* %4, i32 %14)
store i32 %15, i32* %3
%16 = load i32, i32* %4
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 (...) @solcon_write_standard_solutions()
store i32 %19, i32* %3
br label %52
20: ; preds = %1
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %35
23: ; preds = %20
%24 = call i32 (...) @syscon_read_dobldobl_system()
store i32 %24, i32* %3
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%26 = call i32 (...) @syscon_write_dobldobl_system()
store i32 %26, i32* %3
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%29 = load i32, i32* %5
%30 = call i32 @solve_dobldobl_system(i32* %4, i32 %29)
store i32 %30, i32* %3
%31 = load i32, i32* %4
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %31)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%34 = call i32 (...) @solcon_write_dobldobl_solutions()
store i32 %34, i32* %3
br label %51
35: ; preds = %20
%36 = load i32, i32* %2
%37 = icmp eq i32 %36, 2
br i1 %37, label %38, label %50
38: ; preds = %35
%39 = call i32 (...) @syscon_read_quaddobl_system()
store i32 %39, i32* %3
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%41 = call i32 (...) @syscon_write_quaddobl_system()
store i32 %41, i32* %3
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%43 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%44 = load i32, i32* %5
%45 = call i32 @solve_quaddobl_system(i32* %4, i32 %44)
store i32 %45, i32* %3
%46 = load i32, i32* %4
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %46)
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%49 = call i32 (...) @solcon_write_quaddobl_solutions()
store i32 %49, i32* %3
br label %50
50: ; preds = %38, %35
br label %51
51: ; preds = %50, %23
br label %52
52: ; preds = %51, %8
%53 = load i32, i32* %3
ret i32 %53
}

LLVM IR (-O2):
@.str.1 = [29 x i8] c"\0AGive the number of tasks : \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [22 x i8] c"\0AThe root count : %d\0A\00"
@str.8 = [32 x i8] c"\0AThe system in the container : \00"
@str.9 = [17 x i8] c"\0AThe solutions :\00"
define i32 @input_output_on_files(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
switch i32 %0, label %42 [
i32 0, label %6
i32 1, label %18
i32 2, label %30
]
6: ; preds = %1
%7 = tail call i32 (...) @syscon_read_standard_system()
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.8, i64 0, i64 0))
%9 = tail call i32 (...) @syscon_write_standard_system()
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %3
%13 = call i32 @solve_system(i32* %2, i32 %12)
%14 = load i32, i32* %2
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.9, i64 0, i64 0))
%17 = call i32 (...) @solcon_write_standard_solutions()
br label %42
18: ; preds = %1
%19 = tail call i32 (...) @syscon_read_dobldobl_system()
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.8, i64 0, i64 0))
%21 = tail call i32 (...) @syscon_write_dobldobl_system()
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%24 = load i32, i32* %3
%25 = call i32 @solve_dobldobl_system(i32* %2, i32 %24)
%26 = load i32, i32* %2
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.9, i64 0, i64 0))
%29 = call i32 (...) @solcon_write_dobldobl_solutions()
br label %42
30: ; preds = %1
%31 = tail call i32 (...) @syscon_read_quaddobl_system()
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.8, i64 0, i64 0))
%33 = tail call i32 (...) @syscon_write_quaddobl_system()
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%36 = load i32, i32* %3
%37 = call i32 @solve_quaddobl_system(i32* %2, i32 %36)
%38 = load i32, i32* %2
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i32 %38)
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.9, i64 0, i64 0))
%41 = call i32 (...) @solcon_write_quaddobl_solutions()
br label %42
42: ; preds = %1, %18, %30, %6
%43 = phi i32 [ %17, %6 ], [ %29, %18 ], [ %41, %30 ], [ undef, %1 ]
ret i32 %43
}