#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_read_mixed_cell_configuration();
int celcon_write_mixed_cell_configuration();
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 = celcon_read_mixed_cell_configuration();
  printf("Do 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);
}


x86 assembly (clang, -O0):
<read_and_retrieve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x0,%al
call   1090 <celcon_read_mixed_cell_configuration@plt>
mov    %eax,-0x8(%rbp)
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    %al,-0x29(%rbp)
movsbl -0x29(%rbp),%eax
cmp    $0x79,%eax
jne    11d1 <read_and_retrieve+0x41>
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    0xe3f(%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    0xe3f(%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
call   1050 <query_cell@plt>
mov    %eax,-0x8(%rbp)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_and_retrieve>:
sub    $0x18,%rsp
xor    %eax,%eax
call   1090 <celcon_read_mixed_cell_configuration@plt>
lea    0xe5e(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
cmp    $0x79,%al
jne    11bb <read_and_retrieve+0x2b>
xor    %eax,%eax
call   10a0 <celcon_write_mixed_cell_configuration@plt>
lea    0x10(%rsp),%rdi
call   1040 <celcon_number_of_cells@plt>
mov    0x10(%rsp),%esi
lea    0xe56(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xc(%rsp),%rdi
call   10b0 <celcon_dimension_of_points@plt>
mov    0xc(%rsp),%esi
lea    0xe57(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%edi
lea    0x14(%rsp),%rsi
call   1030 <show_mixture@plt>
mov    0xc(%rsp),%edi
call   1080 <write_lifted_supports@plt>
mov    0xc(%rsp),%edi
mov    0x14(%rsp),%esi
call   1050 <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 = call i32 (...) @celcon_read_mixed_cell_configuration()
store i32 %9, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%11 = call signext i8 (...) @getchar()
store i8 %11, i8* %8
%12 = load i8, i8* %8
%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)
store i32 %30, 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 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (...) @celcon_read_mixed_cell_configuration()
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%9 = tail call signext i8 (...) @getchar()
%10 = icmp eq i8 %9, 121
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = tail call i32 (...) @celcon_write_mixed_cell_configuration()
br label %13
13: ; preds = %11, %0
%14 = call i32 @celcon_number_of_cells(i32* %2)
%15 = load i32, i32* %2
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = call i32 @celcon_dimension_of_points(i32* %3)
%18 = load i32, i32* %3
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %3
%21 = call i32 @show_mixture(i32 %20, i32* %1)
%22 = load i32, i32* %3
%23 = call i32 @write_lifted_supports(i32 %22)
%24 = load i32, i32* %3
%25 = load i32, i32* %1
%26 = call i32 @query_cell(i32 %24, i32 %25)
ret void
}