#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 celcon_create_polyhedral_homotopy();
int celcon_create_random_coefficient_system();
int celcon_dimension_of_points(int *);
int celcon_mixed_volume(int, int *);
int celcon_number_of_cells(int *);
int celcon_read_mixed_cell_configuration();
int celcon_solve_start_system(int, int *);
int celcon_write_random_coefficient_system();
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int read_standard_target_system();
int /*<<< orphan*/ scanf(char *, ...);
int show_mixture(int, int *);
void read_cells_and_create_start_system(void) {
  int dim, n, fail, *d, r, len, k, nbsols, mv;
  double *c;
  char ans = 'y';
  fail = celcon_read_mixed_cell_configuration();
  printf("\nReading a system to initialize the symbol table...");
  fail = read_standard_target_system();
  fail = celcon_dimension_of_points(&dim);
  printf("dimension of the lifted points : %d\n", dim);
  fail = show_mixture(dim, &r);
  fail = celcon_create_random_coefficient_system();
  printf("The random coefficient start system :\n");
  fail = celcon_write_random_coefficient_system();
  fail = celcon_create_polyhedral_homotopy();
  fail = celcon_number_of_cells(&len);
  while (ans == 'y') {
    printf("Give a number to a mixed cell (<= %d) : ", len);
    scanf("%d", &k);
    fail = celcon_solve_start_system(k, &nbsols);
    printf(" -> found %d start solutions from cell %d\n", nbsols, k);
    fail = celcon_mixed_volume(k, &mv);
    if (nbsols == mv)
      printf("#start solutions equals mixed volume %d, ok\n", mv);
    else
      printf("#start solutions does not equal mixed volume %d!!!\n", mv);
    printf("Do you wish to test another cell (y/n) ");
    scanf("%c", &ans);
    ans = getchar();
  }
}


x86 assembly (clang, -O0):
<read_cells_and_create_start_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movb   $0x79,-0x39(%rbp)
mov    $0x0,%al
call   10e0 <celcon_read_mixed_cell_configuration@plt>
mov    %eax,-0xc(%rbp)
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x0,%al
call   1030 <read_standard_target_system@plt>
mov    %eax,-0xc(%rbp)
lea    -0x4(%rbp),%rdi
call   10f0 <celcon_dimension_of_points@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%esi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x4(%rbp),%edi
lea    -0x1c(%rbp),%rsi
call   1040 <show_mixture@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   10a0 <celcon_create_random_coefficient_system@plt>
mov    %eax,-0xc(%rbp)
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x0,%al
call   1060 <celcon_write_random_coefficient_system@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   10b0 <celcon_create_polyhedral_homotopy@plt>
mov    %eax,-0xc(%rbp)
lea    -0x20(%rbp),%rdi
call   1050 <celcon_number_of_cells@plt>
mov    %eax,-0xc(%rbp)
movsbl -0x39(%rbp),%eax
cmp    $0x79,%eax
jne    1326 <read_cells_and_create_start_system+0x156>
mov    -0x20(%rbp),%esi
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xe22(%rip),%rdi
lea    -0x24(%rbp),%rsi
mov    $0x0,%al
call   10d0 <scanf@plt>
mov    -0x24(%rbp),%edi
lea    -0x28(%rbp),%rsi
call   10c0 <celcon_solve_start_system@plt>
mov    %eax,-0xc(%rbp)
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edx
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x24(%rbp),%edi
lea    -0x2c(%rbp),%rsi
call   1080 <celcon_mixed_volume@plt>
mov    %eax,-0xc(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jne    12e6 <read_cells_and_create_start_system+0x116>
mov    -0x2c(%rbp),%esi
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    12f7 <read_cells_and_create_start_system+0x127>
mov    -0x2c(%rbp),%esi
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xe54(%rip),%rdi
lea    -0x39(%rbp),%rsi
mov    $0x0,%al
call   10d0 <scanf@plt>
mov    $0x0,%al
call   1090 <getchar@plt>
mov    %al,-0x39(%rbp)
jmp    1262 <read_cells_and_create_start_system+0x92>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_cells_and_create_start_system>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movb   $0x79,0xf(%rsp)
xor    %eax,%eax
call   10f0 <celcon_read_mixed_cell_configuration@plt>
lea    0xdff(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %eax,%eax
call   1030 <read_standard_target_system@plt>
lea    0x18(%rsp),%rdi
call   1100 <celcon_dimension_of_points@plt>
mov    0x18(%rsp),%esi
lea    0xe10(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x18(%rsp),%edi
lea    0x24(%rsp),%rsi
call   1040 <show_mixture@plt>
xor    %eax,%eax
call   10b0 <celcon_create_random_coefficient_system@plt>
lea    0xef5(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1070 <celcon_write_random_coefficient_system@plt>
xor    %eax,%eax
call   10c0 <celcon_create_polyhedral_homotopy@plt>
lea    0x20(%rsp),%rdi
call   1060 <celcon_number_of_cells@plt>
lea    0x14(%rsp),%r13
lea    0xe15(%rip),%rbx
lea    0x1c(%rsp),%rbp
lea    0xe95(%rip),%r14
lea    0xeb6(%rip),%r15
lea    0xf(%rsp),%r12
jmp    12c6 <read_cells_and_create_start_system+0xe6>
nopw   0x0(%rax,%rax,1)
lea    0xe46(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10e0 <scanf@plt>
xor    %eax,%eax
call   10a0 <getchar@plt>
mov    %al,0xf(%rsp)
cmp    $0x79,%al
jne    1331 <read_cells_and_create_start_system+0x151>
mov    0x20(%rsp),%esi
lea    0xd88(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xda3(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   10e0 <scanf@plt>
mov    0x10(%rsp),%edi
mov    %r13,%rsi
call   10d0 <celcon_solve_start_system@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x10(%rsp),%edi
mov    %rbp,%rsi
call   1090 <celcon_mixed_volume@plt>
mov    0x14(%rsp),%esi
mov    0x1c(%rsp),%eax
cmp    %eax,%esi
jne    1290 <read_cells_and_create_start_system+0xb0>
lea    0xd84(%rip),%rdi
jmp    1299 <read_cells_and_create_start_system+0xb9>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [52 x i8] c"\0AReading a system to initialize the symbol table...\00"
@.str.1 = [37 x i8] c"dimension of the lifted points : %d\0A\00"
@.str.2 = [39 x i8] c"The random coefficient start system :\0A\00"
@.str.3 = [41 x i8] c"Give a number to a mixed cell (<= %d) : \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [43 x i8] c" -> found %d start solutions from cell %d\0A\00"
@.str.6 = [45 x i8] c"#start solutions equals mixed volume %d, ok\0A\00"
@.str.7 = [52 x i8] c"#start solutions does not equal mixed volume %d!!!\0A\00"
@.str.8 = [40 x i8] c"Do you wish to test another cell (y/n) \00"
@.str.9 = [3 x i8] c"%c\00"
define void @read_cells_and_create_start_system() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca double*
%11 = alloca i8
store i8 121, i8* %11
%12 = call i32 (...) @celcon_read_mixed_cell_configuration()
store i32 %12, i32* %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%14 = call i32 (...) @read_standard_target_system()
store i32 %14, i32* %3
%15 = call i32 @celcon_dimension_of_points(i32* %1)
store i32 %15, i32* %3
%16 = load i32, i32* %1
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %1
%19 = call i32 @show_mixture(i32 %18, i32* %5)
store i32 %19, i32* %3
%20 = call i32 (...) @celcon_create_random_coefficient_system()
store i32 %20, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%22 = call i32 (...) @celcon_write_random_coefficient_system()
store i32 %22, i32* %3
%23 = call i32 (...) @celcon_create_polyhedral_homotopy()
store i32 %23, i32* %3
%24 = call i32 @celcon_number_of_cells(i32* %6)
store i32 %24, i32* %3
br label %25
25: ; preds = %49, %0
%26 = load i8, i8* %11
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 121
br i1 %28, label %29, label %53
29: ; preds = %25
%30 = load i32, i32* %6
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i32 %30)
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %7)
%33 = load i32, i32* %7
%34 = call i32 @celcon_solve_start_system(i32 %33, i32* %8)
store i32 %34, i32* %3
%35 = load i32, i32* %8
%36 = load i32, i32* %7
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0), i32 %35, i32 %36)
%38 = load i32, i32* %7
%39 = call i32 @celcon_mixed_volume(i32 %38, i32* %9)
store i32 %39, i32* %3
%40 = load i32, i32* %8
%41 = load i32, i32* %9
%42 = icmp eq i32 %40, %41
br i1 %42, label %43, label %46
43: ; preds = %29
%44 = load i32, i32* %9
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0), i32 %44)
br label %49
46: ; preds = %29
%47 = load i32, i32* %9
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.7, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %46, %43
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0))
%51 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %11)
%52 = call signext i8 (...) @getchar()
store i8 %52, i8* %11
br label %25
53: ; preds = %25
ret void
}

LLVM IR (-O2):
@.str = [52 x i8] c"\0AReading a system to initialize the symbol table...\00"
@.str.1 = [37 x i8] c"dimension of the lifted points : %d\0A\00"
@.str.3 = [41 x i8] c"Give a number to a mixed cell (<= %d) : \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [43 x i8] c" -> found %d start solutions from cell %d\0A\00"
@.str.6 = [45 x i8] c"#start solutions equals mixed volume %d, ok\0A\00"
@.str.7 = [52 x i8] c"#start solutions does not equal mixed volume %d!!!\0A\00"
@.str.8 = [40 x i8] c"Do you wish to test another cell (y/n) \00"
@.str.9 = [3 x i8] c"%c\00"
@str = [38 x i8] c"The random coefficient start system :\00"
define void @read_cells_and_create_start_system() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
%8 = bitcast i32* %1 to i8*
%9 = bitcast i32* %2 to i8*
%10 = bitcast i32* %3 to i8*
%11 = bitcast i32* %4 to i8*
%12 = bitcast i32* %5 to i8*
%13 = bitcast i32* %6 to i8*
store i8 121, i8* %7
%14 = tail call i32 (...) @celcon_read_mixed_cell_configuration()
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%16 = tail call i32 (...) @read_standard_target_system()
%17 = call i32 @celcon_dimension_of_points(i32* %1)
%18 = load i32, i32* %1
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %1
%21 = call i32 @show_mixture(i32 %20, i32* %2)
%22 = call i32 (...) @celcon_create_random_coefficient_system()
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%24 = call i32 (...) @celcon_write_random_coefficient_system()
%25 = call i32 (...) @celcon_create_polyhedral_homotopy()
%26 = call i32 @celcon_number_of_cells(i32* %3)
br label %27
27: ; preds = %0, %45
%28 = load i32, i32* %3
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i32 %28)
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %4)
%31 = load i32, i32* %4
%32 = call i32 @celcon_solve_start_system(i32 %31, i32* %5)
%33 = load i32, i32* %5
%34 = load i32, i32* %4
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0), i32 %33, i32 %34)
%36 = load i32, i32* %4
%37 = call i32 @celcon_mixed_volume(i32 %36, i32* %6)
%38 = load i32, i32* %5
%39 = load i32, i32* %6
%40 = icmp eq i32 %38, %39
br i1 %40, label %41, label %43
41: ; preds = %27
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0), i32 %38)
br label %45
43: ; preds = %27
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.7, i64 0, i64 0), i32 %39)
br label %45
45: ; preds = %43, %41
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0))
%47 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %7)
%48 = call signext i8 (...) @getchar()
store i8 %48, i8* %7
%49 = icmp eq i8 %48, 121
br i1 %49, label %27, label %50
50: ; preds = %45
ret void
}