#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 *, ...);
void write_standard_tableau_form(int neq, int nvr, int *nbterms,
                                 double *coefficients, int *exponents) {
  int cffidx = 0;
  int expidx = 0;
  int idx, idxtrm, k;
  printf("%d\n", neq);
  for (idx = 0; idx < neq; idx++) {
    printf("%d\n", nbterms[idx]);
    for (idxtrm = 1; idxtrm <= nbterms[idx]; idxtrm++) {
      printf("%22.15e  %22.15e", coefficients[cffidx],
             coefficients[cffidx + 1]);
      cffidx = cffidx + 2;
      for (k = 0; k < nvr; k++)
        printf(" %d", exponents[expidx++]);
      printf("\n");
    }
  }
}


x86 assembly (clang, -O0):
<write_standard_tableau_form>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x4(%rbp),%esi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1239 <write_standard_tableau_form+0x129>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x2c(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jg     1226 <write_standard_tableau_form+0x116>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0xe4e(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    120a <write_standard_tableau_form+0xfa>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x28(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11cd <write_standard_tableau_form+0xbd>
lea    0xdf1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    117c <write_standard_tableau_form+0x6c>
jmp    122b <write_standard_tableau_form+0x11b>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1150 <write_standard_tableau_form+0x40>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_standard_tableau_form>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r8,0x20(%rsp)
mov    %rcx,0x30(%rsp)
mov    %rdx,0x10(%rsp)
mov    %esi,0xc(%rsp)
mov    %edi,%r12d
lea    0xeb5(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12d,%r12d
jle    1259 <write_standard_tableau_form+0x139>
mov    %r12d,%eax
mov    %rax,0x18(%rsp)
mov    0xc(%rsp),%r13d
lea    0xea3(%rip),%r12
xor    %ebp,%ebp
xor    %ebx,%ebx
xor    %r15d,%r15d
jmp    1193 <write_standard_tableau_form+0x73>
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%ebx
add    $0x1,%rbp
cmp    0x18(%rsp),%rbp
je     1259 <write_standard_tableau_form+0x139>
mov    %ebx,0x8(%rsp)
mov    0x10(%rsp),%rbx
mov    (%rbx,%rbp,4),%esi
lea    0xe5a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,(%rbx,%rbp,4)
jle    1180 <write_standard_tableau_form+0x60>
movslq %r15d,%r15
mov    $0x1,%r14d
mov    0x8(%rsp),%ebx
mov    %rbp,0x28(%rsp)
jmp    11f0 <write_standard_tableau_form+0xd0>
nopw   0x0(%rax,%rax,1)
add    $0x2,%r15
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r14),%eax
mov    0x10(%rsp),%rcx
cmp    (%rcx,%rbp,4),%r14d
mov    %eax,%r14d
jge    1184 <write_standard_tableau_form+0x64>
mov    0x30(%rsp),%rax
movsd  (%rax,%r15,8),%xmm0
movsd  0x8(%rax,%r15,8),%xmm1
lea    0xdfb(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11d0 <write_standard_tableau_form+0xb0>
mov    %ebx,0x8(%rsp)
movslq %ebx,%rax
mov    0x20(%rsp),%rcx
lea    (%rcx,%rax,4),%rbp
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    0x0(%rbp,%rbx,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %ebx,%r13d
jne    1230 <write_standard_tableau_form+0x110>
mov    0x8(%rsp),%eax
add    %ebx,%eax
mov    %eax,%ebx
mov    0x28(%rsp),%rbp
jmp    11d0 <write_standard_tableau_form+0xb0>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [17 x i8] c"%22.15e %22.15e\00"
@.str.2 = [4 x i8] c" %d\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @write_standard_tableau_form(i32 %0, i32 %1, i32* %2, double* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca double*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32* %2, i32** %8
store double* %3, double** %9
store i32* %4, i32** %10
store i32 0, i32* %11
store i32 0, i32* %12
%16 = load i32, i32* %6
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
store i32 0, i32* %13
br label %18
18: ; preds = %73, %5
%19 = load i32, i32* %13
%20 = load i32, i32* %6
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %76
22: ; preds = %18
%23 = load i32*, i32** %8
%24 = load i32, i32* %13
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
store i32 1, i32* %14
br label %29
29: ; preds = %69, %22
%30 = load i32, i32* %14
%31 = load i32*, i32** %8
%32 = load i32, i32* %13
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %31, i64 %33
%35 = load i32, i32* %34
%36 = icmp sle i32 %30, %35
br i1 %36, label %37, label %72
37: ; preds = %29
%38 = load double*, double** %9
%39 = load i32, i32* %11
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %38, i64 %40
%42 = load double, double* %41
%43 = load double*, double** %9
%44 = load i32, i32* %11
%45 = add nsw i32 %44, 1
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %43, i64 %46
%48 = load double, double* %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %42, double %48)
%50 = load i32, i32* %11
%51 = add nsw i32 %50, 2
store i32 %51, i32* %11
store i32 0, i32* %15
br label %52
52: ; preds = %64, %37
%53 = load i32, i32* %15
%54 = load i32, i32* %7
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %67
56: ; preds = %52
%57 = load i32*, i32** %10
%58 = load i32, i32* %12
%59 = add nsw i32 %58, 1
store i32 %59, i32* %12
%60 = sext i32 %58 to i64
%61 = getelementptr inbounds i32, i32* %57, i64 %60
%62 = load i32, i32* %61
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %62)
br label %64
64: ; preds = %56
%65 = load i32, i32* %15
%66 = add nsw i32 %65, 1
store i32 %66, i32* %15
br label %52
67: ; preds = %52
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %69
69: ; preds = %67
%70 = load i32, i32* %14
%71 = add nsw i32 %70, 1
store i32 %71, i32* %14
br label %29
72: ; preds = %29
br label %73
73: ; preds = %72
%74 = load i32, i32* %13
%75 = add nsw i32 %74, 1
store i32 %75, i32* %13
br label %18
76: ; preds = %18
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [17 x i8] c"%22.15e %22.15e\00"
@.str.2 = [4 x i8] c" %d\00"
define void @write_standard_tableau_form(i32 %0, i32 %1, i32* nocapture %2, double* nocapture %3, i32* nocapture %4) {
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
%7 = icmp sgt i32 %0, 0
br i1 %7, label %8, label %59
8: ; preds = %5
%9 = icmp sgt i32 %1, 0
%10 = zext i32 %0 to i64
br label %11
11: ; preds = %8, %54
%12 = phi i64 [ 0, %8 ], [ %57, %54 ]
%13 = phi i32 [ 0, %8 ], [ %56, %54 ]
%14 = phi i32 [ 0, %8 ], [ %55, %54 ]
%15 = getelementptr inbounds i32, i32* %2, i64 %12
%16 = load i32, i32* %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %15
%19 = icmp slt i32 %18, 1
br i1 %19, label %54, label %20
20: ; preds = %11
%21 = sext i32 %14 to i64
br label %22
22: ; preds = %20, %46
%23 = phi i64 [ %21, %20 ], [ %32, %46 ]
%24 = phi i32 [ 1, %20 ], [ %49, %46 ]
%25 = phi i32 [ %13, %20 ], [ %47, %46 ]
%26 = getelementptr inbounds double, double* %3, i64 %23
%27 = load double, double* %26
%28 = add nsw i64 %23, 1
%29 = getelementptr inbounds double, double* %3, i64 %28
%30 = load double, double* %29
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %27, double %30)
%32 = add nsw i64 %23, 2
br i1 %9, label %33, label %46
33: ; preds = %22
%34 = sext i32 %25 to i64
br label %35
35: ; preds = %33, %35
%36 = phi i64 [ %34, %33 ], [ %38, %35 ]
%37 = phi i32 [ 0, %33 ], [ %42, %35 ]
%38 = add nsw i64 %36, 1
%39 = getelementptr inbounds i32, i32* %4, i64 %36
%40 = load i32, i32* %39
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %40)
%42 = add nuw nsw i32 %37, 1
%43 = icmp eq i32 %42, %1
br i1 %43, label %44, label %35
44: ; preds = %35
%45 = trunc i64 %38 to i32
br label %46
46: ; preds = %44, %22
%47 = phi i32 [ %25, %22 ], [ %45, %44 ]
%48 = tail call i32 @putchar(i32 10)
%49 = add nuw nsw i32 %24, 1
%50 = load i32, i32* %15
%51 = icmp slt i32 %24, %50
br i1 %51, label %22, label %52
52: ; preds = %46
%53 = trunc i64 %32 to i32
br label %54
54: ; preds = %52, %11
%55 = phi i32 [ %14, %11 ], [ %53, %52 ]
%56 = phi i32 [ %13, %11 ], [ %47, %52 ]
%57 = add nuw nsw i64 %12, 1
%58 = icmp eq i64 %57, %10
br i1 %58, label %59, label %11
59: ; preds = %54, %5
ret void
}