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


x86 assembly (clang, -O0):
<read_and_retrieve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    %al,-0x2d(%rbp)
movsbl -0x2d(%rbp),%eax
cmp    $0x79,%eax
jne    11c7 <read_and_retrieve+0x37>
mov    $0x0,%al
call   10a0 <celcon_write_mixed_cell_configuration@plt>
mov    %eax,-0x8(%rbp)
lea    -0x24(%rbp),%rdi
call   1040 <celcon_number_of_cells@plt>
mov    %eax,-0x8(%rbp)
mov    -0x24(%rbp),%esi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x28(%rbp),%rdi
call   10b0 <celcon_dimension_of_points@plt>
mov    %eax,-0x8(%rbp)
mov    -0x28(%rbp),%esi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x28(%rbp),%edi
lea    -0x14(%rbp),%rsi
call   1030 <show_mixture@plt>
mov    %eax,-0x8(%rbp)
mov    -0x28(%rbp),%edi
call   1080 <write_lifted_supports@plt>
mov    %eax,-0x8(%rbp)
mov    -0x28(%rbp),%edi
mov    -0x14(%rbp),%esi
lea    -0x2c(%rbp),%rdx
call   1050 <query_cell@plt>
mov    %eax,-0x8(%rbp)
mov    -0x28(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x2c(%rbp),%edx
call   1090 <write_inner_products@plt>
mov    %eax,-0x8(%rbp)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_and_retrieve>:
sub    $0x18,%rsp
lea    0xe65(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
cmp    $0x79,%al
jne    11b4 <read_and_retrieve+0x24>
xor    %eax,%eax
call   10a0 <celcon_write_mixed_cell_configuration@plt>
lea    0x14(%rsp),%rdi
call   1040 <celcon_number_of_cells@plt>
mov    0x14(%rsp),%esi
lea    0xe5e(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x8(%rsp),%rdi
call   10b0 <celcon_dimension_of_points@plt>
mov    0x8(%rsp),%esi
lea    0xe5f(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%rsp),%edi
lea    0xc(%rsp),%rsi
call   1030 <show_mixture@plt>
mov    0x8(%rsp),%edi
call   1080 <write_lifted_supports@plt>
mov    0x8(%rsp),%edi
mov    0xc(%rsp),%esi
lea    0x10(%rsp),%rdx
call   1050 <query_cell@plt>
mov    0x8(%rsp),%edi
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%edx
call   1090 <write_inner_products@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [39 x i8] c"\0ADo 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 i32
%9 = alloca i8
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%11 = call signext i8 (...) @getchar()
store i8 %11, i8* %9
%12 = load i8, i8* %9
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 121
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 (...) @celcon_write_mixed_cell_configuration()
store i32 %16, i32* %2
br label %17
17: ; preds = %15, %0
%18 = call i32 @celcon_number_of_cells(i32* %6)
store i32 %18, i32* %2
%19 = load i32, i32* %6
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = call i32 @celcon_dimension_of_points(i32* %7)
store i32 %21, i32* %2
%22 = load i32, i32* %7
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%24 = load i32, i32* %7
%25 = call i32 @show_mixture(i32 %24, i32* %4)
store i32 %25, i32* %2
%26 = load i32, i32* %7
%27 = call i32 @write_lifted_supports(i32 %26)
store i32 %27, i32* %2
%28 = load i32, i32* %7
%29 = load i32, i32* %4
%30 = call i32 @query_cell(i32 %28, i32 %29, i32* %8)
store i32 %30, i32* %2
%31 = load i32, i32* %7
%32 = load i32, i32* %4
%33 = load i32, i32* %8
%34 = call i32 @write_inner_products(i32 %31, i32 %32, i32 %33)
store i32 %34, i32* %2
ret void
}

LLVM IR (-O2):
@.str = [39 x i8] c"\0ADo 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 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%10 = tail call signext i8 (...) @getchar()
%11 = icmp eq i8 %10, 121
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = tail call i32 (...) @celcon_write_mixed_cell_configuration()
br label %14
14: ; preds = %12, %0
%15 = call i32 @celcon_number_of_cells(i32* %2)
%16 = load i32, i32* %2
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = call i32 @celcon_dimension_of_points(i32* %3)
%19 = load i32, i32* %3
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %3
%22 = call i32 @show_mixture(i32 %21, i32* %1)
%23 = load i32, i32* %3
%24 = call i32 @write_lifted_supports(i32 %23)
%25 = load i32, i32* %3
%26 = load i32, i32* %1
%27 = call i32 @query_cell(i32 %25, i32 %26, i32* %4)
%28 = load i32, i32* %3
%29 = load i32, i32* %1
%30 = load i32, i32* %4
%31 = call i32 @write_inner_products(i32 %28, i32 %29, i32 %30)
ret void
}