#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*/ _ada_getsys3(int, int, int *, int, int *, int, double *);
int /*<<< orphan*/ printf(char *, ...);
int getsys2(int n, int m, int moncnt[n], int ns, int s[ns], int nc,
            double c[nc]) {
  int i;
  printf("\nThis is your friendly putsys...\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]);
  _ada_getsys3(n, m, moncnt, ns, s, nc, c);
  printf("... leaving the C function.\n");
  return 0;
}


x86 assembly (clang, -O0):
<getsys2>:
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    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11b9 <getsys2+0x99>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1186 <getsys2+0x66>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1220 <getsys2+0x100>
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11ed <getsys2+0xcd>
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1289 <getsys2+0x169>
mov    0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe5b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1254 <getsys2+0x134>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    -0x24(%rbp),%r9d
mov    0x10(%rbp),%rax
mov    %rax,(%rsp)
call   1040 <_ada_getsys3@plt>
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getsys2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%r13d
mov    %r8,%r14
mov    %ecx,0x8(%rsp)
mov    %rdx,%r15
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xf3c(%rip),%rdi
call   1040 <puts@plt>
lea    0xe8e(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe9d(%rip),%rdi
mov    %ebx,0x14(%rsp)
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea8(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,0xc(%rsp)
test   %ebp,%ebp
jle    11d7 <getsys2+0x97>
mov    0xc(%rsp),%ebx
lea    0xe9b(%rip),%r12
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r15,%rbp,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    11c0 <getsys2+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe67(%rip),%rdi
mov    0x8(%rsp),%ebx
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe70(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %ebx,%ebx
jle    1237 <getsys2+0xf7>
mov    0x8(%rsp),%ebp
lea    0xe39(%rip),%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r14,%rbx,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1220 <getsys2+0xe0>
mov    0x50(%rsp),%r12
lea    0xe7e(%rip),%rdi
call   1040 <puts@plt>
lea    0xe2c(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe63(%rip),%rdi
call   1040 <puts@plt>
mov    %r13d,0x10(%rsp)
test   %r13d,%r13d
jle    1299 <getsys2+0x159>
mov    0x10(%rsp),%ebp
xor    %r13d,%r13d
lea    0xe1c(%rip),%rbx
nopl   (%rax)
movsd  (%r12,%r13,8),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%r13
cmp    %r13,%rbp
jne    1280 <getsys2+0x140>
mov    %r12,(%rsp)
mov    0xc(%rsp),%edi
mov    0x14(%rsp),%esi
mov    %r15,%rdx
mov    0x8(%rsp),%ecx
mov    %r14,%r8
mov    0x10(%rsp),%r9d
call   1060 <_ada_getsys3@plt>
lea    0xe16(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"\0AThis is your friendly putsys...\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 @getsys2(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 ([34 x i8], [34 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 = load i32, i32* %8
%82 = load i32, i32* %9
%83 = load i32*, i32** %10
%84 = load i32, i32* %11
%85 = load i32*, i32** %12
%86 = load i32, i32* %13
%87 = load double*, double** %14
%88 = call i32 @_ada_getsys3(i32 %81, i32 %82, i32* %83, i32 %84, i32* %85, i32 %86, double* %87)
%89 = 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 = [33 x i8] c"\0AThis is your friendly putsys...\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 @getsys2(i32 %0, i32 %1, i32* %2, i32 %3, i32* %4, i32 %5, double* %6) {
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 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 @_ada_getsys3(i32 %0, i32 %1, i32* %2, i32 %3, i32* %4, i32 %5, double* %6)
%52 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.15, i64 0, i64 0))
ret i32 0
}