#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*/ puts(char *);
int scanf(char *, int *);
int list() {
  puts("1. Set key.");
  puts("2. Encrypt text.");
  puts("3. Decrypt text.");
  int result, select;
  do {
    result = scanf("%i", &select);
  } while (result < 1 && (select < 1 || select > 3));
  return select;
}


x86 assembly (clang, -O0):
<list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
lea    0xedb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    %eax,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x1,-0x4(%rbp)
mov    %al,-0x9(%rbp)
jge    118d <list+0x6d>
mov    $0x1,%al
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0xa(%rbp)
jl     1187 <list+0x67>
cmpl   $0x3,-0x8(%rbp)
setg   %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    114c <list+0x2c>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
lea    0xedf(%rip),%r14
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %eax,%ecx
mov    0x4(%rsp),%eax
test   %ecx,%ecx
jg     117d <list+0x5d>
lea    -0x4(%rax),%ecx
cmp    $0xfffffffd,%ecx
jb     1160 <list+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"1. Set key.\00"
@.str.1 = [17 x i8] c"2. Encrypt text.\00"
@.str.2 = [17 x i8] c"3. Decrypt text.\00"
@.str.3 = [3 x i8] c"%i\00"
define i32 @list() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @puts(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %6
6: ; preds = %19, %0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
store i32 %7, i32* %1
br label %8
8: ; preds = %6
%9 = load i32, i32* %1
%10 = icmp slt i32 %9, 1
br i1 %10, label %11, label %19
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 1
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load i32, i32* %2
%16 = icmp sgt i32 %15, 3
br label %17
17: ; preds = %14, %11
%18 = phi i1 [ true, %11 ], [ %16, %14 ]
br label %19
19: ; preds = %17, %8
%20 = phi i1 [ false, %8 ], [ %18, %17 ]
br i1 %20, label %6, label %21
21: ; preds = %19
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
@.str = [12 x i8] c"1. Set key.\00"
@.str.1 = [17 x i8] c"2. Encrypt text.\00"
@.str.2 = [17 x i8] c"3. Decrypt text.\00"
@.str.3 = [3 x i8] c"%i\00"
define i32 @list() {
%1 = alloca i32
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%5 = bitcast i32* %1 to i8*
br label %6
6: ; preds = %6, %0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%8 = icmp slt i32 %7, 1
%9 = load i32, i32* %1
%10 = add i32 %9, -4
%11 = icmp ult i32 %10, -3
%12 = select i1 %8, i1 %11, i1 false
br i1 %12, label %6, label %13
13: ; preds = %6
ret i32 %9
}