#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 cosupsys_to_c(int n, int m, int moncnt[n], int ns, int s[ns], int nc,
                  double c[nc]) {
  int i;
  printf("Entering the C function ...\n");
  printf("The number of equations : %d.\n", n);
  printf("The number of variables : %d.\n", m);
  printf("#monomials :");
  for (i = 0; i < n; i++)
    printf(" %d", moncnt[i]);
  printf("\n");
  printf("Length of the support : %d.\n", ns);
  printf("The support : ");
  for (i = 0; i < ns; i++)
    printf(" %d", s[i]);
  printf(".\n");
  printf("Number of coefficients : %d.\n", nc);
  printf("The coefficients :\n");
  for (i = 0; i < nc; i++)
    printf(" %.15lf\n", c[i]);
  printf("... leaving the C function.\n");
  return 0;
}


x86 assembly (clang, -O0):
<cosupsys_to_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11a9 <cosupsys_to_c+0x99>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1176 <cosupsys_to_c+0x66>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1210 <cosupsys_to_c+0x100>
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11dd <cosupsys_to_c+0xcd>
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1279 <cosupsys_to_c+0x169>
mov    0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe66(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1244 <cosupsys_to_c+0x134>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cosupsys_to_c>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,0x4(%rsp)
mov    %r8,%r13
mov    %ecx,%r15d
mov    %rdx,%rbp
mov    %esi,%ebx
mov    %edi,%r12d
lea    0xf4d(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9f(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xead(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r12d,%r12d
jle    11b8 <cosupsys_to_c+0x88>
mov    %r12d,%ebx
lea    0xeb3(%rip),%r12
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp,%r14,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r14
cmp    %r14,%rbx
jne    11a0 <cosupsys_to_c+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe86(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r15d,%r15d
jle    1218 <cosupsys_to_c+0xe8>
mov    %r15d,%ebp
lea    0xe5b(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%r13,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1200 <cosupsys_to_c+0xd0>
lea    0xe9d(%rip),%rdi
call   1040 <puts@plt>
lea    0xe50(%rip),%rdi
mov    0x4(%rsp),%ebx
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe7f(%rip),%rdi
call   1040 <puts@plt>
test   %ebx,%ebx
jle    1279 <cosupsys_to_c+0x149>
mov    0x40(%rsp),%r15
mov    %ebx,%ebp
xor    %ebx,%ebx
lea    0xe41(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsd  (%r15,%rbx,8),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1260 <cosupsys_to_c+0x130>
lea    0xe51(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.1 = [31 x i8] c"The number of equations : %d.\0A\00"
@.str.2 = [31 x i8] c"The number of variables : %d.\0A\00"
@.str.3 = [13 x i8] c"#monomials :\00"
@.str.4 = [4 x i8] c" %d\00"
@.str.6 = [29 x i8] c"Length of the support : %d.\0A\00"
@.str.7 = [15 x i8] c"The support : \00"
@.str.9 = [30 x i8] c"Number of coefficients : %d.\0A\00"
@.str.11 = [9 x i8] c" %.15lf\0A\00"
@str = [28 x i8] c"Entering the C function ...\00"
@str.13 = [2 x i8] c".\00"
@str.14 = [19 x i8] c"The coefficients :\00"
@str.15 = [28 x i8] c"... leaving the C function.\00"
define i32 @cosupsys_to_c(i32 %0, i32 %1, i32* nocapture %2, i32 %3, i32* nocapture %4, i32 %5, double* nocapture %6) {
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %1)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp sgt i32 %0, 0
br i1 %12, label %13, label %22
13: ; preds = %7
%14 = zext i32 %0 to i64
br label %15
15: ; preds = %13, %15
%16 = phi i64 [ 0, %13 ], [ %20, %15 ]
%17 = getelementptr inbounds i32, i32* %2, i64 %16
%18 = load i32, i32* %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %18)
%20 = add nuw nsw i64 %16, 1
%21 = icmp eq i64 %20, %14
br i1 %21, label %22, label %15
22: ; preds = %15, %7
%23 = tail call i32 @putchar(i32 10)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0), i32 %3)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
%26 = icmp sgt i32 %3, 0
br i1 %26, label %27, label %36
27: ; preds = %22
%28 = zext i32 %3 to i64
br label %29
29: ; preds = %27, %29
%30 = phi i64 [ 0, %27 ], [ %34, %29 ]
%31 = getelementptr inbounds i32, i32* %4, i64 %30
%32 = load i32, i32* %31
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %32)
%34 = add nuw nsw i64 %30, 1
%35 = icmp eq i64 %34, %28
br i1 %35, label %36, label %29
36: ; preds = %29, %22
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.13, i64 0, i64 0))
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0), i32 %5)
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.14, i64 0, i64 0))
%40 = icmp sgt i32 %5, 0
br i1 %40, label %41, label %50
41: ; preds = %36
%42 = zext i32 %5 to i64
br label %43
43: ; preds = %41, %43
%44 = phi i64 [ 0, %41 ], [ %48, %43 ]
%45 = getelementptr inbounds double, double* %6, i64 %44
%46 = load double, double* %45
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), double %46)
%48 = add nuw nsw i64 %44, 1
%49 = icmp eq i64 %48, %42
br i1 %49, label %50, label %43
50: ; preds = %43, %36
%51 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.15, i64 0, i64 0))
ret i32 0
}