#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 *);
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int query_cell(int, int);
int show_mixture(int, int *);
int write_lifted_supports(int);
void read_and_retrieve(void) {
  int n, fail, *d, r;
  double *c;
  int len, dim;
  char ans;
  fail = _ada_use_celcon(0, &n, d, c);
  printf("Do you wish to see the cells ? (y/n) ");
  ans = getchar();
  if (ans == 'y')
    fail = _ada_use_celcon(1, &n, d, c);
  fail = _ada_use_celcon(2, &len, d, c);
  printf("\nnumber of mixed cells : %d\n", len);
  fail = _ada_use_celcon(3, &dim, d, c);
  printf("dimension of the lifted points : %d\n", dim);
  fail = show_mixture(dim, &r);
  fail = write_lifted_supports(dim);
  fail = query_cell(dim, r);
}


x86 assembly (clang, -O0):
<read_and_retrieve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
xor    %edi,%edi
lea    -0x4(%rbp),%rsi
call   1080 <_ada_use_celcon@plt>
mov    %eax,-0x8(%rbp)
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %al,-0x29(%rbp)
movsbl -0x29(%rbp),%eax
cmp    $0x79,%eax
jne    11bc <read_and_retrieve+0x5c>
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x1,%edi
lea    -0x4(%rbp),%rsi
call   1080 <_ada_use_celcon@plt>
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x2,%edi
lea    -0x24(%rbp),%rsi
call   1080 <_ada_use_celcon@plt>
mov    %eax,-0x8(%rbp)
mov    -0x24(%rbp),%esi
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x3,%edi
lea    -0x28(%rbp),%rsi
call   1080 <_ada_use_celcon@plt>
mov    %eax,-0x8(%rbp)
mov    -0x28(%rbp),%esi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%edi
lea    -0x14(%rbp),%rsi
call   1030 <show_mixture@plt>
mov    %eax,-0x8(%rbp)
mov    -0x28(%rbp),%edi
call   1070 <write_lifted_supports@plt>
mov    %eax,-0x8(%rbp)
mov    -0x28(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <query_cell@plt>
mov    %eax,-0x8(%rbp)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_and_retrieve>:
sub    $0x18,%rsp
lea    0x14(%rsp),%rsi
xor    %edi,%edi
call   1080 <_ada_use_celcon@plt>
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0x79,%al
jne    1198 <read_and_retrieve+0x38>
lea    0x14(%rsp),%rsi
mov    $0x1,%edi
call   1080 <_ada_use_celcon@plt>
lea    0xc(%rsp),%rsi
mov    $0x2,%edi
call   1080 <_ada_use_celcon@plt>
mov    0xc(%rsp),%esi
lea    0xe74(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x8(%rsp),%rsi
mov    $0x3,%edi
call   1080 <_ada_use_celcon@plt>
mov    0x8(%rsp),%esi
lea    0xe70(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rsp),%edi
lea    0x10(%rsp),%rsi
call   1030 <show_mixture@plt>
mov    0x8(%rsp),%edi
call   1070 <write_lifted_supports@plt>
mov    0x8(%rsp),%edi
mov    0x10(%rsp),%esi
call   1040 <query_cell@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Do you wish to see the cells ? (y/n) \00"
@.str.1 = [29 x i8] c"\0Anumber of mixed cells : %d\0A\00"
@.str.2 = [37 x i8] c"dimension of the lifted points : %d\0A\00"
define void @read_and_retrieve() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = load i32*, i32** %3
%10 = load double*, double** %5
%11 = call i32 @_ada_use_celcon(i32 0, i32* %1, i32* %9, double* %10)
store i32 %11, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%13 = call signext i8 (...) @getchar()
store i8 %13, i8* %8
%14 = load i8, i8* %8
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 121
br i1 %16, label %17, label %21
17: ; preds = %0
%18 = load i32*, i32** %3
%19 = load double*, double** %5
%20 = call i32 @_ada_use_celcon(i32 1, i32* %1, i32* %18, double* %19)
store i32 %20, i32* %2
br label %21
21: ; preds = %17, %0
%22 = load i32*, i32** %3
%23 = load double*, double** %5
%24 = call i32 @_ada_use_celcon(i32 2, i32* %6, i32* %22, double* %23)
store i32 %24, i32* %2
%25 = load i32, i32* %6
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = load i32*, i32** %3
%28 = load double*, double** %5
%29 = call i32 @_ada_use_celcon(i32 3, i32* %7, i32* %27, double* %28)
store i32 %29, i32* %2
%30 = load i32, i32* %7
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %7
%33 = call i32 @show_mixture(i32 %32, i32* %4)
store i32 %33, i32* %2
%34 = load i32, i32* %7
%35 = call i32 @write_lifted_supports(i32 %34)
store i32 %35, i32* %2
%36 = load i32, i32* %7
%37 = load i32, i32* %4
%38 = call i32 @query_cell(i32 %36, i32 %37)
store i32 %38, i32* %2
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"Do you wish to see the cells ? (y/n) \00"
@.str.1 = [29 x i8] c"\0Anumber of mixed cells : %d\0A\00"
@.str.2 = [37 x i8] c"dimension of the lifted points : %d\0A\00"
define void @read_and_retrieve() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @_ada_use_celcon(i32 0, i32* %1, i32* undef, double* undef)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%11 = call signext i8 (...) @getchar()
%12 = icmp eq i8 %11, 121
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 @_ada_use_celcon(i32 1, i32* %1, i32* undef, double* undef)
br label %15
15: ; preds = %13, %0
%16 = call i32 @_ada_use_celcon(i32 2, i32* %3, i32* undef, double* undef)
%17 = load i32, i32* %3
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = call i32 @_ada_use_celcon(i32 3, i32* %4, i32* undef, double* undef)
%20 = load i32, i32* %4
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %4
%23 = call i32 @show_mixture(i32 %22, i32* %2)
%24 = load i32, i32* %4
%25 = call i32 @write_lifted_supports(i32 %24)
%26 = load i32, i32* %4
%27 = load i32, i32* %2
%28 = call i32 @query_cell(i32 %26, i32 %27)
ret void
}