#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 getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
main() {
  float count = 0, sum;
  int a;
  printf("Введите 1, чтобы внести деньги\n");
  printf("Введите 2, чтобы снять деньги\n");
  printf("Введите 3, чтобы проверить баланс\n");
  printf("Введите 4, чтобы закрыть счёт\n");
  a = getchar();
  while (a != '4') {
    switch (a) {
    case '1':
      printf("Введите сумму, которую вы хотите внести\n");
      scanf("%f", &sum);
      if (sum > 0)
        count += sum;
      else
        printf("Операция запрещена\n");
      break;
    case '2':
      printf("Введите сумму для снятия\n");
      scanf("%f", &sum);
      if (sum > 0 && count >= sum)
        count -= sum;
      else
        printf("Операция запрещена\n");
      break;
    case '3':
      printf("Ваш баланс: %.2f\n", count);
      break;
    case '\n':
      break;
    default:
      printf("Команда не распознана\n");
    }
    a = getchar();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x34,-0x10(%rbp)
je     12d7 <main+0x1a7>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0xa,%eax
je     12b5 <main+0x185>
jmp    11a7 <main+0x77>
mov    -0x14(%rbp),%eax
sub    $0x31,%eax
je     11da <main+0xaa>
jmp    11b8 <main+0x88>
mov    -0x14(%rbp),%eax
sub    $0x32,%eax
je     1230 <main+0x100>
jmp    11c9 <main+0x99>
mov    -0x14(%rbp),%eax
sub    $0x33,%eax
je     1299 <main+0x169>
jmp    12ba <main+0x18a>
lea    0xf01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf3d(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    121d <main+0xed>
movss  -0xc(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    122b <main+0xfb>
lea    0xf0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12c8 <main+0x198>
lea    0xf1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1286 <main+0x156>
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jb     1286 <main+0x156>
movss  -0xc(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    1294 <main+0x164>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12c8 <main+0x198>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeda(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    12c8 <main+0x198>
jmp    12c8 <main+0x198>
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x10(%rbp)
jmp    1189 <main+0x59>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xf7c(%rip),%rdi
call   1030 <puts@plt>
lea    0xfa7(%rip),%rdi
call   1030 <puts@plt>
lea    0xfd0(%rip),%rdi
call   1030 <puts@plt>
lea    0x1001(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
lea    0xe7b(%rip),%r15
lea    0xf20(%rip),%r12
lea    0x4(%rsp),%rbx
lea    0x1087(%rip),%r13
lea    0x1009(%rip),%rbp
lea    0xf09(%rip),%r14
xorps  %xmm0,%xmm0
movss  %xmm0,(%rsp)
jmp    11c7 <main+0x87>
lea    0x108c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
add    $0xfffffff6,%eax
cmp    $0x2a,%eax
ja     11b4 <main+0x74>
movslq (%r15,%rax,4),%rax
add    %r15,%rax
jmp    *%rax
lea    0xffb(%rip),%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
movss  0x4(%rsp),%xmm0
ucomiss 0xe04(%rip),%xmm0
jbe    1265 <main+0x125>
movss  (%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,(%rsp)
jmp    11c0 <main+0x80>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
movss  0x4(%rsp),%xmm0
ucomiss 0xdd2(%rip),%xmm0
jbe    1265 <main+0x125>
movss  (%rsp),%xmm1
ucomiss %xmm0,%xmm1
jb     1265 <main+0x125>
movss  (%rsp),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,(%rsp)
jmp    11c0 <main+0x80>
movss  (%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    11c0 <main+0x80>
mov    %r13,%rdi
jmp    11bb <main+0x7b>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [56 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 1, \D1\87\D1\82\D0\BE\D0\B1\D1\8B \D0\B2\D0\BD\D0\B5\D1\81\D1\82\D0\B8 \D0\B4\D0\B5\D0\BD\D1\8C\D0\B3\D0\B8\0A\00"
@.str.1 = [54 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 2, \D1\87\D1\82\D0\BE\D0\B1\D1\8B \D1\81\D0\BD\D1\8F\D1\82\D1\8C \D0\B4\D0\B5\D0\BD\D1\8C\D0\B3\D0\B8\0A\00"
@.str.2 = [62 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 3, \D1\87\D1\82\D0\BE\D0\B1\D1\8B \D0\BF\D1\80\D0\BE\D0\B2\D0\B5\D1\80\D0\B8\D1\82\D1\8C \D0\B1\D0\B0\D0\BB\D0\B0\D0\BD\D1\81\0A\00"
@.str.3 = [54 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 4, \D1\87\D1\82\D0\BE\D0\B1\D1\8B \D0\B7\D0\B0\D0\BA\D1\80\D1\8B\D1\82\D1\8C \D1\81\D1\87\D1\91\D1\82\0A\00"
@.str.4 = [74 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D1\81\D1\83\D0\BC\D0\BC\D1\83, \D0\BA\D0\BE\D1\82\D0\BE\D1\80\D1\83\D1\8E \D0\B2\D1\8B \D1\85\D0\BE\D1\82\D0\B8\D1\82\D0\B5 \D0\B2\D0\BD\D0\B5\D1\81\D1\82\D0\B8\0A\00"
@.str.5 = [3 x i8] c"%f\00"
@.str.6 = [37 x i8] c"\D0\9E\D0\BF\D0\B5\D1\80\D0\B0\D1\86\D0\B8\D1\8F \D0\B7\D0\B0\D0\BF\D1\80\D0\B5\D1\89\D0\B5\D0\BD\D0\B0\0A\00"
@.str.7 = [47 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D1\81\D1\83\D0\BC\D0\BC\D1\83 \D0\B4\D0\BB\D1\8F \D1\81\D0\BD\D1\8F\D1\82\D0\B8\D1\8F\0A\00"
@.str.8 = [27 x i8] c"\D0\92\D0\B0\D1\88 \D0\B1\D0\B0\D0\BB\D0\B0\D0\BD\D1\81: %.2f\0A\00"
@.str.9 = [42 x i8] c"\D0\9A\D0\BE\D0\BC\D0\B0\D0\BD\D0\B4\D0\B0 \D0\BD\D0\B5 \D1\80\D0\B0\D1\81\D0\BF\D0\BE\D0\B7\D0\BD\D0\B0\D0\BD\D0\B0\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i32
store i32 0, i32* %1
store float 0.000000e+00, float* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 (...) @getchar()
store i32 %9, i32* %4
br label %10
10: ; preds = %50, %0
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 52
br i1 %12, label %13, label %52
13: ; preds = %10
%14 = load i32, i32* %4
switch i32 %14, label %48 [
i32 49, label %15
i32 50, label %27
i32 51, label %43
i32 10, label %47
]
15: ; preds = %13
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), float* %3)
%18 = load float, float* %3
%19 = fcmp ogt float %18, 0.000000e+00
br i1 %19, label %20, label %24
20: ; preds = %15
%21 = load float, float* %3
%22 = load float, float* %2
%23 = fadd float %22, %21
store float %23, float* %2
br label %26
24: ; preds = %15
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
br label %26
26: ; preds = %24, %20
br label %50
27: ; preds = %13
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.7, i64 0, i64 0))
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), float* %3)
%30 = load float, float* %3
%31 = fcmp ogt float %30, 0.000000e+00
br i1 %31, label %32, label %40
32: ; preds = %27
%33 = load float, float* %2
%34 = load float, float* %3
%35 = fcmp oge float %33, %34
br i1 %35, label %36, label %40
36: ; preds = %32
%37 = load float, float* %3
%38 = load float, float* %2
%39 = fsub float %38, %37
store float %39, float* %2
br label %42
40: ; preds = %32, %27
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
br label %42
42: ; preds = %40, %36
br label %50
43: ; preds = %13
%44 = load float, float* %2
%45 = fpext float %44 to double
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), double %45)
br label %50
47: ; preds = %13
br label %50
48: ; preds = %13
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.9, i64 0, i64 0))
br label %50
50: ; preds = %48, %47, %43, %42, %26
%51 = call i32 (...) @getchar()
store i32 %51, i32* %4
br label %10
52: ; preds = %10
%53 = load i32, i32* %1
ret i32 %53
}

LLVM IR (-O2):
@.str.5 = [3 x i8] c"%f\00"
@.str.8 = [27 x i8] c"\D0\92\D0\B0\D1\88 \D0\B1\D0\B0\D0\BB\D0\B0\D0\BD\D1\81: %.2f\0A\00"
@str = [55 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 1, \D1\87\D1\82\D0\BE\D0\B1\D1\8B \D0\B2\D0\BD\D0\B5\D1\81\D1\82\D0\B8 \D0\B4\D0\B5\D0\BD\D1\8C\D0\B3\D0\B8\00"
@str.10 = [53 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 2, \D1\87\D1\82\D0\BE\D0\B1\D1\8B \D1\81\D0\BD\D1\8F\D1\82\D1\8C \D0\B4\D0\B5\D0\BD\D1\8C\D0\B3\D0\B8\00"
@str.11 = [61 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 3, \D1\87\D1\82\D0\BE\D0\B1\D1\8B \D0\BF\D1\80\D0\BE\D0\B2\D0\B5\D1\80\D0\B8\D1\82\D1\8C \D0\B1\D0\B0\D0\BB\D0\B0\D0\BD\D1\81\00"
@str.12 = [53 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 4, \D1\87\D1\82\D0\BE\D0\B1\D1\8B \D0\B7\D0\B0\D0\BA\D1\80\D1\8B\D1\82\D1\8C \D1\81\D1\87\D1\91\D1\82\00"
@str.13 = [46 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D1\81\D1\83\D0\BC\D0\BC\D1\83 \D0\B4\D0\BB\D1\8F \D1\81\D0\BD\D1\8F\D1\82\D0\B8\D1\8F\00"
@str.15 = [73 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D1\81\D1\83\D0\BC\D0\BC\D1\83, \D0\BA\D0\BE\D1\82\D0\BE\D1\80\D1\83\D1\8E \D0\B2\D1\8B \D1\85\D0\BE\D1\82\D0\B8\D1\82\D0\B5 \D0\B2\D0\BD\D0\B5\D1\81\D1\82\D0\B8\00"
@str.16 = [36 x i8] c"\D0\9E\D0\BF\D0\B5\D1\80\D0\B0\D1\86\D0\B8\D1\8F \D0\B7\D0\B0\D0\BF\D1\80\D0\B5\D1\89\D0\B5\D0\BD\D0\B0\00"
@str.17 = [41 x i8] c"\D0\9A\D0\BE\D0\BC\D0\B0\D0\BD\D0\B4\D0\B0 \D0\BD\D0\B5 \D1\80\D0\B0\D1\81\D0\BF\D0\BE\D0\B7\D0\BD\D0\B0\D0\BD\D0\B0\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.10, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.11, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.12, i64 0, i64 0))
%7 = tail call i32 (...) @getchar()
br label %8
8: ; preds = %36, %0
%9 = phi float [ 0.000000e+00, %0 ], [ %37, %36 ]
%10 = phi i32 [ %7, %0 ], [ %38, %36 ]
switch i32 %10, label %34 [
i32 52, label %39
i32 49, label %11
i32 50, label %20
i32 51, label %31
i32 10, label %36
]
11: ; preds = %8
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.15, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), float* %1)
%14 = load float, float* %1
%15 = fcmp ogt float %14, 0.000000e+00
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = fadd float %9, %14
br label %36
18: ; preds = %11
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.16, i64 0, i64 0))
br label %36
20: ; preds = %8
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.13, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), float* %1)
%23 = load float, float* %1
%24 = fcmp ule float %23, 0.000000e+00
%25 = fcmp ult float %9, %23
%26 = select i1 %24, i1 true, i1 %25
br i1 %26, label %29, label %27
27: ; preds = %20
%28 = fsub float %9, %23
br label %36
29: ; preds = %20
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.16, i64 0, i64 0))
br label %36
31: ; preds = %8
%32 = fpext float %9 to double
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), double %32)
br label %36
34: ; preds = %8
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.17, i64 0, i64 0))
br label %36
36: ; preds = %8, %27, %29, %16, %18, %34, %31
%37 = phi float [ %9, %34 ], [ %9, %31 ], [ %28, %27 ], [ %9, %29 ], [ %17, %16 ], [ %9, %18 ], [ %9, %8 ]
%38 = call i32 (...) @getchar()
br label %8
39: ; preds = %8
ret i32 0
}