#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
void ask_menu_selection(int *kind, int *monitor) {
  char ans;
  printf("\nMENU for type of start system and homotopy :\n");
  printf("  1. start system is based on total degree;\n");
  printf("  2. a linear-product start system will be given;\n");
  printf("  3. start system and start solutions are provided;\n");
  printf("  4. the homotopy is a cascade to go one level down;\n");
  printf("  5. diagonal homotopy to start a cascade;\n");
  printf("  6. compute witness set for a hypersurface;\n");
  printf("  7. collapse extrinsic diagonal of a witness set;\n");
  printf("  8. remove the last slack variable of a witness set.\n");
  printf("Type 1, 2, 3, 4, 5, 6, 7, or 8 to select : ");
  scanf("%d", kind);
  if (*kind < 6) {
    printf("\nDo you want to monitor progress of solver on screen ? (y/n) ");
    scanf("%c", &ans);
    scanf("%c", &ans);
    if (ans = 'y')
      *monitor = 1;
    else
      *monitor = 0;
    scanf("%c", &ans);
  }
}


x86 assembly (clang, -O0):
<ask_menu_selection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
call   1030 <printf@plt>
lea    0xf0d(%rip),%rdi
call   1030 <printf@plt>
lea    0xf34(%rip),%rdi
call   1030 <printf@plt>
lea    0xf5d(%rip),%rdi
call   1030 <printf@plt>
lea    0xf87(%rip),%rdi
call   1030 <printf@plt>
lea    0xfa7(%rip),%rdi
call   1030 <printf@plt>
lea    0xfc9(%rip),%rdi
call   1030 <printf@plt>
lea    0xff1(%rip),%rdi
call   1030 <printf@plt>
lea    0x101c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0x1038(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rax
cmpl   $0x6,(%rax)
jge    1235 <ask_menu_selection+0x115>
lea    0x1020(%rip),%rdi
call   1030 <printf@plt>
lea    0x1052(%rip),%rdi
lea    -0x11(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0x1040(%rip),%rdi
lea    -0x11(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movb   $0x79,-0x11(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    120a <ask_menu_selection+0xea>
jmp    1219 <ask_menu_selection+0xf9>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    1223 <ask_menu_selection+0x103>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
lea    0x1002(%rip),%rdi
lea    -0x11(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ask_menu_selection>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xf2a(%rip),%rdi
call   1030 <puts@plt>
lea    0xf4c(%rip),%rdi
call   1030 <puts@plt>
lea    0xf6c(%rip),%rdi
call   1030 <puts@plt>
lea    0xf92(%rip),%rdi
call   1030 <puts@plt>
lea    0xfba(%rip),%rdi
call   1030 <puts@plt>
lea    0xfe3(%rip),%rdi
call   1030 <puts@plt>
lea    0x1002(%rip),%rdi
call   1030 <puts@plt>
lea    0x1023(%rip),%rdi
call   1030 <puts@plt>
lea    0x104a(%rip),%rdi
call   1030 <puts@plt>
lea    0xe4e(%rip),%rdi
call   1040 <printf@plt>
lea    0xe6e(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x5,(%rbx)
jg     1218 <ask_menu_selection+0xe8>
lea    0xe5b(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8d(%rip),%r15
lea    0xf(%rsp),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movb   $0x79,0xf(%rsp)
movl   $0x1,(%r14)
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [47 x i8] c"\0AMENU for type of start system and homotopy :\0A\00"
@.str.1 = [45 x i8] c" 1. start system is based on total degree;\0A\00"
@.str.2 = [51 x i8] c" 2. a linear-product start system will be given;\0A\00"
@.str.3 = [53 x i8] c" 3. start system and start solutions are provided;\0A\00"
@.str.4 = [54 x i8] c" 4. the homotopy is a cascade to go one level down;\0A\00"
@.str.5 = [44 x i8] c" 5. diagonal homotopy to start a cascade;\0A\00"
@.str.6 = [46 x i8] c" 6. compute witness set for a hypersurface;\0A\00"
@.str.7 = [52 x i8] c" 7. collapse extrinsic diagonal of a witness set;\0A\00"
@.str.8 = [55 x i8] c" 8. remove the last slack variable of a witness set.\0A\00"
@.str.9 = [44 x i8] c"Type 1, 2, 3, 4, 5, 6, 7, or 8 to select : \00"
@.str.10 = [3 x i8] c"%d\00"
@.str.11 = [62 x i8] c"\0ADo you want to monitor progress of solver on screen ? (y/n) \00"
@.str.12 = [3 x i8] c"%c\00"
define void @ask_menu_selection(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i8
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.7, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.8, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.9, i64 0, i64 0))
%16 = load i32*, i32** %3
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %16)
%18 = load i32*, i32** %3
%19 = load i32, i32* %18
%20 = icmp slt i32 %19, 6
br i1 %20, label %21, label %31
21: ; preds = %2
%22 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.11, i64 0, i64 0))
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* %5)
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* %5)
store i8 121, i8* %5
br i1 true, label %25, label %27
25: ; preds = %21
%26 = load i32*, i32** %4
store i32 1, i32* %26
br label %29
27: ; preds = %21
%28 = load i32*, i32** %4
store i32 0, i32* %28
br label %29
29: ; preds = %27, %25
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* %5)
br label %31
31: ; preds = %29, %2
ret void
}

LLVM IR (-O2):
@.str.9 = [44 x i8] c"Type 1, 2, 3, 4, 5, 6, 7, or 8 to select : \00"
@.str.10 = [3 x i8] c"%d\00"
@.str.11 = [62 x i8] c"\0ADo you want to monitor progress of solver on screen ? (y/n) \00"
@.str.12 = [3 x i8] c"%c\00"
@str = [46 x i8] c"\0AMENU for type of start system and homotopy :\00"
@str.13 = [44 x i8] c" 1. start system is based on total degree;\00"
@str.14 = [50 x i8] c" 2. a linear-product start system will be given;\00"
@str.15 = [52 x i8] c" 3. start system and start solutions are provided;\00"
@str.16 = [53 x i8] c" 4. the homotopy is a cascade to go one level down;\00"
@str.17 = [43 x i8] c" 5. diagonal homotopy to start a cascade;\00"
@str.18 = [45 x i8] c" 6. compute witness set for a hypersurface;\00"
@str.19 = [51 x i8] c" 7. collapse extrinsic diagonal of a witness set;\00"
@str.20 = [54 x i8] c" 8. remove the last slack variable of a witness set.\00"
define void @ask_menu_selection(i32* %0, i32* nocapture writeonly %1) {
%3 = alloca i8
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.13, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.14, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.15, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.16, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.17, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.18, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.19, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.20, i64 0, i64 0))
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.9, i64 0, i64 0))
%14 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32* %0)
%15 = load i32, i32* %0
%16 = icmp slt i32 %15, 6
br i1 %16, label %17, label %22
17: ; preds = %2
%18 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.11, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* %3)
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* %3)
store i8 121, i8* %3
store i32 1, i32* %1
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0), i8* %3)
br label %22
22: ; preds = %17, %2
ret void
}