#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 random_linear_product_system();
int solcon_number_of_standard_solutions(int *);
int solcon_write_standard_solutions();
int solve_linear_product_system();
int syscon_write_standard_system();
int construct_start_system(int r) {
  int fail;
  int nbsols;
  fail = random_linear_product_system();
  printf("\nA random linear-product system :\n");
  fail = syscon_write_standard_system();
  fail = solve_linear_product_system();
  printf("\nThe solutions : \n");
  fail = solcon_write_standard_solutions();
  fail = solcon_number_of_standard_solutions(&nbsols);
  if (r == nbsols)
    printf("\nComputed %d solutions, as many as the root count.\n", nbsols);
  else
    printf("\nNumber of solutions computed %d /= %d, the root count ?!!\n",
           nbsols, r);
  return fail;
}


x86 assembly (clang, -O0):
<construct_start_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1060 <random_linear_product_system@plt>
mov    %eax,-0x8(%rbp)
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1080 <syscon_write_standard_system@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <solve_linear_product_system@plt>
mov    %eax,-0x8(%rbp)
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1070 <solcon_write_standard_solutions@plt>
mov    %eax,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
call   1050 <solcon_number_of_standard_solutions@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11dd <construct_start_system+0x7d>
mov    -0xc(%rbp),%esi
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11f1 <construct_start_system+0x91>
mov    -0xc(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<construct_start_system>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %eax,%eax
call   1070 <random_linear_product_system@plt>
lea    0xeed(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1090 <syscon_write_standard_system@plt>
xor    %eax,%eax
call   1040 <solve_linear_product_system@plt>
lea    0xef5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1080 <solcon_write_standard_solutions@plt>
lea    0x4(%rsp),%rdi
call   1060 <solcon_number_of_standard_solutions@plt>
mov    %eax,%ebp
mov    0x4(%rsp),%esi
cmp    %ebx,%esi
jne    11cf <construct_start_system+0x5f>
lea    0xe3c(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11df <construct_start_system+0x6f>
lea    0xe5e(%rip),%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"\0AA random linear-product system :\0A\00"
@.str.1 = [19 x i8] c"\0AThe solutions : \0A\00"
@.str.2 = [52 x i8] c"\0AComputed %d solutions, as many as the root count.\0A\00"
@.str.3 = [60 x i8] c"\0ANumber of solutions computed %d /= %d, the root count ?!!\0A\00"
define i32 @construct_start_system(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 (...) @random_linear_product_system()
store i32 %5, i32* %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @syscon_write_standard_system()
store i32 %7, i32* %3
%8 = call i32 (...) @solve_linear_product_system()
store i32 %8, i32* %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (...) @solcon_write_standard_solutions()
store i32 %10, i32* %3
%11 = call i32 @solcon_number_of_standard_solutions(i32* %4)
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = load i32, i32* %4
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %18
15: ; preds = %1
%16 = load i32, i32* %4
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i32 %16)
br label %22
18: ; preds = %1
%19 = load i32, i32* %4
%20 = load i32, i32* %2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0), i32 %19, i32 %20)
br label %22
22: ; preds = %18, %15
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@.str.2 = [52 x i8] c"\0AComputed %d solutions, as many as the root count.\0A\00"
@.str.3 = [60 x i8] c"\0ANumber of solutions computed %d /= %d, the root count ?!!\0A\00"
@str = [34 x i8] c"\0AA random linear-product system :\00"
@str.4 = [18 x i8] c"\0AThe solutions : \00"
define i32 @construct_start_system(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 (...) @random_linear_product_system()
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (...) @syscon_write_standard_system()
%7 = tail call i32 (...) @solve_linear_product_system()
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.4, i64 0, i64 0))
%9 = tail call i32 (...) @solcon_write_standard_solutions()
%10 = call i32 @solcon_number_of_standard_solutions(i32* %2)
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, %0
br i1 %12, label %13, label %15
13: ; preds = %1
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i32 %0)
br label %17
15: ; preds = %1
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.3, i64 0, i64 0), i32 %11, i32 %0)
br label %17
17: ; preds = %15, %13
ret i32 %10
}