#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 /*<<< orphan*/ adafinal();
int /*<<< orphan*/ adainit();
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read_and_construct();
int /*<<< orphan*/ read_and_retrieve();
int /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  char ans;
  printf("\nTesting the Operations in the Cells Container...\n\n");
  adainit();
  printf("Choose one of the following testing options :\n");
  printf("  1. read a mixed-cell configuration from file and retrievals;\n");
  printf("  2. create a mixed-cell configuration interactively.\n");
  printf("Type 1 or 2 to make your choice : ");
  ans = getchar();
  if (ans == '1') {
    scanf("%c", &ans);
    read_and_retrieve();
  } else if (ans == '2')
    read_and_construct();
  else
    printf("\nOption %c unknown.  Please come again.\n\n", ans);
  adafinal();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1090 <adainit@plt>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x31,%eax
jne    11ff <main+0x8f>
lea    0xf13(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1080 <scanf@plt>
mov    $0x0,%al
call   1060 <read_and_retrieve@plt>
jmp    122f <main+0xbf>
movsbl -0x5(%rbp),%eax
cmp    $0x32,%eax
jne    1218 <main+0xa8>
mov    $0x0,%al
call   1040 <read_and_construct@plt>
jmp    122a <main+0xba>
movsbl -0x5(%rbp),%esi
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122f <main+0xbf>
mov    $0x0,%al
call   1070 <adafinal@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   10a0 <adainit@plt>
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0a(%rip),%rdi
call   1030 <puts@plt>
lea    0xf3d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe41(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %al,0x7(%rsp)
cmp    $0x32,%al
je     11f3 <main+0x73>
cmp    $0x31,%al
jne    11fc <main+0x7c>
lea    0xe43(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1090 <scanf@plt>
xor    %eax,%eax
call   1070 <read_and_retrieve@plt>
jmp    120d <main+0x8d>
xor    %eax,%eax
call   1050 <read_and_construct@plt>
jmp    120d <main+0x8d>
movsbl %al,%esi
lea    0xe20(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1080 <adafinal@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [52 x i8] c"\0ATesting the Operations in the Cells Container...\0A\0A\00"
@.str.1 = [47 x i8] c"Choose one of the following testing options :\0A\00"
@.str.2 = [64 x i8] c" 1. read a mixed-cell configuration from file and retrievals;\0A\00"
@.str.3 = [55 x i8] c" 2. create a mixed-cell configuration interactively.\0A\00"
@.str.4 = [35 x i8] c"Type 1 or 2 to make your choice : \00"
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [42 x i8] c"\0AOption %c unknown. Please come again.\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @adainit()
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
%9 = call signext i8 (...) @getchar()
store i8 %9, i8* %2
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 49
br i1 %12, label %13, label %16
13: ; preds = %0
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %2)
%15 = call i32 (...) @read_and_retrieve()
br label %27
16: ; preds = %0
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 50
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 (...) @read_and_construct()
br label %26
22: ; preds = %16
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %22, %20
br label %27
27: ; preds = %26, %13
%28 = call i32 (...) @adafinal()
ret i32 0
}

LLVM IR (-O2):
@.str.4 = [35 x i8] c"Type 1 or 2 to make your choice : \00"
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [42 x i8] c"\0AOption %c unknown. Please come again.\0A\0A\00"
@str = [51 x i8] c"\0ATesting the Operations in the Cells Container...\0A\00"
@str.7 = [46 x i8] c"Choose one of the following testing options :\00"
@str.8 = [63 x i8] c" 1. read a mixed-cell configuration from file and retrievals;\00"
@str.9 = [54 x i8] c" 2. create a mixed-cell configuration interactively.\00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (...) @adainit()
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str.8, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.9, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
%8 = tail call signext i8 (...) @getchar()
store i8 %8, i8* %1
switch i8 %8, label %14 [
i8 49, label %9
i8 50, label %12
]
9: ; preds = %0
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %1)
%11 = call i32 (...) @read_and_retrieve()
br label %17
12: ; preds = %0
%13 = tail call i32 (...) @read_and_construct()
br label %17
14: ; preds = %0
%15 = sext i8 %8 to i32
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %12, %14, %9
%18 = call i32 (...) @adafinal()
ret i32 0
}