#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, unsigned int *, unsigned int *);
int main(void) {
  unsigned int numeroProdotto;
  unsigned int quantitaVenduta;
  float prezzoUnitarioDettaglio;
  float totaleVendite;
  unsigned int valoreSentinella = 1;
  printf("%s", "Inserire il CODICE PRODOTTO e la QUANTITA' venduta questa "
               "settimana separati da uno spazio: ");
  scanf("%u %u", &numeroProdotto, &quantitaVenduta);
  switch (numeroProdotto) {
  case (1):
    prezzoUnitarioDettaglio = 2.98;
    break;
  case (2):
    prezzoUnitarioDettaglio = 4.50;
    break;
  case (3):
    prezzoUnitarioDettaglio = 9.98;
    break;
  case (4):
    prezzoUnitarioDettaglio = 4.49;
    break;
  case (5):
    prezzoUnitarioDettaglio = 6.87;
    break;
  case ('\n'):
  case ('\t'):
  case (' '):
    break;
  default:
    puts("Valore errato, reinserire codice prodotto.");
    valoreSentinella = 0;
    break;
  }
  if (valoreSentinella == 1) {
    totaleVendite = (prezzoUnitarioDettaglio * quantitaVenduta);
    puts("");
    printf("Le vendite del prodotto %u \"prezzo al dettaglio $%.2f\" sono "
           "state di: $%.2f",
           numeroProdotto, prezzoUnitarioDettaglio, totaleVendite);
    puts("");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x18(%rbp)
lea    0xf47(%rip),%rdi
lea    0xf43(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf92(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x1f,%eax
ja     11f7 <main+0xc7>
mov    -0x20(%rbp),%rax
lea    0xe85(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  0xe70(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    120a <main+0xda>
movss  0xe5a(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    120a <main+0xda>
movss  0xe44(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    120a <main+0xda>
movss  0xe2e(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    120a <main+0xda>
movss  0xe18(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    120a <main+0xda>
jmp    120a <main+0xda>
lea    0xefc(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jne    1265 <main+0x135>
movss  -0x10(%rbp),%xmm0
mov    -0xc(%rbp),%eax
cvtsi2ss %rax,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%esi
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xed3(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
lea    0xe93(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xf49(%rip),%rdi
lea    0xf45(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf94(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0x14(%rsp),%rdx
call   1060 <scanf@plt>
mov    0x8(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x1f,%eax
ja     1217 <main+0xd7>
movss  0xe79(%rip),%xmm0
lea    0xe86(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  0xe71(%rip),%xmm0
jmp    11bd <main+0x7d>
movss  0xe63(%rip),%xmm0
jmp    11bd <main+0x7d>
movss  0xe55(%rip),%xmm0
jmp    11bd <main+0x7d>
movss  0xe47(%rip),%xmm0
movss  %xmm0,0xc(%rsp)
mov    0x14(%rsp),%eax
cvtsi2ss %rax,%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,0x10(%rsp)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x8(%rsp),%esi
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x10(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xf26(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret
lea    0xedc(%rip),%rdi
call   1040 <puts@plt>
jmp    1210 <main+0xd0>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [93 x i8] c"Inserire il CODICE PRODOTTO e la QUANTITA' venduta questa settimana separati da uno spazio: \00"
@.str.2 = [6 x i8] c"%u %u\00"
@.str.3 = [43 x i8] c"Valore errato, reinserire codice prodotto.\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [76 x i8] c"Le vendite del prodotto %u \22prezzo al dettaglio $%.2f\22 sono state di: $%.2f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca float
%6 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %2, i32* %3)
%9 = load i32, i32* %2
switch i32 %9, label %16 [
i32 1, label %10
i32 2, label %11
i32 3, label %12
i32 4, label %13
i32 5, label %14
i32 10, label %15
i32 9, label %15
i32 32, label %15
]
10: ; preds = %0
store float 0x4007D70A40000000, float* %4
br label %18
11: ; preds = %0
store float 4.500000e+00, float* %4
br label %18
12: ; preds = %0
store float 0x4023F5C280000000, float* %4
br label %18
13: ; preds = %0
store float 0x4011F5C280000000, float* %4
br label %18
14: ; preds = %0
store float 0x401B7AE140000000, float* %4
br label %18
15: ; preds = %0, %0, %0
br label %18
16: ; preds = %0
%17 = call i32 @puts(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %6
br label %18
18: ; preds = %16, %15, %14, %13, %12, %11, %10
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %34
21: ; preds = %18
%22 = load float, float* %4
%23 = load i32, i32* %3
%24 = uitofp i32 %23 to float
%25 = fmul float %22, %24
store float %25, float* %5
%26 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%27 = load i32, i32* %2
%28 = load float, float* %4
%29 = fpext float %28 to double
%30 = load float, float* %5
%31 = fpext float %30 to double
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.5, i64 0, i64 0), i32 %27, double %29, double %31)
%33 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
br label %34
34: ; preds = %21, %18
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [93 x i8] c"Inserire il CODICE PRODOTTO e la QUANTITA' venduta questa settimana separati da uno spazio: \00"
@.str.2 = [6 x i8] c"%u %u\00"
@.str.3 = [43 x i8] c"Valore errato, reinserire codice prodotto.\00"
@.str.5 = [76 x i8] c"Le vendite del prodotto %u \22prezzo al dettaglio $%.2f\22 sono state di: $%.2f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
switch i32 %7, label %12 [
i32 1, label %14
i32 2, label %8
i32 3, label %9
i32 4, label %10
i32 5, label %11
i32 10, label %14
i32 9, label %14
i32 32, label %14
]
8: ; preds = %0
br label %14
9: ; preds = %0
br label %14
10: ; preds = %0
br label %14
11: ; preds = %0
br label %14
12: ; preds = %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
br label %25
14: ; preds = %0, %0, %0, %0, %11, %10, %9, %8
%15 = phi float [ 0x4007D70A40000000, %0 ], [ 4.500000e+00, %8 ], [ 0x4023F5C280000000, %9 ], [ 0x4011F5C280000000, %10 ], [ 0x401B7AE140000000, %11 ], [ 0x4007D70A40000000, %0 ], [ 0x4007D70A40000000, %0 ], [ 0x4007D70A40000000, %0 ]
%16 = load i32, i32* %2
%17 = uitofp i32 %16 to float
%18 = fmul float %15, %17
%19 = call i32 @putchar(i32 10)
%20 = load i32, i32* %1
%21 = fpext float %15 to double
%22 = fpext float %18 to double
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @.str.5, i64 0, i64 0), i32 %20, double %21, double %22)
%24 = call i32 @putchar(i32 10)
br label %25
25: ; preds = %12, %14
ret i32 0
}