#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_dobldobl_start_solutions_to_container();
int copy_dobldobl_start_system_to_container();
int gpu_newton_dd(int, int);
int /*<<< orphan*/ printf(char *, ...);
int read_dobldobl_start_system();
int solcon_number_of_dobldobl_solutions(int *);
int solcon_write_dobldobl_solutions();
int syscon_number_of_dobldobl_polynomials(int *);
void test_newton(void) {
  int fail, dim, len;
  printf("\nRunning Newton's method ...\n");
  fail = read_dobldobl_start_system();
  fail = copy_dobldobl_start_system_to_container();
  fail = copy_dobldobl_start_solutions_to_container();
  fail = syscon_number_of_dobldobl_polynomials(&dim);
  printf("The system container has %d polynomials.\n", dim);
  fail = solcon_number_of_dobldobl_solutions(&len);
  printf("The solution container has size %d.\n", len);
  fail = gpu_newton_dd(2, 1);
  printf("The solutions after Newton's method :\n");
  fail = solcon_write_dobldobl_solutions();
}


x86 assembly (clang, -O0):
<test_newton>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   10a0 <read_dobldobl_start_system@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1090 <copy_dobldobl_start_system_to_container@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1050 <copy_dobldobl_start_solutions_to_container@plt>
mov    %eax,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <syscon_number_of_dobldobl_polynomials@plt>
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0xc(%rbp),%rdi
call   1080 <solcon_number_of_dobldobl_solutions@plt>
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1030 <gpu_newton_dd@plt>
mov    %eax,-0x4(%rbp)
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1070 <solcon_write_dobldobl_solutions@plt>
mov    %eax,-0x4(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_newton>:
push   %rax
lea    0xeb7(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   10b0 <read_dobldobl_start_system@plt>
xor    %eax,%eax
call   10a0 <copy_dobldobl_start_system_to_container@plt>
xor    %eax,%eax
call   1060 <copy_dobldobl_start_solutions_to_container@plt>
lea    0x4(%rsp),%rdi
call   1050 <syscon_number_of_dobldobl_polynomials@plt>
mov    0x4(%rsp),%esi
lea    0xe39(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rsp,%rdi
call   1090 <solcon_number_of_dobldobl_solutions@plt>
mov    (%rsp),%esi
lea    0xe4a(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1030 <gpu_newton_dd@plt>
lea    0xe6f(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1080 <solcon_write_dobldobl_solutions@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [30 x i8] c"\0ARunning Newton's method ...\0A\00"
@.str.1 = [42 x i8] c"The system container has %d polynomials.\0A\00"
@.str.2 = [37 x i8] c"The solution container has size %d.\0A\00"
@.str.3 = [39 x i8] c"The solutions after Newton's method :\0A\00"
define void @test_newton() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (...) @read_dobldobl_start_system()
store i32 %5, i32* %1
%6 = call i32 (...) @copy_dobldobl_start_system_to_container()
store i32 %6, i32* %1
%7 = call i32 (...) @copy_dobldobl_start_solutions_to_container()
store i32 %7, i32* %1
%8 = call i32 @syscon_number_of_dobldobl_polynomials(i32* %2)
store i32 %8, i32* %1
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = call i32 @solcon_number_of_dobldobl_solutions(i32* %3)
store i32 %11, i32* %1
%12 = load i32, i32* %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = call i32 @gpu_newton_dd(i32 2, i32 1)
store i32 %14, i32* %1
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 (...) @solcon_write_dobldobl_solutions()
store i32 %16, i32* %1
ret void
}

LLVM IR (-O2):
@.str.1 = [42 x i8] c"The system container has %d polynomials.\0A\00"
@.str.2 = [37 x i8] c"The solution container has size %d.\0A\00"
@str = [29 x i8] c"\0ARunning Newton's method ...\00"
@str.4 = [38 x i8] c"The solutions after Newton's method :\00"
define void @test_newton() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (...) @read_dobldobl_start_system()
%7 = tail call i32 (...) @copy_dobldobl_start_system_to_container()
%8 = tail call i32 (...) @copy_dobldobl_start_solutions_to_container()
%9 = call i32 @syscon_number_of_dobldobl_polynomials(i32* %1)
%10 = load i32, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = call i32 @solcon_number_of_dobldobl_solutions(i32* %2)
%13 = load i32, i32* %2
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = call i32 @gpu_newton_dd(i32 2, i32 1)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.4, i64 0, i64 0))
%17 = call i32 (...) @solcon_write_dobldobl_solutions()
ret void
}