#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*/ amd64_option();
int /*<<< orphan*/ change_timing(int, int, int, int);
int /*<<< orphan*/ cprint(int, int, char *);
int get_cas();
int get_key();
int getval(int, int, int /*<<< orphan*/);
int /*<<< orphan*/ popclear();
void get_option() {
  int cas = 0, rp = 0, rcd = 0, ras = 0, sflag = 0;
  while (!sflag) {
    switch (get_key()) {
    case 2:
      popclear();
      cas = get_cas();
      popclear();
      cprint(8 + 3, 11 + 8, "tRCD: ");
      rcd = getval(8 + 3, 11 + 15, 0);
      popclear();
      cprint(8 + 3, 11 + 8, "tRP: ");
      rp = getval(8 + 3, 11 + 15, 0);
      popclear();
      cprint(8 + 3, 11 + 8, "tRAS: ");
      ras = getval(8 + 3, 11 + 15, 0);
      popclear();
      change_timing(cas, rcd, rp, ras);
      break;
    case 3:
      popclear();
      cas = get_cas();
      change_timing(cas, 0, 0, 0);
      sflag++;
      break;
    case 4:
      popclear();
      cprint(8 + 3, 11 + 8, "tRCD: ");
      rcd = getval(8 + 3, 11 + 15, 0);
      change_timing(0, rcd, 0, 0);
      sflag++;
      break;
    case 5:
      popclear();
      cprint(8 + 3, 11 + 8, "tRP: ");
      rp = getval(8 + 3, 11 + 15, 0);
      change_timing(0, 0, rp, 0);
      sflag++;
      break;
    case 6:
      popclear();
      cprint(8 + 3, 11 + 8, "tRAS: ");
      ras = getval(8 + 3, 11 + 15, 0);
      change_timing(0, 0, 0, ras);
      sflag++;
      break;
    case 7:
      popclear();
      amd64_option();
      sflag++;
      popclear();
      break;
    case 8:
      break;
    case 11:
    case 57:
      sflag++;
      break;
    }
  }
}


x86 assembly (clang, -O0):
<get_option>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11b1 <get_option+0x41>
jmp    13e9 <get_option+0x279>
xor    %eax,%eax
call   1060 <get_key@plt>
add    $0xfffffffe,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x37,%eax
ja     13e4 <get_option+0x274>
mov    -0x20(%rbp),%rax
lea    0xe2b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1050 <popclear@plt>
mov    $0x0,%al
call   1080 <get_cas@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1050 <popclear@plt>
mov    $0xb,%edi
mov    $0x13,%esi
lea    0xed9(%rip),%rdx
call   1040 <cprint@plt>
mov    $0xb,%edi
mov    $0x1a,%esi
xor    %edx,%edx
call   1030 <getval@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1050 <popclear@plt>
mov    $0xb,%edi
mov    $0x13,%esi
lea    0xeaf(%rip),%rdx
call   1040 <cprint@plt>
mov    $0xb,%edi
mov    $0x1a,%esi
xor    %edx,%edx
call   1030 <getval@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <popclear@plt>
mov    $0xb,%edi
mov    $0x13,%esi
lea    0xe84(%rip),%rdx
call   1040 <cprint@plt>
mov    $0xb,%edi
mov    $0x1a,%esi
xor    %edx,%edx
call   1030 <getval@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <popclear@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1090 <change_timing@plt>
jmp    13e4 <get_option+0x274>
mov    $0x0,%al
call   1050 <popclear@plt>
mov    $0x0,%al
call   1080 <get_cas@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %ecx,%ecx
mov    %ecx,%esi
mov    %ecx,%edx
call   1090 <change_timing@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    13e4 <get_option+0x274>
mov    $0x0,%al
call   1050 <popclear@plt>
mov    $0xb,%edi
mov    $0x13,%esi
lea    0xdfc(%rip),%rdx
call   1040 <cprint@plt>
mov    $0xb,%edi
mov    $0x1a,%esi
xor    %edx,%edx
call   1030 <getval@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
xor    %ecx,%ecx
mov    %ecx,%edi
mov    %ecx,%edx
call   1090 <change_timing@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    13e4 <get_option+0x274>
mov    $0x0,%al
call   1050 <popclear@plt>
mov    $0xb,%edi
mov    $0x13,%esi
lea    0xdb6(%rip),%rdx
call   1040 <cprint@plt>
mov    $0xb,%edi
mov    $0x1a,%esi
xor    %edx,%edx
call   1030 <getval@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
xor    %ecx,%ecx
mov    %ecx,%edi
mov    %ecx,%esi
call   1090 <change_timing@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    13e4 <get_option+0x274>
mov    $0x0,%al
call   1050 <popclear@plt>
mov    $0xb,%edi
mov    $0x13,%esi
lea    0xd6f(%rip),%rdx
call   1040 <cprint@plt>
mov    $0xb,%edi
mov    $0x1a,%esi
xor    %edx,%edx
call   1030 <getval@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
xor    %edx,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1090 <change_timing@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    13e4 <get_option+0x274>
mov    $0x0,%al
call   1050 <popclear@plt>
mov    $0x0,%al
call   1070 <amd64_option@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1050 <popclear@plt>
jmp    13e4 <get_option+0x274>
jmp    13e4 <get_option+0x274>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    119b <get_option+0x2b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_option>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe7e(%rip),%r15
lea    0xf64(%rip),%r12
jmp    1244 <get_option+0xd4>
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <popclear@plt>
xor    %eax,%eax
call   1080 <get_cas@plt>
mov    %eax,%r13d
xor    %eax,%eax
call   1050 <popclear@plt>
mov    $0xb,%edi
mov    $0x13,%esi
lea    0xf27(%rip),%rdx
call   1040 <cprint@plt>
mov    $0xb,%edi
mov    $0x1a,%esi
xor    %edx,%edx
call   1030 <getval@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <popclear@plt>
mov    $0xb,%edi
mov    $0x13,%esi
lea    0xefe(%rip),%rdx
call   1040 <cprint@plt>
mov    $0xb,%edi
mov    $0x1a,%esi
xor    %edx,%edx
call   1030 <getval@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1050 <popclear@plt>
mov    $0xb,%edi
mov    $0x13,%esi
mov    %r12,%rdx
call   1040 <cprint@plt>
mov    $0xb,%edi
mov    $0x1a,%esi
xor    %edx,%edx
call   1030 <getval@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1050 <popclear@plt>
mov    %r13d,%edi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
call   1090 <change_timing@plt>
xor    %eax,%eax
call   1060 <get_key@plt>
add    $0xfffffffe,%eax
cmp    $0x37,%eax
ja     1244 <get_option+0xd4>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1050 <popclear@plt>
xor    %eax,%eax
call   1080 <get_cas@plt>
mov    %eax,%edi
xor    %esi,%esi
jmp    12b1 <get_option+0x141>
xor    %eax,%eax
call   1050 <popclear@plt>
lea    0xe53(%rip),%rdx
mov    $0xb,%edi
mov    $0x13,%esi
call   1040 <cprint@plt>
mov    $0xb,%edi
mov    $0x1a,%esi
xor    %edx,%edx
call   1030 <getval@plt>
xor    %edi,%edi
mov    %eax,%esi
xor    %edx,%edx
jmp    12e9 <get_option+0x179>
xor    %eax,%eax
call   1050 <popclear@plt>
lea    0xe24(%rip),%rdx
mov    $0xb,%edi
mov    $0x13,%esi
call   1040 <cprint@plt>
mov    $0xb,%edi
mov    $0x1a,%esi
xor    %edx,%edx
call   1030 <getval@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    %eax,%edx
xor    %ecx,%ecx
jmp    1323 <get_option+0x1b3>
xor    %eax,%eax
call   1050 <popclear@plt>
lea    0xdf2(%rip),%rdx
mov    $0xb,%edi
mov    $0x13,%esi
call   1040 <cprint@plt>
mov    $0xb,%edi
mov    $0x1a,%esi
xor    %edx,%edx
call   1030 <getval@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    %eax,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1090 <change_timing@plt>
xor    %eax,%eax
call   1050 <popclear@plt>
xor    %eax,%eax
call   1070 <amd64_option@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <popclear@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"tRCD: \00"
@.str.1 = [6 x i8] c"tRP: \00"
@.str.2 = [7 x i8] c"tRAS: \00"
define void @get_option() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %71, %0
%7 = load i32, i32* %5
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
br i1 %9, label %10, label %72
10: ; preds = %6
%11 = call i32 (...) @get_key()
switch i32 %11, label %71 [
i32 2, label %12
i32 3, label %30
i32 4, label %37
i32 5, label %45
i32 6, label %53
i32 7, label %61
i32 8, label %67
i32 11, label %68
i32 57, label %68
]
12: ; preds = %10
%13 = call i32 (...) @popclear()
%14 = call i32 (...) @get_cas()
store i32 %14, i32* %1
%15 = call i32 (...) @popclear()
%16 = call i32 @cprint(i32 11, i32 19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @getval(i32 11, i32 26, i32 0)
store i32 %17, i32* %3
%18 = call i32 (...) @popclear()
%19 = call i32 @cprint(i32 11, i32 19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @getval(i32 11, i32 26, i32 0)
store i32 %20, i32* %2
%21 = call i32 (...) @popclear()
%22 = call i32 @cprint(i32 11, i32 19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%23 = call i32 @getval(i32 11, i32 26, i32 0)
store i32 %23, i32* %4
%24 = call i32 (...) @popclear()
%25 = load i32, i32* %1
%26 = load i32, i32* %3
%27 = load i32, i32* %2
%28 = load i32, i32* %4
%29 = call i32 @change_timing(i32 %25, i32 %26, i32 %27, i32 %28)
br label %71
30: ; preds = %10
%31 = call i32 (...) @popclear()
%32 = call i32 (...) @get_cas()
store i32 %32, i32* %1
%33 = load i32, i32* %1
%34 = call i32 @change_timing(i32 %33, i32 0, i32 0, i32 0)
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %71
37: ; preds = %10
%38 = call i32 (...) @popclear()
%39 = call i32 @cprint(i32 11, i32 19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%40 = call i32 @getval(i32 11, i32 26, i32 0)
store i32 %40, i32* %3
%41 = load i32, i32* %3
%42 = call i32 @change_timing(i32 0, i32 %41, i32 0, i32 0)
%43 = load i32, i32* %5
%44 = add nsw i32 %43, 1
store i32 %44, i32* %5
br label %71
45: ; preds = %10
%46 = call i32 (...) @popclear()
%47 = call i32 @cprint(i32 11, i32 19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%48 = call i32 @getval(i32 11, i32 26, i32 0)
store i32 %48, i32* %2
%49 = load i32, i32* %2
%50 = call i32 @change_timing(i32 0, i32 0, i32 %49, i32 0)
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 1
store i32 %52, i32* %5
br label %71
53: ; preds = %10
%54 = call i32 (...) @popclear()
%55 = call i32 @cprint(i32 11, i32 19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%56 = call i32 @getval(i32 11, i32 26, i32 0)
store i32 %56, i32* %4
%57 = load i32, i32* %4
%58 = call i32 @change_timing(i32 0, i32 0, i32 0, i32 %57)
%59 = load i32, i32* %5
%60 = add nsw i32 %59, 1
store i32 %60, i32* %5
br label %71
61: ; preds = %10
%62 = call i32 (...) @popclear()
%63 = call i32 (...) @amd64_option()
%64 = load i32, i32* %5
%65 = add nsw i32 %64, 1
store i32 %65, i32* %5
%66 = call i32 (...) @popclear()
br label %71
67: ; preds = %10
br label %71
68: ; preds = %10, %10
%69 = load i32, i32* %5
%70 = add nsw i32 %69, 1
store i32 %70, i32* %5
br label %71
71: ; preds = %10, %68, %67, %61, %53, %45, %37, %30, %12
br label %6
72: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"tRCD: \00"
@.str.1 = [6 x i8] c"tRP: \00"
@.str.2 = [7 x i8] c"tRAS: \00"
define void @get_option() {
br label %1
1: ; preds = %3, %0
%2 = tail call i32 (...) @get_key()
switch i32 %2, label %3 [
i32 2, label %4
i32 3, label %18
i32 4, label %22
i32 5, label %27
i32 6, label %32
i32 7, label %37
i32 57, label %41
i32 11, label %41
]
3: ; preds = %1, %4
br label %1
4: ; preds = %1
%5 = tail call i32 (...) @popclear()
%6 = tail call i32 (...) @get_cas()
%7 = tail call i32 (...) @popclear()
%8 = tail call i32 @cprint(i32 11, i32 19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @getval(i32 11, i32 26, i32 0)
%10 = tail call i32 (...) @popclear()
%11 = tail call i32 @cprint(i32 11, i32 19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 @getval(i32 11, i32 26, i32 0)
%13 = tail call i32 (...) @popclear()
%14 = tail call i32 @cprint(i32 11, i32 19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%15 = tail call i32 @getval(i32 11, i32 26, i32 0)
%16 = tail call i32 (...) @popclear()
%17 = tail call i32 @change_timing(i32 %6, i32 %9, i32 %12, i32 %15)
br label %3
18: ; preds = %1
%19 = tail call i32 (...) @popclear()
%20 = tail call i32 (...) @get_cas()
%21 = tail call i32 @change_timing(i32 %20, i32 0, i32 0, i32 0)
br label %41
22: ; preds = %1
%23 = tail call i32 (...) @popclear()
%24 = tail call i32 @cprint(i32 11, i32 19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%25 = tail call i32 @getval(i32 11, i32 26, i32 0)
%26 = tail call i32 @change_timing(i32 0, i32 %25, i32 0, i32 0)
br label %41
27: ; preds = %1
%28 = tail call i32 (...) @popclear()
%29 = tail call i32 @cprint(i32 11, i32 19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%30 = tail call i32 @getval(i32 11, i32 26, i32 0)
%31 = tail call i32 @change_timing(i32 0, i32 0, i32 %30, i32 0)
br label %41
32: ; preds = %1
%33 = tail call i32 (...) @popclear()
%34 = tail call i32 @cprint(i32 11, i32 19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%35 = tail call i32 @getval(i32 11, i32 26, i32 0)
%36 = tail call i32 @change_timing(i32 0, i32 0, i32 0, i32 %35)
br label %41
37: ; preds = %1
%38 = tail call i32 (...) @popclear()
%39 = tail call i32 (...) @amd64_option()
%40 = tail call i32 (...) @popclear()
br label %41
41: ; preds = %1, %1, %37, %32, %27, %22, %18
ret void
}