#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(int *);
void test_multprec_container(void) {
  int deci, fail, n, i, t, deg, nvr;
  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(&nvr);
}


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>
lea    -0x1c(%rbp),%rdi
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>
lea    0x20(%rsp),%rdi
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 i32
%8 = alloca [4000 x i8]
%9 = alloca i32
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
%13 = call i32 @syscon_read_multprec_system(i32 %12)
store i32 %13, i32* %2
%14 = call i32 (...) @syscon_write_multprec_system()
store i32 %14, i32* %2
%15 = call i32 @syscon_number_of_multprec_polynomials(i32* %3)
store i32 %15, i32* %2
%16 = load i32, i32* %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = 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 %19
19: ; preds = %28, %0
%20 = load i32, i32* %4
%21 = load i32, i32* %3
%22 = icmp sle i32 %20, %21
br i1 %22, label %23, label %31
23: ; preds = %19
%24 = load i32, i32* %4
%25 = call i32 @syscon_number_of_multprec_terms(i32 %24, i32* %5)
store i32 %25, i32* %2
%26 = load i32, i32* %5
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %23
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %19
31: ; preds = %19
%32 = 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 %33
33: ; preds = %42, %31
%34 = load i32, i32* %4
%35 = load i32, i32* %3
%36 = icmp sle i32 %34, %35
br i1 %36, label %37, label %45
37: ; preds = %33
%38 = load i32, i32* %4
%39 = call i32 @syscon_degree_of_multprec_polynomial(i32 %38, i32* %6)
store i32 %39, i32* %2
%40 = load i32, i32* %6
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %40)
br label %42
42: ; preds = %37
%43 = load i32, i32* %4
%44 = add nsw i32 %43, 1
store i32 %44, i32* %4
br label %33
45: ; preds = %33
%46 = 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 %47
47: ; preds = %58, %45
%48 = load i32, i32* %4
%49 = load i32, i32* %3
%50 = icmp sle i32 %48, %49
br i1 %50, label %51, label %61
51: ; preds = %47
%52 = load i32, i32* %4
%53 = getelementptr inbounds [4000 x i8], [4000 x i8]* %8, i64 0, i64 0
%54 = call i32 @syscon_load_multprec_polynomial(i32 %52, i32* %9, i8* %53)
store i32 %54, i32* %2
%55 = load i32, i32* %4
%56 = getelementptr inbounds [4000 x i8], [4000 x i8]* %8, i64 0, i64 0
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 %55, i8* %56)
br label %58
58: ; preds = %51
%59 = load i32, i32* %4
%60 = add nsw i32 %59, 1
store i32 %60, i32* %4
br label %47
61: ; preds = %47
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%63 = call i32 @test_symbol_table(i32* %7)
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 i32
%6 = alloca [4000 x i8]
%7 = alloca i32
%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 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%15 = load i32, i32* %1
%16 = call i32 @syscon_read_multprec_system(i32 %15)
%17 = call i32 (...) @syscon_write_multprec_system()
%18 = call i32 @syscon_number_of_multprec_polynomials(i32* %2)
%19 = load i32, i32* %2
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%22 = load i32, i32* %2
%23 = icmp slt i32 %22, 1
br i1 %23, label %32, label %24
24: ; preds = %0, %24
%25 = phi i32 [ %29, %24 ], [ 1, %0 ]
%26 = call i32 @syscon_number_of_multprec_terms(i32 %25, i32* %3)
%27 = load i32, i32* %3
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %27)
%29 = add nuw nsw i32 %25, 1
%30 = load i32, i32* %2
%31 = icmp slt i32 %25, %30
br i1 %31, label %24, label %32
32: ; preds = %24, %0
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%34 = load i32, i32* %2
%35 = icmp slt i32 %34, 1
br i1 %35, label %44, label %36
36: ; preds = %32, %36
%37 = phi i32 [ %41, %36 ], [ 1, %32 ]
%38 = call i32 @syscon_degree_of_multprec_polynomial(i32 %37, i32* %4)
%39 = load i32, i32* %4
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %39)
%41 = add nuw nsw i32 %37, 1
%42 = load i32, i32* %2
%43 = icmp slt i32 %37, %42
br i1 %43, label %36, label %44
44: ; preds = %36, %32
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%46 = load i32, i32* %2
%47 = icmp slt i32 %46, 1
br i1 %47, label %58, label %48
48: ; preds = %44
%49 = getelementptr inbounds [4000 x i8], [4000 x i8]* %6, i64 0, i64 0
%50 = bitcast i32* %7 to i8*
br label %51
51: ; preds = %48, %51
%52 = phi i32 [ 1, %48 ], [ %55, %51 ]
%53 = call i32 @syscon_load_multprec_polynomial(i32 %52, i32* %7, i8* %49)
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i32 %52, i8* %49)
%55 = add nuw nsw i32 %52, 1
%56 = load i32, i32* %2
%57 = icmp slt i32 %52, %56
br i1 %57, label %51, label %58
58: ; preds = %51, %44
%59 = call i32 @putchar(i32 10)
%60 = call i32 @test_symbol_table(i32* %5)
ret void
}