#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*/ BNCIO(int);
int /*<<< orphan*/ BNC_0();
int /*<<< orphan*/ BNC_1();
int /*<<< orphan*/ BNC_2();
int /*<<< orphan*/ BNC_3();
int /*<<< orphan*/ BNC_4();
int /*<<< orphan*/ BNC_5();
int /*<<< orphan*/ BNC_6();
int /*<<< orphan*/ BNC_7();
int /*<<< orphan*/ BNC_8();
int /*<<< orphan*/ BNC_9();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int BNCMode() {
  int ii, stat = 99;
  char com1, data;
  printf("Function (0-9) ? \n");
  printf("0 - Power measure \n");
  printf("1 - Am \n");
  printf("2 - FM \n");
  printf("3 - Phase modulated \n");
  printf("4 - Sweep \n");
  printf("5 - FSK \n");
  printf("6 - Burst \n");
  printf("7 - SSb \n");
  printf("8 - DTMF generator \n");
  printf("9 - DTMF detection \n");
  scanf("%i", &ii);
  BNCIO(20);
  switch (ii) {
  case 0:
    BNC_0();
    break;
  case 1:
    BNC_1();
    break;
  case 2:
    BNC_2();
    break;
  case 3:
    BNC_3();
    break;
  case 4:
    BNC_4();
    break;
  case 5:
    BNC_5();
    break;
  case 6:
    BNC_6();
    break;
  case 7:
    BNC_7();
    break;
  case 8:
    BNC_8();
    break;
  case 9:
    BNC_9();
    break;
  default:
    BNC_0();
    break;
  }
  return (stat);
}


x86 assembly (clang, -O0):
<BNCMode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x63,-0x8(%rbp)
lea    0xe42(%rip),%rdi
call   1030 <printf@plt>
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
lea    0xe4b(%rip),%rdi
call   1030 <printf@plt>
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
lea    0xe63(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1090 <scanf@plt>
mov    $0x14,%edi
call   10a0 <BNCIO@plt>
mov    -0x4(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x9,%rax
ja     131a <BNCMode+0x14a>
mov    -0x18(%rbp),%rax
lea    0xd67(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1040 <BNC_0@plt>
jmp    1321 <BNCMode+0x151>
mov    $0x0,%al
call   10b0 <BNC_1@plt>
jmp    1321 <BNCMode+0x151>
mov    $0x0,%al
call   1050 <BNC_2@plt>
jmp    1321 <BNCMode+0x151>
mov    $0x0,%al
call   10c0 <BNC_3@plt>
jmp    1321 <BNCMode+0x151>
mov    $0x0,%al
call   1060 <BNC_4@plt>
jmp    1321 <BNCMode+0x151>
mov    $0x0,%al
call   10e0 <BNC_5@plt>
jmp    1321 <BNCMode+0x151>
mov    $0x0,%al
call   1080 <BNC_6@plt>
jmp    1321 <BNCMode+0x151>
mov    $0x0,%al
call   10f0 <BNC_7@plt>
jmp    1321 <BNCMode+0x151>
mov    $0x0,%al
call   1070 <BNC_8@plt>
jmp    1321 <BNCMode+0x151>
mov    $0x0,%al
call   10d0 <BNC_9@plt>
jmp    1321 <BNCMode+0x151>
mov    $0x0,%al
call   1040 <BNC_0@plt>
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BNCMode>:
push   %rax
lea    0xe53(%rip),%rdi
call   1030 <puts@plt>
lea    0xe59(%rip),%rdi
call   1030 <puts@plt>
lea    0xe60(%rip),%rdi
call   1030 <puts@plt>
lea    0xe5c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe58(%rip),%rdi
call   1030 <puts@plt>
lea    0xe61(%rip),%rdi
call   1030 <puts@plt>
lea    0xe60(%rip),%rdi
call   1030 <puts@plt>
lea    0xe5d(%rip),%rdi
call   1030 <puts@plt>
lea    0xe5c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe59(%rip),%rdi
call   1030 <puts@plt>
lea    0xe61(%rip),%rdi
call   1030 <puts@plt>
lea    0xdcc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1090 <scanf@plt>
mov    $0x14,%edi
call   10a0 <BNCIO@plt>
mov    0x4(%rsp),%eax
cmp    $0x9,%rax
ja     128a <BNCMode+0xba>
lea    0xd7f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   1040 <BNC_0@plt>
jmp    12e2 <BNCMode+0x112>
xor    %eax,%eax
call   10b0 <BNC_1@plt>
jmp    12e2 <BNCMode+0x112>
xor    %eax,%eax
call   1050 <BNC_2@plt>
jmp    12e2 <BNCMode+0x112>
xor    %eax,%eax
call   10c0 <BNC_3@plt>
jmp    12e2 <BNCMode+0x112>
xor    %eax,%eax
call   1060 <BNC_4@plt>
jmp    12e2 <BNCMode+0x112>
xor    %eax,%eax
call   10e0 <BNC_5@plt>
jmp    12e2 <BNCMode+0x112>
xor    %eax,%eax
call   1080 <BNC_6@plt>
jmp    12e2 <BNCMode+0x112>
xor    %eax,%eax
call   10f0 <BNC_7@plt>
jmp    12e2 <BNCMode+0x112>
xor    %eax,%eax
call   10d0 <BNC_9@plt>
jmp    12e2 <BNCMode+0x112>
xor    %eax,%eax
call   1070 <BNC_8@plt>
mov    $0x63,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Function (0-9) ? \0A\00"
@.str.1 = [20 x i8] c"0 - Power measure \0A\00"
@.str.2 = [9 x i8] c"1 - Am \0A\00"
@.str.3 = [9 x i8] c"2 - FM \0A\00"
@.str.4 = [22 x i8] c"3 - Phase modulated \0A\00"
@.str.5 = [12 x i8] c"4 - Sweep \0A\00"
@.str.6 = [10 x i8] c"5 - FSK \0A\00"
@.str.7 = [12 x i8] c"6 - Burst \0A\00"
@.str.8 = [10 x i8] c"7 - SSb \0A\00"
@.str.9 = [21 x i8] c"8 - DTMF generator \0A\00"
@.str.10 = [21 x i8] c"9 - DTMF detection \0A\00"
@.str.11 = [3 x i8] c"%i\00"
define i32 @BNCMode() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = alloca i8
store i32 99, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%14 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i32* %1)
%17 = call i32 @BNCIO(i32 20)
%18 = load i32, i32* %1
switch i32 %18, label %39 [
i32 0, label %19
i32 1, label %21
i32 2, label %23
i32 3, label %25
i32 4, label %27
i32 5, label %29
i32 6, label %31
i32 7, label %33
i32 8, label %35
i32 9, label %37
]
19: ; preds = %0
%20 = call i32 (...) @BNC_0()
br label %41
21: ; preds = %0
%22 = call i32 (...) @BNC_1()
br label %41
23: ; preds = %0
%24 = call i32 (...) @BNC_2()
br label %41
25: ; preds = %0
%26 = call i32 (...) @BNC_3()
br label %41
27: ; preds = %0
%28 = call i32 (...) @BNC_4()
br label %41
29: ; preds = %0
%30 = call i32 (...) @BNC_5()
br label %41
31: ; preds = %0
%32 = call i32 (...) @BNC_6()
br label %41
33: ; preds = %0
%34 = call i32 (...) @BNC_7()
br label %41
35: ; preds = %0
%36 = call i32 (...) @BNC_8()
br label %41
37: ; preds = %0
%38 = call i32 (...) @BNC_9()
br label %41
39: ; preds = %0
%40 = call i32 (...) @BNC_0()
br label %41
41: ; preds = %39, %37, %35, %33, %31, %29, %27, %25, %23, %21, %19
%42 = load i32, i32* %2
ret i32 %42
}

LLVM IR (-O2):
@.str.11 = [3 x i8] c"%i\00"
@str = [18 x i8] c"Function (0-9) ? \00"
@str.12 = [19 x i8] c"0 - Power measure \00"
@str.13 = [8 x i8] c"1 - Am \00"
@str.14 = [8 x i8] c"2 - FM \00"
@str.15 = [21 x i8] c"3 - Phase modulated \00"
@str.16 = [11 x i8] c"4 - Sweep \00"
@str.17 = [9 x i8] c"5 - FSK \00"
@str.18 = [11 x i8] c"6 - Burst \00"
@str.19 = [9 x i8] c"7 - SSb \00"
@str.20 = [20 x i8] c"8 - DTMF generator \00"
@str.21 = [20 x i8] c"9 - DTMF detection \00"
define i32 @BNCMode() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.12, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.13, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.14, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.15, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.16, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.17, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.18, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.19, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.20, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.21, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i32* %1)
%15 = call i32 @BNCIO(i32 20)
%16 = load i32, i32* %1
switch i32 %16, label %37 [
i32 0, label %17
i32 1, label %19
i32 2, label %21
i32 3, label %23
i32 4, label %25
i32 5, label %27
i32 6, label %29
i32 7, label %31
i32 8, label %33
i32 9, label %35
]
17: ; preds = %0
%18 = call i32 (...) @BNC_0()
br label %39
19: ; preds = %0
%20 = call i32 (...) @BNC_1()
br label %39
21: ; preds = %0
%22 = call i32 (...) @BNC_2()
br label %39
23: ; preds = %0
%24 = call i32 (...) @BNC_3()
br label %39
25: ; preds = %0
%26 = call i32 (...) @BNC_4()
br label %39
27: ; preds = %0
%28 = call i32 (...) @BNC_5()
br label %39
29: ; preds = %0
%30 = call i32 (...) @BNC_6()
br label %39
31: ; preds = %0
%32 = call i32 (...) @BNC_7()
br label %39
33: ; preds = %0
%34 = call i32 (...) @BNC_8()
br label %39
35: ; preds = %0
%36 = call i32 (...) @BNC_9()
br label %39
37: ; preds = %0
%38 = call i32 (...) @BNC_0()
br label %39
39: ; preds = %37, %35, %33, %31, %29, %27, %25, %23, %21, %19, %17
ret i32 99
}