#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*/ scanf(char *, ...);
int main(int argc, const char *argv[]) {
  float priceCocoa, priceCoffee, neededValue, valueUserInput, coinInput;
  char drinkChoice;
  int withMilk;
  priceCocoa = 0.8;
  priceCoffee = 1.0;
  valueUserInput = 0.0;
  neededValue = 0.0;
  for (int i = 0; i < 10; ++i) {
    do {
      printf("Please press A for coffee or B for cocoa\n");
      scanf("%s", &drinkChoice);
    } while (drinkChoice != 'A' && drinkChoice != 'B');
    switch (drinkChoice) {
    case 'A':
      neededValue = priceCoffee;
      withMilk = 1;
      break;
    case 'B':
      neededValue = priceCocoa;
      withMilk = 0;
      break;
    default:
      break;
    }
    do {
      printf("Please insert %f Euro!\n", neededValue - valueUserInput);
      scanf("%f", &coinInput);
      valueUserInput += coinInput;
    } while (valueUserInput < neededValue);
    if (withMilk == 1) {
      printf("Press A for normal milk, B for sojamilk, C for lactose-free milk "
             "or X for no milk.\n");
      scanf("%s", &drinkChoice);
      switch (drinkChoice) {
      case 'A':
        printf("You choose normal milk\n");
        break;
      case 'B':
        printf("You choose sojamilk\n");
        break;
      case 'C':
        printf("You choose lactose-free milk\n");
        break;
      default:
        printf("You choose no milk\n");
        break;
      }
    }
    printf("Your drink is in production\n");
    if (valueUserInput > neededValue) {
      printf("Your return is %f\n", (valueUserInput - neededValue));
    }
    drinkChoice = 'x';
    coinInput = 0;
    valueUserInput = 0;
  }
  printf("Please call the service!\n");
  printf("Out of order!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  0xec6(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xeb5(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movl   $0x0,-0x30(%rbp)
cmpl   $0xa,-0x30(%rbp)
jge    1378 <main+0x258>
jmp    1176 <main+0x56>
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea7(%rip),%rdi
lea    -0x25(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x25(%rbp),%ecx
xor    %eax,%eax
cmp    $0x41,%ecx
mov    %al,-0x31(%rbp)
je     11b5 <main+0x95>
movsbl -0x25(%rbp),%eax
cmp    $0x42,%eax
setne  %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    1176 <main+0x56>
movsbl -0x25(%rbp),%eax
mov    %eax,-0x38(%rbp)
sub    $0x41,%eax
je     11e6 <main+0xc6>
jmp    11d5 <main+0xb5>
mov    -0x38(%rbp),%eax
sub    $0x42,%eax
je     11fc <main+0xdc>
jmp    1212 <main+0xf2>
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movl   $0x1,-0x2c(%rbp)
jmp    1217 <main+0xf7>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movl   $0x0,-0x2c(%rbp)
jmp    1217 <main+0xf7>
jmp    1217 <main+0xf7>
jmp    121c <main+0xfc>
movss  -0x1c(%rbp),%xmm0
subss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe04(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe0e(%rip),%rdi
lea    -0x24(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x24(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm0
ucomiss %xmm1,%xmm0
ja     121c <main+0xfc>
cmpl   $0x1,-0x2c(%rbp)
jne    131d <main+0x1fd>
lea    0xdd3(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x3d(%rbp)
call   1030 <printf@plt>
mov    -0x3d(%rbp),%al
lea    0xda1(%rip),%rdi
lea    -0x25(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x25(%rbp),%eax
mov    %eax,-0x3c(%rbp)
sub    $0x41,%eax
je     12d1 <main+0x1b1>
jmp    12af <main+0x18f>
mov    -0x3c(%rbp),%eax
sub    $0x42,%eax
je     12e4 <main+0x1c4>
jmp    12c0 <main+0x1a0>
mov    -0x3c(%rbp),%eax
sub    $0x43,%eax
je     12f7 <main+0x1d7>
jmp    130a <main+0x1ea>
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1318 <main+0x1f8>
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1318 <main+0x1f8>
lea    0xdd3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1318 <main+0x1f8>
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    131d <main+0x1fd>
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x20(%rbp),%xmm0
ucomiss -0x1c(%rbp),%xmm0
jbe    1356 <main+0x236>
movss  -0x20(%rbp),%xmm0
subss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdd1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movb   $0x78,-0x25(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1167 <main+0x47>
lea    0xdb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xorps  %xmm0,%xmm0
lea    0xf18(%rip),%r14
lea    0xeb9(%rip),%r15
lea    0x3(%rsp),%r13
lea    0xeb0(%rip),%r12
lea    0xec1(%rip),%rbx
lea    0x10(%rsp),%rbp
xor    %eax,%eax
jmp    118d <main+0x5d>
nopl   0x0(%rax,%rax,1)
movb   $0x78,0x3(%rsp)
movl   $0x0,0x10(%rsp)
mov    0x14(%rsp),%eax
add    $0x1,%eax
cmp    $0xa,%eax
je     12e6 <main+0x1b6>
mov    %eax,0x14(%rsp)
movss  %xmm0,0x4(%rsp)
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movzbl 0x3(%rsp),%eax
lea    -0x43(%rax),%ecx
cmp    $0xfe,%cl
jb     11a0 <main+0x70>
cmp    $0x42,%al
je     11f0 <main+0xc0>
cmp    $0x41,%al
movss  0x4(%rsp),%xmm0
jne    1200 <main+0xd0>
movl   $0x1,0xc(%rsp)
movss  0xe24(%rip),%xmm0
jmp    1200 <main+0xd0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movl   $0x0,0xc(%rsp)
movss  0xe00(%rip),%xmm0
xorps  %xmm1,%xmm1
movss  %xmm0,0x4(%rsp)
nopl   0x0(%rax)
movss  %xmm1,0x8(%rsp)
movss  0x4(%rsp),%xmm0
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm1
movss  0x4(%rsp),%xmm0
addss  0x10(%rsp),%xmm1
ucomiss %xmm1,%xmm0
ja     1210 <main+0xe0>
movss  %xmm1,0x8(%rsp)
cmpl   $0x1,0xc(%rsp)
jne    12a1 <main+0x171>
lea    0xe3f(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movsbq 0x3(%rsp),%rax
add    $0xffffffffffffffbf,%rax
lea    0xeb7(%rip),%rdi
cmp    $0x2,%eax
ja     129c <main+0x16c>
lea    0xebf(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
call   1030 <puts@plt>
lea    0xde1(%rip),%rdi
call   1030 <puts@plt>
movss  0x4(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
ucomiss %xmm0,%xmm1
jbe    1170 <main+0x40>
subss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xd52(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm0
jmp    1170 <main+0x40>
lea    0xd4c(%rip),%rdi
call   1030 <puts@plt>
lea    0xd59(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Please press A for coffee or B for cocoa\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [24 x i8] c"Please insert %f Euro!\0A\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [84 x i8] c"Press A for normal milk, B for sojamilk, C for lactose-free milk or X for no milk.\0A\00"
@.str.5 = [24 x i8] c"You choose normal milk\0A\00"
@.str.6 = [21 x i8] c"You choose sojamilk\0A\00"
@.str.7 = [30 x i8] c"You choose lactose-free milk\0A\00"
@.str.8 = [20 x i8] c"You choose no milk\0A\00"
@.str.9 = [29 x i8] c"Your drink is in production\0A\00"
@.str.10 = [19 x i8] c"Your return is %f\0A\00"
@.str.11 = [26 x i8] c"Please call the service!\0A\00"
@.str.12 = [15 x i8] c"Out of order!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca i8
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store float 0x3FE99999A0000000, float* %6
store float 1.000000e+00, float* %7
store float 0.000000e+00, float* %9
store float 0.000000e+00, float* %8
store i32 0, i32* %13
br label %14
14: ; preds = %83, %2
%15 = load i32, i32* %13
%16 = icmp slt i32 %15, 10
br i1 %16, label %17, label %86
17: ; preds = %14
br label %18
18: ; preds = %29, %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %11)
br label %21
21: ; preds = %18
%22 = load i8, i8* %11
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 65
br i1 %24, label %25, label %29
25: ; preds = %21
%26 = load i8, i8* %11
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 66
br label %29
29: ; preds = %25, %21
%30 = phi i1 [ false, %21 ], [ %28, %25 ]
br i1 %30, label %18, label %31
31: ; preds = %29
%32 = load i8, i8* %11
%33 = sext i8 %32 to i32
switch i32 %33, label %38 [
i32 65, label %34
i32 66, label %36
]
34: ; preds = %31
%35 = load float, float* %7
store float %35, float* %8
store i32 1, i32* %12
br label %39
36: ; preds = %31
%37 = load float, float* %6
store float %37, float* %8
store i32 0, i32* %12
br label %39
38: ; preds = %31
br label %39
39: ; preds = %38, %36, %34
br label %40
40: ; preds = %50, %39
%41 = load float, float* %8
%42 = load float, float* %9
%43 = fsub float %41, %42
%44 = fpext float %43 to double
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), double %44)
%46 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %10)
%47 = load float, float* %10
%48 = load float, float* %9
%49 = fadd float %48, %47
store float %49, float* %9
br label %50
50: ; preds = %40
%51 = load float, float* %9
%52 = load float, float* %8
%53 = fcmp olt float %51, %52
br i1 %53, label %40, label %54
54: ; preds = %50
%55 = load i32, i32* %12
%56 = icmp eq i32 %55, 1
br i1 %56, label %57, label %71
57: ; preds = %54
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str.4, i64 0, i64 0))
%59 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%60 = load i8, i8* %11
%61 = sext i8 %60 to i32
switch i32 %61, label %68 [
i32 65, label %62
i32 66, label %64
i32 67, label %66
]
62: ; preds = %57
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
br label %70
64: ; preds = %57
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
br label %70
66: ; preds = %57
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
br label %70
68: ; preds = %57
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0))
br label %70
70: ; preds = %68, %66, %64, %62
br label %71
71: ; preds = %70, %54
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
%73 = load float, float* %9
%74 = load float, float* %8
%75 = fcmp ogt float %73, %74
br i1 %75, label %76, label %82
76: ; preds = %71
%77 = load float, float* %9
%78 = load float, float* %8
%79 = fsub float %77, %78
%80 = fpext float %79 to double
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), double %80)
br label %82
82: ; preds = %76, %71
store i8 120, i8* %11
store float 0.000000e+00, float* %10
store float 0.000000e+00, float* %9
br label %83
83: ; preds = %82
%84 = load i32, i32* %13
%85 = add nsw i32 %84, 1
store i32 %85, i32* %13
br label %14
86: ; preds = %14
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0))
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [24 x i8] c"Please insert %f Euro!\0A\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.10 = [19 x i8] c"Your return is %f\0A\00"
@str = [25 x i8] c"Please call the service!\00"
@str.13 = [14 x i8] c"Out of order!\00"
@str.14 = [41 x i8] c"Please press A for coffee or B for cocoa\00"
@str.15 = [28 x i8] c"Your drink is in production\00"
@str.16 = [83 x i8] c"Press A for normal milk, B for sojamilk, C for lactose-free milk or X for no milk.\00"
@str.17 = [29 x i8] c"You choose lactose-free milk\00"
@str.18 = [20 x i8] c"You choose sojamilk\00"
@str.19 = [23 x i8] c"You choose normal milk\00"
@str.20 = [19 x i8] c"You choose no milk\00"
@reltable.main = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([23 x i8]* @str.19 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @str.18 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([29 x i8]* @str.17 to i64), i64 ptrtoint ([3 x i32]* @reltable.main to i64)) to i32)]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca float
%4 = alloca i8
%5 = bitcast float* %3 to i8*
br label %6
6: ; preds = %2, %57
%7 = phi i32 [ 0, %2 ], [ %58, %57 ]
%8 = phi i32 [ undef, %2 ], [ %24, %57 ]
%9 = phi float [ 0.000000e+00, %2 ], [ %23, %57 ]
br label %13
10: ; preds = %57
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.13, i64 0, i64 0))
ret i32 0
13: ; preds = %6, %13
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.14, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%16 = load i8, i8* %4
%17 = add i8 %16, -67
%18 = icmp ult i8 %17, -2
br i1 %18, label %13, label %19
19: ; preds = %13
switch i8 %16, label %22 [
i8 65, label %20
i8 66, label %21
]
20: ; preds = %19
br label %22
21: ; preds = %19
br label %22
22: ; preds = %19, %21, %20
%23 = phi float [ %9, %19 ], [ 0x3FE99999A0000000, %21 ], [ 1.000000e+00, %20 ]
%24 = phi i32 [ %8, %19 ], [ 0, %21 ], [ 1, %20 ]
br label %25
25: ; preds = %25, %22
%26 = phi float [ 0.000000e+00, %22 ], [ %32, %25 ]
%27 = fsub float %23, %26
%28 = fpext float %27 to double
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), double %28)
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %3)
%31 = load float, float* %3
%32 = fadd float %26, %31
%33 = fcmp olt float %32, %23
br i1 %33, label %25, label %34
34: ; preds = %25
%35 = icmp eq i32 %24, 1
br i1 %35, label %36, label %50
36: ; preds = %34
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([83 x i8], [83 x i8]* @str.16, i64 0, i64 0))
%38 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%39 = load i8, i8* %4
%40 = sext i8 %39 to i32
%41 = add nsw i32 %40, -65
%42 = icmp ult i32 %41, 3
br i1 %42, label %43, label %47
43: ; preds = %36
%44 = sext i32 %41 to i64
%45 = shl i64 %44, 2
%46 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.main to i8*), i64 %45)
br label %47
47: ; preds = %36, %43
%48 = phi i8* [ %46, %43 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @str.20, i64 0, i64 0), %36 ]
%49 = call i32 @puts(i8* dereferenceable(1) %48)
br label %50
50: ; preds = %47, %34
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.15, i64 0, i64 0))
%52 = fcmp ogt float %32, %23
br i1 %52, label %53, label %57
53: ; preds = %50
%54 = fsub float %32, %23
%55 = fpext float %54 to double
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), double %55)
br label %57
57: ; preds = %53, %50
store i8 120, i8* %4
store float 0.000000e+00, float* %3
%58 = add nuw nsw i32 %7, 1
%59 = icmp eq i32 %58, 10
br i1 %59, label %10, label %6
}