#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 multprec_Newton_step(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int solcon_dimension_of_multprec_solutions(int *);
int solcon_number_of_multprec_solutions(int *);
int solcon_read_multprec_solutions();
int solcon_write_multprec_solutions();
int syscon_number_of_multprec_polynomials(int *);
int syscon_read_multprec_system(int);
void test_multprec_Newton_step(void) {
  int fail, dim, len, deci;
  printf("\nRunning Newton step with multiprecision arithmetic ...\n");
  printf("\ngive the number of decimal places in the working precision : ");
  scanf("%d", &deci);
  fail = syscon_read_multprec_system(deci);
  fail = syscon_number_of_multprec_polynomials(&dim);
  printf("The system container has %d polynomials.\n", dim);
  fail = solcon_read_multprec_solutions();
  fail = solcon_number_of_multprec_solutions(&len);
  printf("The solution container has size %d.\n", len);
  fail = solcon_dimension_of_multprec_solutions(&dim);
  printf("The solutions in the container have dimension %d.\n", dim);
  fail = multprec_Newton_step(deci);
  printf("The solutions after the Newton step :\n");
  fail = solcon_write_multprec_solutions();
}


x86 assembly (clang, -O0):
<test_multprec_Newton_step>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xebd(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1090 <scanf@plt>
mov    -0x10(%rbp),%edi
call   1030 <syscon_read_multprec_system@plt>
mov    %eax,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <syscon_number_of_multprec_polynomials@plt>
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1080 <solcon_read_multprec_solutions@plt>
mov    %eax,-0x4(%rbp)
lea    -0xc(%rbp),%rdi
call   10b0 <solcon_number_of_multprec_solutions@plt>
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x8(%rbp),%rdi
call   10a0 <solcon_dimension_of_multprec_solutions@plt>
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%esi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%edi
call   1060 <multprec_Newton_step@plt>
mov    %eax,-0x4(%rbp)
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1070 <solcon_write_multprec_solutions@plt>
mov    %eax,-0x4(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_multprec_Newton_step>:
push   %rbx
sub    $0x10,%rsp
lea    0xf18(%rip),%rdi
call   1040 <puts@plt>
lea    0xe48(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe79(%rip),%rdi
lea    0x4(%rsp),%rsi
call   10a0 <scanf@plt>
mov    0x4(%rsp),%edi
call   1030 <syscon_read_multprec_system@plt>
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <syscon_number_of_multprec_polynomials@plt>
mov    0x8(%rsp),%esi
lea    0xe51(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1090 <solcon_read_multprec_solutions@plt>
lea    0xc(%rsp),%rdi
call   10c0 <solcon_number_of_multprec_solutions@plt>
mov    0xc(%rsp),%esi
lea    0xe58(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   10b0 <solcon_dimension_of_multprec_solutions@plt>
mov    0x8(%rsp),%esi
lea    0xe63(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x4(%rsp),%edi
call   1070 <multprec_Newton_step@plt>
lea    0xeb7(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1080 <solcon_write_multprec_solutions@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [57 x i8] c"\0ARunning Newton step with multiprecision arithmetic ...\0A\00"
@.str.1 = [63 x i8] c"\0Agive the number of decimal places in the working precision : \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [42 x i8] c"The system container has %d polynomials.\0A\00"
@.str.4 = [37 x i8] c"The solution container has size %d.\0A\00"
@.str.5 = [51 x i8] c"The solutions in the container have dimension %d.\0A\00"
@.str.6 = [39 x i8] c"The solutions after the Newton step :\0A\00"
define void @test_multprec_Newton_step() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%8 = load i32, i32* %4
%9 = call i32 @syscon_read_multprec_system(i32 %8)
store i32 %9, i32* %1
%10 = call i32 @syscon_number_of_multprec_polynomials(i32* %2)
store i32 %10, i32* %1
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%13 = call i32 (...) @solcon_read_multprec_solutions()
store i32 %13, i32* %1
%14 = call i32 @solcon_number_of_multprec_solutions(i32* %3)
store i32 %14, i32* %1
%15 = load i32, i32* %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i32 %15)
%17 = call i32 @solcon_dimension_of_multprec_solutions(i32* %2)
store i32 %17, i32* %1
%18 = load i32, i32* %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %4
%21 = call i32 @multprec_Newton_step(i32 %20)
store i32 %21, i32* %1
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0))
%23 = call i32 (...) @solcon_write_multprec_solutions()
store i32 %23, i32* %1
ret void
}

LLVM IR (-O2):
@.str.1 = [63 x i8] c"\0Agive the number of decimal places in the working precision : \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [42 x i8] c"The system container has %d polynomials.\0A\00"
@.str.4 = [37 x i8] c"The solution container has size %d.\0A\00"
@.str.5 = [51 x i8] c"The solutions in the container have dimension %d.\0A\00"
@str = [56 x i8] c"\0ARunning Newton step with multiprecision arithmetic ...\00"
@str.7 = [38 x i8] c"The solutions after the Newton step :\00"
define void @test_multprec_Newton_step() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
%11 = call i32 @syscon_read_multprec_system(i32 %10)
%12 = call i32 @syscon_number_of_multprec_polynomials(i32* %1)
%13 = load i32, i32* %1
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = call i32 (...) @solcon_read_multprec_solutions()
%16 = call i32 @solcon_number_of_multprec_solutions(i32* %2)
%17 = load i32, i32* %2
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i32 %17)
%19 = call i32 @solcon_dimension_of_multprec_solutions(i32* %1)
%20 = load i32, i32* %1
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %3
%23 = call i32 @multprec_Newton_step(i32 %22)
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.7, i64 0, i64 0))
%25 = call i32 (...) @solcon_write_multprec_solutions()
ret void
}