#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 celcon_append_lifted_point(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;
  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]);
      fail = celcon_append_lifted_point(n, i + 1, x);
      if (fail != 0)
        return fail;
    }
  return fail;
}


x86 assembly (clang, -O0):
<read_supports>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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,-0x50(%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,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%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    -0x50(%rbp),%rsi
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1050 <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    12fc <read_supports+0x1cc>
movl   $0x0,-0x28(%rbp)
mov    -0x50(%rbp),%rcx
mov    -0x28(%rbp),%eax
movslq -0x24(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    12e9 <read_supports+0x1b9>
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    -0x48(%rbp),%rsi
movslq -0x2c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1050 <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    -0x48(%rbp),%rsi
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x48(%rbp),%rdx
mov    -0xc(%rbp),%edi
mov    -0x24(%rbp),%esi
add    $0x1,%esi
call   1040 <celcon_append_lifted_point@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
je     12d6 <read_supports+0x1a6>
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x3c(%rbp)
jmp    1309 <read_supports+0x1d9>
jmp    12db <read_supports+0x1ab>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11f1 <read_supports+0xc1>
jmp    12ee <read_supports+0x1be>
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,-0x3c(%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    %edi,%r12d
mov    %rsp,%rbx
lea    0xf(,%r12,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %esi,%eax
mov    %rsp,%rdx
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rdx
mov    %rdx,-0x38(%rbp)
mov    %rdx,%rsp
test   %edi,%edi
jle    12b1 <read_supports+0x181>
mov    %esi,%r15d
mov    %edi,-0x30(%rbp)
lea    0xe9b(%rip),%r13
mov    %rbx,-0x40(%rbp)
xor    %r14d,%r14d
add    $0x1,%r14
lea    0xe65(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
add    $0x4,%rbx
cmp    %r14,%r12
jne    1190 <read_supports+0x60>
mov    %r12,-0x48(%rbp)
cmpl   $0x0,-0x30(%rbp)
jle    12b1 <read_supports+0x181>
lea    -0x1(%r15),%eax
mov    %rax,-0x30(%rbp)
cltq
mov    -0x38(%rbp),%rcx
lea    (%rcx,%rax,8),%rax
mov    %rax,-0x50(%rbp)
lea    0xe7d(%rip),%r13
xor    %edx,%edx
mov    -0x40(%rbp),%rcx
lea    0x1(%rdx),%rbx
xor    %r14d,%r14d
mov    %rdx,-0x60(%rbp)
mov    %rbx,-0x58(%rbp)
jmp    123d <read_supports+0x10d>
nopl   (%rax)
lea    0xe60(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13,%rdi
mov    -0x50(%rbp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %r12,%r15
mov    %r15d,%edi
mov    -0x58(%rbp),%rbx
mov    %ebx,%esi
mov    -0x38(%rbp),%rdx
call   1040 <celcon_append_lifted_point@plt>
test   %eax,%eax
mov    -0x40(%rbp),%rcx
mov    -0x60(%rbp),%rdx
jne    12b3 <read_supports+0x183>
cmp    (%rcx,%rdx,4),%r14d
jge    12a0 <read_supports+0x170>
add    $0x1,%r14d
lea    0xdd9(%rip),%rdi
mov    %r14d,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xde9(%rip),%rdi
mov    -0x30(%rbp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%r12
cmp    $0x2,%r15d
jl     1200 <read_supports+0xd0>
mov    -0x30(%rbp),%rbx
mov    -0x38(%rbp),%r15
nopl   (%rax)
mov    %r13,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
add    $0x8,%r15
add    $0xffffffffffffffff,%rbx
jne    1280 <read_supports+0x150>
jmp    1200 <read_supports+0xd0>
nopl   0x0(%rax)
xor    %eax,%eax
mov    %rbx,%rdx
cmp    -0x48(%rbp),%rbx
jne    11ec <read_supports+0xbc>
jmp    12b3 <read_supports+0x183>
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 i64
%13 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%14 = load i32, i32* %4
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %6
%17 = alloca i32, i64 %15
store i64 %15, i64* %7
%18 = load i32, i32* %5
%19 = zext i32 %18 to i64
%20 = alloca double, i64 %19
store i64 %19, i64* %12
store i32 0, i32* %8
br label %21
21: ; preds = %33, %2
%22 = load i32, i32* %8
%23 = load i32, i32* %4
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %36
25: ; preds = %21
%26 = load i32, i32* %8
%27 = add nsw i32 %26, 1
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %17, i64 %30
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %31)
br label %33
33: ; preds = %25
%34 = load i32, i32* %8
%35 = add nsw i32 %34, 1
store i32 %35, i32* %8
br label %21
36: ; preds = %21
store i32 0, i32* %8
br label %37
37: ; preds = %91, %36
%38 = load i32, i32* %8
%39 = load i32, i32* %4
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %94
41: ; preds = %37
store i32 0, i32* %9
br label %42
42: ; preds = %87, %41
%43 = load i32, i32* %9
%44 = load i32, i32* %8
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32, i32* %17, i64 %45
%47 = load i32, i32* %46
%48 = icmp slt i32 %43, %47
br i1 %48, label %49, label %90
49: ; preds = %42
%50 = load i32, i32* %9
%51 = add nsw i32 %50, 1
%52 = load i32, i32* %8
%53 = add nsw i32 %52, 1
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %51, i32 %53)
%55 = load i32, i32* %5
%56 = sub nsw i32 %55, 1
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %56)
store i32 0, i32* %10
br label %58
58: ; preds = %68, %49
%59 = load i32, i32* %10
%60 = load i32, i32* %5
%61 = sub nsw i32 %60, 1
%62 = icmp slt i32 %59, %61
br i1 %62, label %63, label %71
63: ; preds = %58
%64 = load i32, i32* %10
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double, double* %20, i64 %65
%67 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %66)
br label %68
68: ; preds = %63
%69 = load i32, i32* %10
%70 = add nsw i32 %69, 1
store i32 %70, i32* %10
br label %58
71: ; preds = %58
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%73 = load i32, i32* %5
%74 = sub nsw i32 %73, 1
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds double, double* %20, i64 %75
%77 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %76)
%78 = load i32, i32* %5
%79 = load i32, i32* %8
%80 = add nsw i32 %79, 1
%81 = call i32 @celcon_append_lifted_point(i32 %78, i32 %80, double* %20)
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 = %71
%85 = load i32, i32* %11
store i32 %85, i32* %3
store i32 1, i32* %13
br label %96
86: ; preds = %71
br label %87
87: ; preds = %86
%88 = load i32, i32* %9
%89 = add nsw i32 %88, 1
store i32 %89, i32* %9
br label %42
90: ; preds = %42
br label %91
91: ; preds = %90
%92 = load i32, i32* %8
%93 = add nsw i32 %92, 1
store i32 %93, i32* %8
br label %37
94: ; preds = %37
%95 = load i32, i32* %11
store i32 %95, i32* %3
store i32 1, i32* %13
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 = zext i32 %0 to i64
%4 = alloca i32, i64 %3
%5 = zext i32 %1 to i64
%6 = alloca double, i64 %5
%7 = icmp sgt i32 %0, 0
br i1 %7, label %15, label %49
8: ; preds = %15
br i1 %7, label %9, label %49
9: ; preds = %8
%10 = add i32 %1, -1
%11 = icmp sgt i32 %1, 1
%12 = sext i32 %10 to i64
%13 = getelementptr inbounds double, double* %6, i64 %12
%14 = zext i32 %10 to i64
br label %23
15: ; preds = %2, %15
%16 = phi i64 [ %17, %15 ], [ 0, %2 ]
%17 = add nuw nsw i64 %16, 1
%18 = trunc i64 %17 to i32
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds i32, i32* %4, i64 %16
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %20)
%22 = icmp eq i64 %17, %3
br i1 %22, label %8, label %15
23: ; preds = %9, %47
%24 = phi i64 [ 0, %9 ], [ %26, %47 ]
%25 = getelementptr inbounds i32, i32* %4, i64 %24
%26 = add nuw nsw i64 %24, 1
%27 = trunc i64 %26 to i32
br label %28
28: ; preds = %23, %42
%29 = phi i32 [ %33, %42 ], [ 0, %23 ]
%30 = load i32, i32* %25
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %47
32: ; preds = %28
%33 = add nuw nsw i32 %29, 1
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %33, i32 %27)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %10)
br i1 %11, label %36, label %42
36: ; preds = %32, %36
%37 = phi i64 [ %40, %36 ], [ 0, %32 ]
%38 = getelementptr inbounds double, double* %6, i64 %37
%39 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %38)
%40 = add nuw nsw i64 %37, 1
%41 = icmp eq i64 %40, %14
br i1 %41, label %42, label %36
42: ; preds = %36, %32
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%44 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %13)
%45 = call i32 @celcon_append_lifted_point(i32 %1, i32 %27, double* %6)
%46 = icmp eq i32 %45, 0
br i1 %46, label %28, label %49
47: ; preds = %28
%48 = icmp eq i64 %26, %3
br i1 %48, label %49, label %23
49: ; preds = %47, %42, %2, %8
%50 = phi i32 [ 0, %8 ], [ 0, %2 ], [ %45, %42 ], [ 0, %47 ]
ret i32 %50
}