#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*/ parse_solution_strings();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ test_incremental_read_and_write();
int /*<<< orphan*/ test_solution_container();
int /*<<< orphan*/ test_solution_strings();
void test_standard_container(void) {
  int option;
  char ch;
  printf("\nMENU to test operations in solutions container :\n");
  printf("  1. test main operations in the container;\n");
  printf("  2. incremental read/write of solutions from/to file;\n");
  printf("  3. test the writing of solutions to strings;\n");
  printf("  4. test parsing of solutions from strings into container.\n");
  printf("Type 1, 2, 3, or 4 to make your choice : ");
  scanf("%d", &option);
  scanf("%c", &ch);
  printf("\n");
  if (option == 1)
    test_solution_container();
  else if (option == 2)
    test_incremental_read_and_write();
  else if (option == 3)
    test_solution_strings();
  else if (option == 4)
    parse_solution_strings();
  else
    printf("%d is wrong choice.  Please try again...\n");
}


x86 assembly (clang, -O0):
<test_standard_container>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe91(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb8(%rip),%rdi
call   1050 <printf@plt>
lea    0xed9(%rip),%rdi
call   1050 <printf@plt>
lea    0xf05(%rip),%rdi
call   1050 <printf@plt>
lea    0xf29(%rip),%rdi
call   1050 <printf@plt>
lea    0xf5a(%rip),%rdi
call   1050 <printf@plt>
lea    0xf78(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    0xf69(%rip),%rdi
lea    -0x5(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    0xf82(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x1,-0x4(%rbp)
jne    11f6 <test_standard_container+0x96>
mov    $0x0,%al
call   1040 <test_solution_container@plt>
jmp    1253 <test_standard_container+0xf3>
cmpl   $0x2,-0x4(%rbp)
jne    120c <test_standard_container+0xac>
mov    $0x0,%al
call   1030 <test_incremental_read_and_write@plt>
jmp    124e <test_standard_container+0xee>
cmpl   $0x3,-0x4(%rbp)
jne    1222 <test_standard_container+0xc2>
mov    $0x0,%al
call   1080 <test_solution_strings@plt>
jmp    1249 <test_standard_container+0xe9>
cmpl   $0x4,-0x4(%rbp)
jne    1238 <test_standard_container+0xd8>
mov    $0x0,%al
call   1070 <parse_solution_strings@plt>
jmp    1244 <test_standard_container+0xe4>
lea    0xef6(%rip),%rdi
call   1050 <printf@plt>
jmp    1249 <test_standard_container+0xe9>
jmp    124e <test_standard_container+0xee>
jmp    1253 <test_standard_container+0xf3>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_standard_container>:
push   %rax
lea    0xee2(%rip),%rdi
call   1050 <puts@plt>
lea    0xf08(%rip),%rdi
call   1050 <puts@plt>
lea    0xf28(%rip),%rdi
call   1050 <puts@plt>
lea    0xf53(%rip),%rdi
call   1050 <puts@plt>
lea    0xf76(%rip),%rdi
call   1050 <puts@plt>
lea    0xe4c(%rip),%rdi
call   1070 <printf@plt>
lea    0xe6a(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0xe5a(%rip),%rdi
lea    0x3(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     121e <test_standard_container+0x9e>
lea    0xdf4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   1060 <test_solution_container@plt>
pop    %rax
ret
lea    0xe1b(%rip),%rdi
call   1070 <printf@plt>
pop    %rax
ret
xor    %eax,%eax
call   1030 <test_incremental_read_and_write@plt>
pop    %rax
ret
xor    %eax,%eax
call   10a0 <test_solution_strings@plt>
pop    %rax
ret
xor    %eax,%eax
call   1090 <parse_solution_strings@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [51 x i8] c"\0AMENU to test operations in solutions container :\0A\00"
@.str.1 = [45 x i8] c" 1. test main operations in the container;\0A\00"
@.str.2 = [56 x i8] c" 2. incremental read/write of solutions from/to file;\0A\00"
@.str.3 = [48 x i8] c" 3. test the writing of solutions to strings;\0A\00"
@.str.4 = [61 x i8] c" 4. test parsing of solutions from strings into container.\0A\00"
@.str.5 = [42 x i8] c"Type 1, 2, 3, or 4 to make your choice : \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [3 x i8] c"%c\00"
@.str.8 = [2 x i8] c"\0A\00"
@.str.9 = [42 x i8] c"%d is wrong choice. Please try again...\0A\00"
define void @test_standard_container() {
%1 = alloca i32
%2 = alloca i8
%3 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %2)
%11 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%12 = load i32, i32* %1
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 (...) @test_solution_container()
br label %36
16: ; preds = %0
%17 = load i32, i32* %1
%18 = icmp eq i32 %17, 2
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 (...) @test_incremental_read_and_write()
br label %35
21: ; preds = %16
%22 = load i32, i32* %1
%23 = icmp eq i32 %22, 3
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 (...) @test_solution_strings()
br label %34
26: ; preds = %21
%27 = load i32, i32* %1
%28 = icmp eq i32 %27, 4
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 (...) @parse_solution_strings()
br label %33
31: ; preds = %26
%32 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0))
br label %33
33: ; preds = %31, %29
br label %34
34: ; preds = %33, %24
br label %35
35: ; preds = %34, %19
br label %36
36: ; preds = %35, %14
ret void
}

LLVM IR (-O2):
@.str.5 = [42 x i8] c"Type 1, 2, 3, or 4 to make your choice : \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [3 x i8] c"%c\00"
@.str.9 = [42 x i8] c"%d is wrong choice. Please try again...\0A\00"
@str = [50 x i8] c"\0AMENU to test operations in solutions container :\00"
@str.10 = [44 x i8] c" 1. test main operations in the container;\00"
@str.11 = [55 x i8] c" 2. incremental read/write of solutions from/to file;\00"
@str.12 = [47 x i8] c" 3. test the writing of solutions to strings;\00"
@str.13 = [60 x i8] c" 4. test parsing of solutions from strings into container.\00"
define void @test_standard_container() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.10, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.11, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.12, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str.13, i64 0, i64 0))
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %1)
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* %2)
%12 = call i32 @putchar(i32 10)
%13 = load i32, i32* %1
switch i32 %13, label %22 [
i32 1, label %14
i32 2, label %16
i32 3, label %18
i32 4, label %20
]
14: ; preds = %0
%15 = call i32 (...) @test_solution_container()
br label %24
16: ; preds = %0
%17 = call i32 (...) @test_incremental_read_and_write()
br label %24
18: ; preds = %0
%19 = call i32 (...) @test_solution_strings()
br label %24
20: ; preds = %0
%21 = call i32 (...) @parse_solution_strings()
br label %24
22: ; preds = %0
%23 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0))
br label %24
24: ; preds = %16, %20, %22, %18, %14
ret void
}