#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 *, ...);
int syscon_number_of_symbols(int *);
int syscon_write_symbols();
int prompt_for_parameter(void) {
  int fail, nbr, idx;
  char nlsb;
  fail = syscon_number_of_symbols(&nbr);
  printf("\nThe names of the variables :");
  fail = syscon_write_symbols();
  printf("\nGive the index of the continuation parameter : ");
  scanf("%d", &idx);
  scanf("%c", &nlsb);
  if (idx < 1)
    printf("Index is too small!\n");
  if (idx > nbr)
    printf("Index is too large!\n");
  return idx;
}


x86 assembly (clang, -O0):
<prompt_for_parameter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
call   1050 <syscon_number_of_symbols@plt>
mov    %eax,-0x4(%rbp)
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <syscon_write_symbols@plt>
mov    %eax,-0x4(%rbp)
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    0xec3(%rip),%rdi
lea    -0xd(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
cmpl   $0x1,-0xc(%rbp)
jge    11b0 <prompt_for_parameter+0x70>
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11c8 <prompt_for_parameter+0x88>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prompt_for_parameter>:
sub    $0x18,%rsp
lea    0x14(%rsp),%rdi
call   1060 <syscon_number_of_symbols@plt>
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <syscon_write_symbols@plt>
lea    0xea6(%rip),%rdi
call   1040 <printf@plt>
lea    0xecb(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
lea    0xebb(%rip),%rdi
lea    0x13(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11b6 <prompt_for_parameter+0x66>
cmp    0x14(%rsp),%eax
jg     11cc <prompt_for_parameter+0x7c>
add    $0x18,%rsp
ret
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%eax
cmp    0x14(%rsp),%eax
jle    11b1 <prompt_for_parameter+0x61>
lea    0xe82(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"\0AThe names of the variables :\00"
@.str.1 = [49 x i8] c"\0AGive the index of the continuation parameter : \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [21 x i8] c"Index is too small!\0A\00"
@.str.5 = [21 x i8] c"Index is too large!\0A\00"
define i32 @prompt_for_parameter() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = call i32 @syscon_number_of_symbols(i32* %2)
store i32 %5, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @syscon_write_symbols()
store i32 %7, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 1
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %15
15: ; preds = %13, %0
%16 = load i32, i32* %3
%17 = load i32, i32* %2
%18 = icmp sgt i32 %16, %17
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
br label %21
21: ; preds = %19, %15
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@.str = [30 x i8] c"\0AThe names of the variables :\00"
@.str.1 = [49 x i8] c"\0AGive the index of the continuation parameter : \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c"%c\00"
@str = [20 x i8] c"Index is too large!\00"
@str.6 = [20 x i8] c"Index is too small!\00"
define i32 @prompt_for_parameter() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = call i32 @syscon_number_of_symbols(i32* %1)
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (...) @syscon_write_symbols()
%9 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 1
br i1 %13, label %14, label %17
14: ; preds = %0
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.6, i64 0, i64 0))
%16 = load i32, i32* %2
br label %17
17: ; preds = %14, %0
%18 = phi i32 [ %16, %14 ], [ %12, %0 ]
%19 = load i32, i32* %1
%20 = icmp sgt i32 %18, %19
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%23 = load i32, i32* %2
br label %24
24: ; preds = %21, %17
%25 = phi i32 [ %23, %21 ], [ %18, %17 ]
ret i32 %25
}