#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 *calloc(int, int);
int /*<<< orphan*/ printf(char *, ...);
int read_mixed_cell(int, int);
int read_supports(int, int);
int /*<<< orphan*/ scanf(char *, int *);
int show_mixture(int, int *);
int write_lifted_supports(int);
void read_and_construct(void) {
  int r, *mix, i, fail, rr, n;
  double *c;
  printf("\nGive the number of different supports : ");
  scanf("%d", &r);
  mix = calloc(r, sizeof(int));
  for (i = 0; i < r; i++) {
    printf("  how many times does support %d occur ? ", i + 1);
    scanf("%d", &mix[i]);
  }
  fail = _ada_use_celcon(11, &r, mix, c);
  fail = show_mixture(r, &rr);
  printf("\nGive the dimension of the lifted points : ");
  scanf("%d", &n);
  fail = read_supports(r, n);
  fail = write_lifted_supports(n);
  fail = read_mixed_cell(r, n);
  fail = _ada_use_celcon(1, &n, &r, c);
}


x86 assembly (clang, -O0):
<read_and_construct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe8d(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1207 <read_and_construct+0x87>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe36(%rip),%rdi
call   1080 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11be <read_and_construct+0x3e>
mov    -0x10(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    $0xb,%edi
lea    -0x4(%rbp),%rsi
call   1090 <_ada_use_celcon@plt>
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x1c(%rbp),%rsi
call   1030 <show_mixture@plt>
mov    %eax,-0x18(%rbp)
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xde6(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1060 <read_supports@plt>
mov    %eax,-0x18(%rbp)
mov    -0x20(%rbp),%edi
call   1070 <write_lifted_supports@plt>
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%esi
call   10a0 <read_mixed_cell@plt>
mov    %eax,-0x18(%rbp)
mov    -0x28(%rbp),%rcx
mov    $0x1,%edi
lea    -0x20(%rbp),%rsi
lea    -0x4(%rbp),%rdx
call   1090 <_ada_use_celcon@plt>
mov    %eax,-0x18(%rbp)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_and_construct>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe6c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe88(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x4(%rsp),%ebx
mov    %ebx,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,%r15
test   %ebx,%ebx
jle    1209 <read_and_construct+0x89>
lea    0xe63(%rip),%r14
lea    0xe59(%rip),%r12
mov    %r15,%r13
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1080 <scanf@plt>
movslq 0x4(%rsp),%rax
add    $0x4,%r13
cmp    %rax,%rbx
jl     11e0 <read_and_construct+0x60>
lea    0x4(%rsp),%r14
mov    $0xb,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1090 <_ada_use_celcon@plt>
mov    0x4(%rsp),%edi
lea    0xc(%rsp),%rsi
call   1030 <show_mixture@plt>
lea    0xe24(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xde9(%rip),%rdi
lea    0x8(%rsp),%rbx
mov    %rbx,%rsi
call   1080 <scanf@plt>
mov    0x4(%rsp),%edi
mov    0x8(%rsp),%esi
call   1060 <read_supports@plt>
mov    0x8(%rsp),%edi
call   1070 <write_lifted_supports@plt>
mov    0x4(%rsp),%edi
mov    0x8(%rsp),%esi
call   10a0 <read_mixed_cell@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1090 <_ada_use_celcon@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [42 x i8] c"\0AGive the number of different supports : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [42 x i8] c" how many times does support %d occur ? \00"
@.str.3 = [44 x i8] c"\0AGive the dimension of the lifted points : \00"
define void @read_and_construct() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double*
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = call i32* @calloc(i32 %10, i32 4)
store i32* %11, i32** %2
store i32 0, i32* %3
br label %12
12: ; preds = %25, %0
%13 = load i32, i32* %3
%14 = load i32, i32* %1
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %28
16: ; preds = %12
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = load i32*, i32** %2
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %23)
br label %25
25: ; preds = %16
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %12
28: ; preds = %12
%29 = load i32*, i32** %2
%30 = load double*, double** %7
%31 = call i32 @_ada_use_celcon(i32 11, i32* %1, i32* %29, double* %30)
store i32 %31, i32* %4
%32 = load i32, i32* %1
%33 = call i32 @show_mixture(i32 %32, i32* %5)
store i32 %33, i32* %4
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%36 = load i32, i32* %1
%37 = load i32, i32* %6
%38 = call i32 @read_supports(i32 %36, i32 %37)
store i32 %38, i32* %4
%39 = load i32, i32* %6
%40 = call i32 @write_lifted_supports(i32 %39)
store i32 %40, i32* %4
%41 = load i32, i32* %1
%42 = load i32, i32* %6
%43 = call i32 @read_mixed_cell(i32 %41, i32 %42)
store i32 %43, i32* %4
%44 = load double*, double** %7
%45 = call i32 @_ada_use_celcon(i32 1, i32* %6, i32* %1, double* %44)
store i32 %45, i32* %4
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"\0AGive the number of different supports : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [42 x i8] c" how many times does support %d occur ? \00"
@.str.3 = [44 x i8] c"\0AGive the dimension of the lifted points : \00"
define void @read_and_construct() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = call i32* @calloc(i32 %9, i32 4)
%11 = icmp sgt i32 %9, 0
br i1 %11, label %12, label %22
12: ; preds = %0, %12
%13 = phi i64 [ %14, %12 ], [ 0, %0 ]
%14 = add nuw nsw i64 %13, 1
%15 = trunc i64 %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds i32, i32* %10, i64 %13
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %17)
%19 = load i32, i32* %1
%20 = sext i32 %19 to i64
%21 = icmp slt i64 %14, %20
br i1 %21, label %12, label %22
22: ; preds = %12, %0
%23 = call i32 @_ada_use_celcon(i32 11, i32* %1, i32* %10, double* undef)
%24 = load i32, i32* %1
%25 = call i32 @show_mixture(i32 %24, i32* %2)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%27 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%28 = load i32, i32* %1
%29 = load i32, i32* %3
%30 = call i32 @read_supports(i32 %28, i32 %29)
%31 = load i32, i32* %3
%32 = call i32 @write_lifted_supports(i32 %31)
%33 = load i32, i32* %1
%34 = load i32, i32* %3
%35 = call i32 @read_mixed_cell(i32 %33, i32 %34)
%36 = call i32 @_ada_use_celcon(i32 1, i32* %3, i32* %1, double* undef)
ret void
}