#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 syscon_degree_of_multprec_polynomial(int, int *);
int syscon_load_multprec_polynomial(int, int *, char *);
int syscon_number_of_multprec_polynomials(int *);
int syscon_number_of_multprec_terms(int, int *);
int syscon_read_multprec_system(int);
int syscon_write_multprec_system();
int /*<<< orphan*/ test_symbol_table();
void test_multprec_container(void) {
  int deci, fail, n, i, t, deg;
  printf("\nGive the number of decimal places in the working precision : ");
  scanf("%d", &deci);
  fail = syscon_read_multprec_system(deci);
  fail = syscon_write_multprec_system();
  fail = syscon_number_of_multprec_polynomials(&n);
  printf("number of polynomials : %d\n", n);
  printf("number of terms in each polynomial :");
  for (i = 1; i <= n; i++) {
    fail = syscon_number_of_multprec_terms(i, &t);
    printf(" %d", t);
  }
  printf("\ndegree of each polynomial :");
  for (i = 1; i <= n; i++) {
    fail = syscon_degree_of_multprec_polynomial(i, &deg);
    printf(" %d", deg);
  }
  printf("\nthe polynomials as strings :\n");
  for (i = 1; i <= n; i++) {
    char buffer[4000];
    int nc;
    fail = syscon_load_multprec_polynomial(i, &nc, buffer);
    printf("polynomial %d : %s\n", i, buffer);
  }
  printf("\n");
  test_symbol_table();
}


x86 assembly (clang, -O0):
<test_multprec_container>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfd0,%rsp
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   10a0 <scanf@plt>
mov    -0x4(%rbp),%edi
call   1030 <syscon_read_multprec_system@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1070 <syscon_write_multprec_system@plt>
mov    %eax,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
call   1050 <syscon_number_of_multprec_polynomials@plt>
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     123a <test_multprec_container+0xaa>
mov    -0x10(%rbp),%edi
lea    -0x14(%rbp),%rsi
call   1040 <syscon_number_of_multprec_terms@plt>
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1200 <test_multprec_container+0x70>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1289 <test_multprec_container+0xf9>
mov    -0x10(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1080 <syscon_degree_of_multprec_polynomial@plt>
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    124f <test_multprec_container+0xbf>
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     12e9 <test_multprec_container+0x159>
mov    -0x10(%rbp),%edi
lea    -0xfc0(%rbp),%rdx
lea    -0xfc4(%rbp),%rsi
call   10b0 <syscon_load_multprec_polynomial@plt>
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%esi
lea    -0xfc0(%rbp),%rdx
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    129e <test_multprec_container+0x10e>
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1090 <test_symbol_table@plt>
add    $0xfd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_multprec_container>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xfc8,%rsp
lea    0xe3c(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    0x18(%rsp),%rsi
call   10c0 <scanf@plt>
mov    0x18(%rsp),%edi
call   1030 <syscon_read_multprec_system@plt>
xor    %eax,%eax
call   1090 <syscon_write_multprec_system@plt>
lea    0xc(%rsp),%rdi
call   1070 <syscon_number_of_multprec_polynomials@plt>
mov    0xc(%rsp),%esi
lea    0xe3e(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xe4c(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1251 <test_multprec_container+0xa1>
lea    0x14(%rsp),%r14
lea    0xe57(%rip),%rbx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
call   1040 <syscon_number_of_multprec_terms@plt>
mov    0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
cmp    0xc(%rsp),%ebp
jl     1230 <test_multprec_container+0x80>
lea    0xe2c(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
cmpl   $0x0,0xc(%rsp)
jle    12a1 <test_multprec_container+0xf1>
lea    0x10(%rsp),%r14
lea    0xe0e(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
call   10a0 <syscon_degree_of_multprec_polynomial@plt>
mov    0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <printf@plt>
cmp    0xc(%rsp),%ebp
jl     1280 <test_multprec_container+0xd0>
lea    0xe0d(%rip),%rdi
call   1060 <puts@plt>
cmpl   $0x0,0xc(%rsp)
jle    12f5 <test_multprec_container+0x145>
lea    0x1c(%rsp),%r14
lea    0x20(%rsp),%rbx
lea    0xddc(%rip),%r15
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   10d0 <syscon_load_multprec_polynomial@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1080 <printf@plt>
cmp    0xc(%rsp),%ebp
jl     12d0 <test_multprec_container+0x120>
mov    $0xa,%edi
call   1050 <putchar@plt>
xor    %eax,%eax
call   10b0 <test_symbol_table@plt>
add    $0xfc8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [63 x i8] c"\0AGive the number of decimal places in the working precision : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [28 x i8] c"number of polynomials : %d\0A\00"
@.str.3 = [37 x i8] c"number of terms in each polynomial :\00"
@.str.4 = [4 x i8] c" %d\00"
@.str.5 = [29 x i8] c"\0Adegree of each polynomial :\00"
@.str.6 = [31 x i8] c"\0Athe polynomials as strings :\0A\00"
@.str.7 = [20 x i8] c"polynomial %d : %s\0A\00"
@.str.8 = [2 x i8] c"\0A\00"
define void @test_multprec_container() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [4000 x i8]
%8 = alloca i32
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = call i32 @syscon_read_multprec_system(i32 %11)
store i32 %12, i32* %2
%13 = call i32 (...) @syscon_write_multprec_system()
store i32 %13, i32* %2
%14 = call i32 @syscon_number_of_multprec_polynomials(i32* %3)
store i32 %14, i32* %2
%15 = load i32, i32* %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %4
br label %18
18: ; preds = %27, %0
%19 = load i32, i32* %4
%20 = load i32, i32* %3
%21 = icmp sle i32 %19, %20
br i1 %21, label %22, label %30
22: ; preds = %18
%23 = load i32, i32* %4
%24 = call i32 @syscon_number_of_multprec_terms(i32 %23, i32* %5)
store i32 %24, i32* %2
%25 = load i32, i32* %5
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %22
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %18
30: ; preds = %18
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %4
br label %32
32: ; preds = %41, %30
%33 = load i32, i32* %4
%34 = load i32, i32* %3
%35 = icmp sle i32 %33, %34
br i1 %35, label %36, label %44
36: ; preds = %32
%37 = load i32, i32* %4
%38 = call i32 @syscon_degree_of_multprec_polynomial(i32 %37, i32* %6)
store i32 %38, i32* %2
%39 = load i32, i32* %6
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %39)
br label %41
41: ; preds = %36
%42 = load i32, i32* %4
%43 = add nsw i32 %42, 1
store i32 %43, i32* %4
br label %32
44: ; preds = %32
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %4
br label %46
46: ; preds = %57, %44
%47 = load i32, i32* %4
%48 = load i32, i32* %3
%49 = icmp sle i32 %47, %48
br i1 %49, label %50, label %60
50: ; preds = %46
%51 = load i32, i32* %4
%52 = getelementptr inbounds [4000 x i8], [4000 x i8]* %7, i64 0, i64 0
%53 = call i32 @syscon_load_multprec_polynomial(i32 %51, i32* %8, i8* %52)
store i32 %53, i32* %2
%54 = load i32, i32* %4
%55 = getelementptr inbounds [4000 x i8], [4000 x i8]* %7, i64 0, i64 0
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 %54, i8* %55)
br label %57
57: ; preds = %50
%58 = load i32, i32* %4
%59 = add nsw i32 %58, 1
store i32 %59, i32* %4
br label %46
60: ; preds = %46
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%62 = call i32 (...) @test_symbol_table()
ret void
}

LLVM IR (-O2):
@.str = [63 x i8] c"\0AGive the number of decimal places in the working precision : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [28 x i8] c"number of polynomials : %d\0A\00"
@.str.3 = [37 x i8] c"number of terms in each polynomial :\00"
@.str.4 = [4 x i8] c" %d\00"
@.str.5 = [29 x i8] c"\0Adegree of each polynomial :\00"
@.str.7 = [20 x i8] c"polynomial %d : %s\0A\00"
@str = [30 x i8] c"\0Athe polynomials as strings :\00"
define void @test_multprec_container() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [4000 x i8]
%6 = alloca i32
%7 = bitcast i32* %1 to i8*
%8 = bitcast i32* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %1
%14 = call i32 @syscon_read_multprec_system(i32 %13)
%15 = call i32 (...) @syscon_write_multprec_system()
%16 = call i32 @syscon_number_of_multprec_polynomials(i32* %2)
%17 = load i32, i32* %2
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%20 = load i32, i32* %2
%21 = icmp slt i32 %20, 1
br i1 %21, label %30, label %22
22: ; preds = %0, %22
%23 = phi i32 [ %27, %22 ], [ 1, %0 ]
%24 = call i32 @syscon_number_of_multprec_terms(i32 %23, i32* %3)
%25 = load i32, i32* %3
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %25)
%27 = add nuw nsw i32 %23, 1
%28 = load i32, i32* %2
%29 = icmp slt i32 %23, %28
br i1 %29, label %22, label %30
30: ; preds = %22, %0
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%32 = load i32, i32* %2
%33 = icmp slt i32 %32, 1
br i1 %33, label %42, label %34
34: ; preds = %30, %34
%35 = phi i32 [ %39, %34 ], [ 1, %30 ]
%36 = call i32 @syscon_degree_of_multprec_polynomial(i32 %35, i32* %4)
%37 = load i32, i32* %4
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %37)
%39 = add nuw nsw i32 %35, 1
%40 = load i32, i32* %2
%41 = icmp slt i32 %35, %40
br i1 %41, label %34, label %42
42: ; preds = %34, %30
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%44 = load i32, i32* %2
%45 = icmp slt i32 %44, 1
br i1 %45, label %56, label %46
46: ; preds = %42
%47 = getelementptr inbounds [4000 x i8], [4000 x i8]* %5, i64 0, i64 0
%48 = bitcast i32* %6 to i8*
br label %49
49: ; preds = %46, %49
%50 = phi i32 [ 1, %46 ], [ %53, %49 ]
%51 = call i32 @syscon_load_multprec_polynomial(i32 %50, i32* %6, i8* %47)
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 %50, i8* %47)
%53 = add nuw nsw i32 %50, 1
%54 = load i32, i32* %2
%55 = icmp slt i32 %50, %54
br i1 %55, label %49, label %56
56: ; preds = %49, %42
%57 = call i32 @putchar(i32 10)
%58 = call i32 (...) @test_symbol_table()
ret void
}