#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 _ada_use_celcon(int, int *, int *, double *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int read_supports(int r, int n) {
  int cnt[r], i, j, k, fail, i1;
  double x[n];
  for (i = 0; i < r; i++) {
    printf("  number of points in support %d : ", i + 1);
    scanf("%d", &cnt[i]);
  }
  for (i = 0; i < r; i++)
    for (j = 0; j < cnt[i]; j++) {
      printf("Reading point %d of support %d...\n", j + 1, i + 1);
      printf("  give %d coordinates : ", n - 1);
      for (k = 0; k < n - 1; k++)
        scanf("%lf", &x[k]);
      printf("  give lifting : ");
      scanf("%lf", &x[n - 1]);
      i1 = i + 1;
      fail = _ada_use_celcon(12, &i1, &n, x);
      if (fail != 0)
        return fail;
    }
  return fail;
}


x86 assembly (clang, -O0):
<read_supports>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d7 <read_supports+0xa7>
mov    -0x24(%rbp),%esi
add    $0x1,%esi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x58(%rbp),%rsi
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    118c <read_supports+0x5c>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1309 <read_supports+0x1d9>
movl   $0x0,-0x28(%rbp)
mov    -0x58(%rbp),%rcx
mov    -0x28(%rbp),%eax
movslq -0x24(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    12f6 <read_supports+0x1c6>
mov    -0x28(%rbp),%esi
add    $0x1,%esi
mov    -0x24(%rbp),%edx
add    $0x1,%edx
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1276 <read_supports+0x146>
mov    -0x50(%rbp),%rsi
movslq -0x2c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    123a <read_supports+0x10a>
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%rsi
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x50(%rbp),%rcx
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    $0xc,%edi
lea    -0x34(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <_ada_use_celcon@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
je     12e3 <read_supports+0x1b3>
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x44(%rbp)
jmp    1316 <read_supports+0x1e6>
jmp    12e8 <read_supports+0x1b8>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11f1 <read_supports+0xc1>
jmp    12fb <read_supports+0x1cb>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11de <read_supports+0xae>
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x44(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_supports>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %esi,-0x2c(%rbp)
mov    %edi,%r15d
mov    %rsp,%rbx
lea    0xf(,%r15,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %esi,%eax
mov    %rsp,%rcx
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
test   %edi,%edi
jle    12e0 <read_supports+0x1b0>
mov    %edi,-0x38(%rbp)
lea    0xe77(%rip),%r12
lea    0xe94(%rip),%r13
mov    %rbx,-0x48(%rbp)
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
add    $0x1,%r14
mov    %r12,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
add    $0x4,%rbx
cmp    %r14,%r15
jne    11a0 <read_supports+0x70>
cmpl   $0x0,-0x38(%rbp)
jle    12e0 <read_supports+0x1b0>
lea    0xe8b(%rip),%r13
xor    %edx,%edx
mov    -0x48(%rbp),%rcx
mov    %r15,-0x58(%rbp)
lea    0x1(%rdx),%rbx
xor    %r14d,%r14d
mov    %rdx,-0x38(%rbp)
mov    %rbx,-0x60(%rbp)
jmp    1258 <read_supports+0x128>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xe60(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movslq -0x2c(%rbp),%rax
mov    -0x50(%rbp),%r15
lea    (%r15,%rax,8),%rsi
add    $0xfffffffffffffff8,%rsi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    -0x60(%rbp),%rbx
mov    %ebx,-0x3c(%rbp)
mov    $0xc,%edi
lea    -0x3c(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
mov    %r15,%rcx
call   1050 <_ada_use_celcon@plt>
test   %eax,%eax
mov    -0x58(%rbp),%r15
mov    -0x48(%rbp),%rcx
mov    -0x38(%rbp),%rdx
jne    12e2 <read_supports+0x1b2>
cmp    (%rcx,%rdx,4),%r14d
jge    12d0 <read_supports+0x1a0>
add    $0x1,%r14d
lea    0xdbe(%rip),%rdi
mov    %r14d,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x2c(%rbp),%esi
add    $0xffffffff,%esi
lea    0xdc8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
cmpl   $0x2,-0x2c(%rbp)
jl     1200 <read_supports+0xd0>
mov    -0x50(%rbp),%r12
xor    %r15d,%r15d
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
add    $0x1,%r15
movslq -0x2c(%rbp),%rax
add    $0xffffffffffffffff,%rax
add    $0x8,%r12
cmp    %rax,%r15
jl     12a0 <read_supports+0x170>
jmp    1200 <read_supports+0xd0>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
mov    %rbx,%rdx
cmp    %r15,%rbx
jne    11e2 <read_supports+0xb2>
jmp    12e2 <read_supports+0x1b2>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [36 x i8] c" number of points in support %d : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [35 x i8] c"Reading point %d of support %d...\0A\00"
@.str.3 = [25 x i8] c" give %d coordinates : \00"
@.str.4 = [4 x i8] c"%lf\00"
@.str.5 = [18 x i8] c" give lifting : \00"
define i32 @read_supports(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i64
%14 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%15 = load i32, i32* %4
%16 = zext i32 %15 to i64
%17 = call i8* @llvm.stacksave()
store i8* %17, i8** %6
%18 = alloca i32, i64 %16
store i64 %16, i64* %7
%19 = load i32, i32* %5
%20 = zext i32 %19 to i64
%21 = alloca double, i64 %20
store i64 %20, i64* %13
store i32 0, i32* %8
br label %22
22: ; preds = %34, %2
%23 = load i32, i32* %8
%24 = load i32, i32* %4
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %37
26: ; preds = %22
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %8
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %18, i64 %31
%33 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %32)
br label %34
34: ; preds = %26
%35 = load i32, i32* %8
%36 = add nsw i32 %35, 1
store i32 %36, i32* %8
br label %22
37: ; preds = %22
store i32 0, i32* %8
br label %38
38: ; preds = %91, %37
%39 = load i32, i32* %8
%40 = load i32, i32* %4
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %94
42: ; preds = %38
store i32 0, i32* %9
br label %43
43: ; preds = %87, %42
%44 = load i32, i32* %9
%45 = load i32, i32* %8
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i32, i32* %18, i64 %46
%48 = load i32, i32* %47
%49 = icmp slt i32 %44, %48
br i1 %49, label %50, label %90
50: ; preds = %43
%51 = load i32, i32* %9
%52 = add nsw i32 %51, 1
%53 = load i32, i32* %8
%54 = add nsw i32 %53, 1
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %52, i32 %54)
%56 = load i32, i32* %5
%57 = sub nsw i32 %56, 1
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %57)
store i32 0, i32* %10
br label %59
59: ; preds = %69, %50
%60 = load i32, i32* %10
%61 = load i32, i32* %5
%62 = sub nsw i32 %61, 1
%63 = icmp slt i32 %60, %62
br i1 %63, label %64, label %72
64: ; preds = %59
%65 = load i32, i32* %10
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %21, i64 %66
%68 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %67)
br label %69
69: ; preds = %64
%70 = load i32, i32* %10
%71 = add nsw i32 %70, 1
store i32 %71, i32* %10
br label %59
72: ; preds = %59
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%74 = load i32, i32* %5
%75 = sub nsw i32 %74, 1
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds double, double* %21, i64 %76
%78 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %77)
%79 = load i32, i32* %8
%80 = add nsw i32 %79, 1
store i32 %80, i32* %12
%81 = call i32 @_ada_use_celcon(i32 12, i32* %12, i32* %5, double* %21)
store i32 %81, i32* %11
%82 = load i32, i32* %11
%83 = icmp ne i32 %82, 0
br i1 %83, label %84, label %86
84: ; preds = %72
%85 = load i32, i32* %11
store i32 %85, i32* %3
store i32 1, i32* %14
br label %96
86: ; preds = %72
br label %87
87: ; preds = %86
%88 = load i32, i32* %9
%89 = add nsw i32 %88, 1
store i32 %89, i32* %9
br label %43
90: ; preds = %43
br label %91
91: ; preds = %90
%92 = load i32, i32* %8
%93 = add nsw i32 %92, 1
store i32 %93, i32* %8
br label %38
94: ; preds = %38
%95 = load i32, i32* %11
store i32 %95, i32* %3
store i32 1, i32* %14
br label %96
96: ; preds = %94, %84
%97 = load i8*, i8** %6
%98 = load i32, i32* %3
ret i32 %98
}

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