#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();
void test_quaddobl_container(void) {
  int fail, n, i, t, deg;
  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();
}


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>
mov    $0x0,%al
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>
xor    %eax,%eax
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 [4000 x i8]
%7 = alloca i32
%8 = call i32 (...) @syscon_read_quaddobl_system()
store i32 %8, i32* %1
%9 = call i32 (...) @syscon_write_quaddobl_system()
store i32 %9, i32* %1
%10 = call i32 @syscon_number_of_quaddobl_polynomials(i32* %2)
store i32 %10, i32* %1
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = 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 %14
14: ; preds = %23, %0
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load i32, i32* %3
%20 = call i32 @syscon_number_of_quaddobl_terms(i32 %19, i32* %4)
store i32 %20, i32* %1
%21 = load i32, i32* %4
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %18
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %14
26: ; preds = %14
%27 = 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 %28
28: ; preds = %37, %26
%29 = load i32, i32* %3
%30 = load i32, i32* %2
%31 = icmp sle i32 %29, %30
br i1 %31, label %32, label %40
32: ; preds = %28
%33 = load i32, i32* %3
%34 = call i32 @syscon_degree_of_quaddobl_polynomial(i32 %33, i32* %5)
store i32 %34, i32* %1
%35 = load i32, i32* %5
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %32
%38 = load i32, i32* %3
%39 = add nsw i32 %38, 1
store i32 %39, i32* %3
br label %28
40: ; preds = %28
%41 = 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 %42
42: ; preds = %53, %40
%43 = load i32, i32* %3
%44 = load i32, i32* %2
%45 = icmp sle i32 %43, %44
br i1 %45, label %46, label %56
46: ; preds = %42
%47 = load i32, i32* %3
%48 = getelementptr inbounds [4000 x i8], [4000 x i8]* %6, i64 0, i64 0
%49 = call i32 @syscon_load_quaddobl_polynomial(i32 %47, i32* %7, i8* %48)
store i32 %49, i32* %1
%50 = load i32, i32* %3
%51 = getelementptr inbounds [4000 x i8], [4000 x i8]* %6, i64 0, i64 0
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %50, i8* %51)
br label %53
53: ; preds = %46
%54 = load i32, i32* %3
%55 = add nsw i32 %54, 1
store i32 %55, i32* %3
br label %42
56: ; preds = %42
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%58 = call i32 (...) @test_symbol_table()
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 [4000 x i8]
%5 = alloca i32
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = tail call i32 (...) @syscon_read_quaddobl_system()
%10 = tail call i32 (...) @syscon_write_quaddobl_system()
%11 = call i32 @syscon_number_of_quaddobl_polynomials(i32* %1)
%12 = load i32, i32* %1
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* %1
%16 = icmp slt i32 %15, 1
br i1 %16, label %25, label %17
17: ; preds = %0, %17
%18 = phi i32 [ %22, %17 ], [ 1, %0 ]
%19 = call i32 @syscon_number_of_quaddobl_terms(i32 %18, i32* %2)
%20 = load i32, i32* %2
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = add nuw nsw i32 %18, 1
%23 = load i32, i32* %1
%24 = icmp slt i32 %18, %23
br i1 %24, label %17, label %25
25: ; preds = %17, %0
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%27 = load i32, i32* %1
%28 = icmp slt i32 %27, 1
br i1 %28, label %37, label %29
29: ; preds = %25, %29
%30 = phi i32 [ %34, %29 ], [ 1, %25 ]
%31 = call i32 @syscon_degree_of_quaddobl_polynomial(i32 %30, i32* %3)
%32 = load i32, i32* %3
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %32)
%34 = add nuw nsw i32 %30, 1
%35 = load i32, i32* %1
%36 = icmp slt i32 %30, %35
br i1 %36, label %29, label %37
37: ; preds = %29, %25
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%39 = load i32, i32* %1
%40 = icmp slt i32 %39, 1
br i1 %40, label %51, label %41
41: ; preds = %37
%42 = getelementptr inbounds [4000 x i8], [4000 x i8]* %4, i64 0, i64 0
%43 = bitcast i32* %5 to i8*
br label %44
44: ; preds = %41, %44
%45 = phi i32 [ 1, %41 ], [ %48, %44 ]
%46 = call i32 @syscon_load_quaddobl_polynomial(i32 %45, i32* %5, i8* %42)
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %45, i8* %42)
%48 = add nuw nsw i32 %45, 1
%49 = load i32, i32* %1
%50 = icmp slt i32 %45, %49
br i1 %50, label %44, label %51
51: ; preds = %44, %37
%52 = call i32 @putchar(i32 10)
%53 = call i32 (...) @test_symbol_table()
ret void
}