#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 syscon_degree_of_quaddobl_polynomial(int, int *);
int syscon_load_quaddobl_polynomial(int, int *, char *);
int syscon_number_of_quaddobl_polynomials(int *);
int syscon_number_of_quaddobl_terms(int, int *);
int syscon_read_quaddobl_system();
int syscon_write_quaddobl_system();
int /*<<< orphan*/ test_symbol_table(int *);
void test_quaddobl_container(void) {
  int fail, n, i, t, deg, nvr;
  fail = syscon_read_quaddobl_system();
  fail = syscon_write_quaddobl_system();
  fail = syscon_number_of_quaddobl_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_quaddobl_terms(i, &t);
    printf(" %d", t);
  }
  printf("\ndegree of each polynomial :");
  for (i = 1; i <= n; i++) {
    fail = syscon_degree_of_quaddobl_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_quaddobl_polynomial(i, &nc, buffer);
    printf("polynomial %d : %s\n", i, buffer);
  }
  printf("\n");
  test_symbol_table(&nvr);
}


x86 assembly (clang, -O0):
<test_quaddobl_container>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfd0,%rsp
mov    $0x0,%al
call   1030 <syscon_read_quaddobl_system@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1080 <syscon_write_quaddobl_system@plt>
mov    %eax,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1070 <syscon_number_of_quaddobl_polynomials@plt>
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     120b <test_quaddobl_container+0x8b>
mov    -0xc(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1040 <syscon_number_of_quaddobl_terms@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11d1 <test_quaddobl_container+0x51>
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     125a <test_quaddobl_container+0xda>
mov    -0xc(%rbp),%edi
lea    -0x14(%rbp),%rsi
call   1060 <syscon_degree_of_quaddobl_polynomial@plt>
mov    %eax,-0x4(%rbp)
mov    -0x14(%rbp),%esi
lea    0xdfc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1220 <test_quaddobl_container+0xa0>
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     12ba <test_quaddobl_container+0x13a>
mov    -0xc(%rbp),%edi
lea    -0xfc0(%rbp),%rdx
lea    -0xfc4(%rbp),%rsi
call   10a0 <syscon_load_quaddobl_polynomial@plt>
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%esi
lea    -0xfc0(%rbp),%rdx
lea    0xddc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    126f <test_quaddobl_container+0xef>
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x18(%rbp),%rdi
call   1090 <test_symbol_table@plt>
add    $0xfd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_quaddobl_container>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xfb8,%rsp
xor    %eax,%eax
call   1050 <syscon_read_quaddobl_system@plt>
xor    %eax,%eax
call   10a0 <syscon_write_quaddobl_system@plt>
mov    %rsp,%rdi
call   1090 <syscon_number_of_quaddobl_polynomials@plt>
mov    (%rsp),%esi
lea    0xe33(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe41(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
cmpl   $0x0,(%rsp)
jle    1220 <test_quaddobl_container+0x80>
lea    0x8(%rsp),%r14
lea    0xe4d(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
call   1060 <syscon_number_of_quaddobl_terms@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
cmp    (%rsp),%ebp
jl     1200 <test_quaddobl_container+0x60>
lea    0xe1e(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
cmpl   $0x0,(%rsp)
jle    1270 <test_quaddobl_container+0xd0>
lea    0x4(%rsp),%r14
lea    0xe01(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
call   1080 <syscon_degree_of_quaddobl_polynomial@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
cmp    (%rsp),%ebp
jl     1250 <test_quaddobl_container+0xb0>
lea    0xdff(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,(%rsp)
jle    12c4 <test_quaddobl_container+0x124>
lea    0xc(%rsp),%r14
lea    0x10(%rsp),%rbx
lea    0xdcf(%rip),%r15
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebp
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   10c0 <syscon_load_quaddobl_polynomial@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
cmp    (%rsp),%ebp
jl     12a0 <test_quaddobl_container+0x100>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x10(%rsp),%rdi
call   10b0 <test_symbol_table@plt>
add    $0xfb8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"number of polynomials : %d\0A\00"
@.str.1 = [37 x i8] c"number of terms in each polynomial :\00"
@.str.2 = [4 x i8] c" %d\00"
@.str.3 = [29 x i8] c"\0Adegree of each polynomial :\00"
@.str.4 = [31 x i8] c"\0Athe polynomials as strings :\0A\00"
@.str.5 = [20 x i8] c"polynomial %d : %s\0A\00"
@.str.6 = [2 x i8] c"\0A\00"
define void @test_quaddobl_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 (...) @syscon_read_quaddobl_system()
store i32 %9, i32* %1
%10 = call i32 (...) @syscon_write_quaddobl_system()
store i32 %10, i32* %1
%11 = call i32 @syscon_number_of_quaddobl_polynomials(i32* %2)
store i32 %11, i32* %1
%12 = load i32, i32* %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %15
15: ; preds = %24, %0
%16 = load i32, i32* %3
%17 = load i32, i32* %2
%18 = icmp sle i32 %16, %17
br i1 %18, label %19, label %27
19: ; preds = %15
%20 = load i32, i32* %3
%21 = call i32 @syscon_number_of_quaddobl_terms(i32 %20, i32* %4)
store i32 %21, i32* %1
%22 = load i32, i32* %4
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %19
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %15
27: ; preds = %15
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %29
29: ; preds = %38, %27
%30 = load i32, i32* %3
%31 = load i32, i32* %2
%32 = icmp sle i32 %30, %31
br i1 %32, label %33, label %41
33: ; preds = %29
%34 = load i32, i32* %3
%35 = call i32 @syscon_degree_of_quaddobl_polynomial(i32 %34, i32* %5)
store i32 %35, i32* %1
%36 = load i32, i32* %5
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %33
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %29
41: ; preds = %29
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %43
43: ; preds = %54, %41
%44 = load i32, i32* %3
%45 = load i32, i32* %2
%46 = icmp sle i32 %44, %45
br i1 %46, label %47, label %57
47: ; preds = %43
%48 = load i32, i32* %3
%49 = getelementptr inbounds [4000 x i8], [4000 x i8]* %7, i64 0, i64 0
%50 = call i32 @syscon_load_quaddobl_polynomial(i32 %48, i32* %8, i8* %49)
store i32 %50, i32* %1
%51 = load i32, i32* %3
%52 = getelementptr inbounds [4000 x i8], [4000 x i8]* %7, i64 0, i64 0
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %51, i8* %52)
br label %54
54: ; preds = %47
%55 = load i32, i32* %3
%56 = add nsw i32 %55, 1
store i32 %56, i32* %3
br label %43
57: ; preds = %43
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%59 = call i32 @test_symbol_table(i32* %6)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"number of polynomials : %d\0A\00"
@.str.1 = [37 x i8] c"number of terms in each polynomial :\00"
@.str.2 = [4 x i8] c" %d\00"
@.str.3 = [29 x i8] c"\0Adegree of each polynomial :\00"
@.str.5 = [20 x i8] c"polynomial %d : %s\0A\00"
@str = [30 x i8] c"\0Athe polynomials as strings :\00"
define void @test_quaddobl_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 (...) @syscon_read_quaddobl_system()
%12 = tail call i32 (...) @syscon_write_quaddobl_system()
%13 = call i32 @syscon_number_of_quaddobl_polynomials(i32* %1)
%14 = load i32, i32* %1
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32, i32* %1
%18 = icmp slt i32 %17, 1
br i1 %18, label %27, label %19
19: ; preds = %0, %19
%20 = phi i32 [ %24, %19 ], [ 1, %0 ]
%21 = call i32 @syscon_number_of_quaddobl_terms(i32 %20, i32* %2)
%22 = load i32, i32* %2
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = add nuw nsw i32 %20, 1
%25 = load i32, i32* %1
%26 = icmp slt i32 %20, %25
br i1 %26, label %19, label %27
27: ; preds = %19, %0
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%29 = load i32, i32* %1
%30 = icmp slt i32 %29, 1
br i1 %30, label %39, label %31
31: ; preds = %27, %31
%32 = phi i32 [ %36, %31 ], [ 1, %27 ]
%33 = call i32 @syscon_degree_of_quaddobl_polynomial(i32 %32, i32* %3)
%34 = load i32, i32* %3
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %34)
%36 = add nuw nsw i32 %32, 1
%37 = load i32, i32* %1
%38 = icmp slt i32 %32, %37
br i1 %38, label %31, label %39
39: ; preds = %31, %27
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%41 = load i32, i32* %1
%42 = icmp slt i32 %41, 1
br i1 %42, label %53, label %43
43: ; preds = %39
%44 = getelementptr inbounds [4000 x i8], [4000 x i8]* %5, i64 0, i64 0
%45 = bitcast i32* %6 to i8*
br label %46
46: ; preds = %43, %46
%47 = phi i32 [ 1, %43 ], [ %50, %46 ]
%48 = call i32 @syscon_load_quaddobl_polynomial(i32 %47, i32* %6, i8* %44)
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %47, i8* %44)
%50 = add nuw nsw i32 %47, 1
%51 = load i32, i32* %1
%52 = icmp slt i32 %47, %51
br i1 %52, label %46, label %53
53: ; preds = %46, %39
%54 = call i32 @putchar(i32 10)
%55 = call i32 @test_symbol_table(i32* %4)
ret void
}