#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*/ Delete();
int /*<<< orphan*/ Enqueue();
int /*<<< orphan*/ Print();
int /*<<< orphan*/ changePrice();
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
float maxPrice();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int main() {
  float maxP;
  int i, selector;
  printf("1.Add a TV\n");
  printf("2.Find the most expensive TV manifactured after 2007\n");
  printf("3.Delete TV`s by brand\n");
  printf("4.Change the price of a TV\n");
  printf("5.Print all the TV`s\n");
  printf("6.Exit\n");
  while (1) {
    printf("choose option:");
    scanf("%d", &selector);
    fflush(stdin);
    switch (selector) {
    case 1:
      Enqueue();
      break;
    case 2:
      maxP = maxPrice();
      break;
    case 3:
      Delete();
      break;
    case 4:
      changePrice();
      break;
    case 5:
      Print();
      break;
    case 6:
      return 0;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe82(%rip),%rdi
call   1050 <printf@plt>
lea    0xe82(%rip),%rdi
call   1050 <printf@plt>
lea    0xeac(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb8(%rip),%rdi
call   1050 <printf@plt>
lea    0xec8(%rip),%rdi
call   1050 <printf@plt>
lea    0xed2(%rip),%rdi
call   1050 <printf@plt>
lea    0xece(%rip),%rdi
call   1050 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1090 <scanf@plt>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5,%eax
ja     1273 <main+0xf3>
mov    -0x18(%rbp),%rax
lea    0xddf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1030 <Enqueue@plt>
jmp    1273 <main+0xf3>
mov    $0x0,%al
call   1070 <maxPrice@plt>
movss  %xmm0,-0x8(%rbp)
jmp    1273 <main+0xf3>
mov    $0x0,%al
call   1040 <Delete@plt>
jmp    1273 <main+0xf3>
mov    $0x0,%al
call   1060 <changePrice@plt>
jmp    1273 <main+0xf3>
mov    $0x0,%al
call   10a0 <Print@plt>
jmp    1273 <main+0xf3>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret
jmp    11d7 <main+0x57>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe86(%rip),%rdi
call   1040 <puts@plt>
lea    0xe85(%rip),%rdi
call   1040 <puts@plt>
lea    0xeae(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb9(%rip),%rdi
call   1040 <puts@plt>
lea    0xec8(%rip),%rdi
call   1040 <puts@plt>
lea    0xed1(%rip),%rdi
call   1040 <puts@plt>
lea    0xe2c(%rip),%r14
lea    0xe34(%rip),%r15
lea    0xc(%rsp),%r12
mov    0x2de9(%rip),%r13
lea    0xdfa(%rip),%rbx
jmp    1210 <main+0x80>
xor    %eax,%eax
call   10b0 <Print@plt>
nop
mov    %r14,%rdi
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   10a0 <scanf@plt>
mov    0x0(%r13),%edi
call   1090 <fflush@plt>
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x5,%eax
ja     1210 <main+0x80>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   1030 <Enqueue@plt>
jmp    1210 <main+0x80>
xor    %eax,%eax
call   1080 <maxPrice@plt>
jmp    1210 <main+0x80>
xor    %eax,%eax
call   1050 <Delete@plt>
jmp    1210 <main+0x80>
xor    %eax,%eax
call   1070 <changePrice@plt>
jmp    1210 <main+0x80>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"1.Add a TV\0A\00"
@.str.1 = [54 x i8] c"2.Find the most expensive TV manifactured after 2007\0A\00"
@.str.2 = [24 x i8] c"3.Delete TV`s by brand\0A\00"
@.str.3 = [28 x i8] c"4.Change the price of a TV\0A\00"
@.str.4 = [22 x i8] c"5.Print all the TV`s\0A\00"
@.str.5 = [8 x i8] c"6.Exit\0A\00"
@.str.6 = [15 x i8] c"choose option:\00"
@.str.7 = [3 x i8] c"%d\00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 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 ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %11
11: ; preds = %0, %28
%12 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %4)
%14 = load i32, i32* @stdin
%15 = call i32 @fflush(i32 %14)
%16 = load i32, i32* %4
switch i32 %16, label %28 [
i32 1, label %17
i32 2, label %19
i32 3, label %21
i32 4, label %23
i32 5, label %25
i32 6, label %27
]
17: ; preds = %11
%18 = call i32 (...) @Enqueue()
br label %28
19: ; preds = %11
%20 = call float (...) @maxPrice()
store float %20, float* %2
br label %28
21: ; preds = %11
%22 = call i32 (...) @Delete()
br label %28
23: ; preds = %11
%24 = call i32 (...) @changePrice()
br label %28
25: ; preds = %11
%26 = call i32 (...) @Print()
br label %28
27: ; preds = %11
ret i32 0
28: ; preds = %11, %25, %23, %21, %19, %17
br label %11
}

LLVM IR (-O2):
@.str.6 = [15 x i8] c"choose option:\00"
@.str.7 = [3 x i8] c"%d\00"
@stdin = global i32 0
@str = [11 x i8] c"1.Add a TV\00"
@str.8 = [53 x i8] c"2.Find the most expensive TV manifactured after 2007\00"
@str.9 = [23 x i8] c"3.Delete TV`s by brand\00"
@str.10 = [27 x i8] c"4.Change the price of a TV\00"
@str.11 = [21 x i8] c"5.Print all the TV`s\00"
@str.12 = [7 x i8] c"6.Exit\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.8, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.9, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.10, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.11, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.12, i64 0, i64 0))
br label %9
9: ; preds = %15, %0
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %1)
%12 = load i32, i32* @stdin
%13 = call i32 @fflush(i32 %12)
%14 = load i32, i32* %1
switch i32 %14, label %15 [
i32 1, label %16
i32 2, label %18
i32 3, label %20
i32 4, label %22
i32 5, label %24
i32 6, label %26
]
15: ; preds = %9, %24, %22, %20, %18, %16
br label %9
16: ; preds = %9
%17 = call i32 (...) @Enqueue()
br label %15
18: ; preds = %9
%19 = call float (...) @maxPrice()
br label %15
20: ; preds = %9
%21 = call i32 (...) @Delete()
br label %15
22: ; preds = %9
%23 = call i32 (...) @changePrice()
br label %15
24: ; preds = %9
%25 = call i32 (...) @Print()
br label %15
26: ; preds = %9
ret i32 0
}