#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 /*<<< orphan*/ snprintf(char *, int, char *, float, ...);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ system(char *);
int main() {
  float numA;
  float numB;
  float result;
  char tmp[30];
  int type;
  char c[10] = {0};
  printf("Type first number\n");
  scanf("%f", &numA);
  printf("Type second number\n");
  scanf("%f", &numB);
  printf("Choose number about calcurated type\n1:+, 2:-, 3:*, 4:/");
  scanf("%d", &type);
  switch (type) {
  case 1:
    result = numA + numB;
    strcat(c, "plus");
    break;
  case 2:
    result = numA - numB;
    strcat(c, "minus");
    break;
  case 3:
    result = numA * numB;
    strcat(c, "times");
    break;
  case 4:
    result = numA / numB;
    strcat(c, "divide");
    break;
  default:
    return -1;
  }
  snprintf(tmp, 30, "say -v \"Princess\" %.f %s %.f is %.f", numA, c, numB,
           result);
  system(tmp);
  snprintf(tmp, 30, "say The result is %.f", result);
  system(tmp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
movw   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
lea    0xea3(%rip),%rdi
mov    %rdi,-0x58(%rbp)
xor    %eax,%eax
mov    %al,-0x49(%rbp)
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xe8d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x58(%rbp),%rdi
mov    -0x49(%rbp),%al
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
mov    -0x49(%rbp),%al
lea    0xead(%rip),%rdi
lea    -0x34(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x34(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x48(%rbp)
sub    $0x3,%eax
ja     1286 <main+0x136>
mov    -0x48(%rbp),%rax
lea    0xe13(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xe64(%rip),%rsi
call   1070 <strcat@plt>
jmp    1292 <main+0x142>
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xe45(%rip),%rsi
call   1070 <strcat@plt>
jmp    1292 <main+0x142>
movss  -0x8(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xe27(%rip),%rsi
call   1070 <strcat@plt>
jmp    1292 <main+0x142>
movss  -0x8(%rbp),%xmm0
divss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xe09(%rip),%rsi
call   1070 <strcat@plt>
jmp    1292 <main+0x142>
movl   $0xffffffff,-0x4(%rbp)
jmp    12f9 <main+0x1a9>
lea    -0x30(%rbp),%rdi
movss  -0x8(%rbp),%xmm0
lea    -0x40(%rbp),%rcx
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
mov    $0x1e,%esi
lea    0xdcf(%rip),%rdx
mov    $0x3,%al
call   1050 <snprintf@plt>
lea    -0x30(%rbp),%rdi
call   1030 <system@plt>
lea    -0x30(%rbp),%rdi
movss  -0x10(%rbp),%xmm0
mov    $0x1e,%esi
lea    0xdce(%rip),%rdx
mov    $0x1,%al
call   1050 <snprintf@plt>
lea    -0x30(%rbp),%rdi
call   1030 <system@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x48,%rsp
movw   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
lea    0xf21(%rip),%rdi
call   1030 <puts@plt>
lea    0xe86(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <scanf@plt>
lea    0xf11(%rip),%rdi
call   1030 <puts@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <scanf@plt>
lea    0xe58(%rip),%rdi
call   1050 <printf@plt>
lea    0xe83(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1209 <main+0xa9>
lea    0xe1a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  0x8(%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
lea    0xe46(%rip),%rsi
jmp    125f <main+0xff>
mov    $0xffffffff,%eax
jmp    12d0 <main+0x170>
movss  0x8(%rsp),%xmm0
subss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
lea    0xe27(%rip),%rsi
jmp    125f <main+0xff>
movss  0x8(%rsp),%xmm0
mulss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
lea    0xe13(%rip),%rsi
jmp    125f <main+0xff>
movss  0x8(%rsp),%xmm0
divss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
lea    0xdff(%rip),%rsi
lea    0x10(%rsp),%r14
mov    %r14,%rdi
call   1080 <strcat@plt>
movss  0x8(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  (%rsp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xdd9(%rip),%rdx
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1e,%esi
mov    %r14,%rcx
mov    $0x3,%al
call   1060 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
lea    0xdd7(%rip),%rdx
mov    %rbx,%rdi
mov    $0x1e,%esi
movss  (%rsp),%xmm0
mov    $0x1,%al
call   1060 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Type first number\0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [20 x i8] c"Type second number\0A\00"
@.str.3 = [55 x i8] c"Choose number about calcurated type\0A1:+, 2:-, 3:*, 4:/\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [5 x i8] c"plus\00"
@.str.6 = [6 x i8] c"minus\00"
@.str.7 = [6 x i8] c"times\00"
@.str.8 = [7 x i8] c"divide\00"
@.str.9 = [36 x i8] c"say -v \22Princess\22 %.f %s %.f is %.f\00"
@.str.10 = [22 x i8] c"say The result is %.f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca [30 x i8]
%6 = alloca i32
%7 = alloca [10 x i8]
store i32 0, i32* %1
%8 = bitcast [10 x i8]* %7 to i8*
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%11 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%13 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %6)
%15 = load i32, i32* %6
switch i32 %15, label %40 [
i32 1, label %16
i32 2, label %22
i32 3, label %28
i32 4, label %34
]
16: ; preds = %0
%17 = load float, float* %2
%18 = load float, float* %3
%19 = fadd float %17, %18
store float %19, float* %4
%20 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%21 = call i32 @strcat(i8* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %41
22: ; preds = %0
%23 = load float, float* %2
%24 = load float, float* %3
%25 = fsub float %23, %24
store float %25, float* %4
%26 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%27 = call i32 @strcat(i8* %26, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %41
28: ; preds = %0
%29 = load float, float* %2
%30 = load float, float* %3
%31 = fmul float %29, %30
store float %31, float* %4
%32 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%33 = call i32 @strcat(i8* %32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %41
34: ; preds = %0
%35 = load float, float* %2
%36 = load float, float* %3
%37 = fdiv float %35, %36
store float %37, float* %4
%38 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%39 = call i32 @strcat(i8* %38, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
br label %41
40: ; preds = %0
store i32 -1, i32* %1
br label %57
41: ; preds = %34, %28, %22, %16
%42 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%43 = load float, float* %2
%44 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%45 = load float, float* %3
%46 = fpext float %45 to double
%47 = load float, float* %4
%48 = fpext float %47 to double
%49 = call i32 (i8*, i32, i8*, float, ...) @snprintf(i8* %42, i32 30, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), float %43, i8* %44, double %46, double %48)
%50 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%51 = call i32 @system(i8* %50)
%52 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%53 = load float, float* %4
%54 = call i32 (i8*, i32, i8*, float, ...) @snprintf(i8* %52, i32 30, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), float %53)
%55 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%56 = call i32 @system(i8* %55)
store i32 0, i32* %1
br label %57
57: ; preds = %41, %40
%58 = load i32, i32* %1
ret i32 %58
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%f\00"
@.str.3 = [55 x i8] c"Choose number about calcurated type\0A1:+, 2:-, 3:*, 4:/\00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [5 x i8] c"plus\00"
@.str.6 = [6 x i8] c"minus\00"
@.str.7 = [6 x i8] c"times\00"
@.str.8 = [7 x i8] c"divide\00"
@.str.9 = [36 x i8] c"say -v \22Princess\22 %.f %s %.f is %.f\00"
@.str.10 = [22 x i8] c"say The result is %.f\00"
@str = [18 x i8] c"Type first number\00"
@str.11 = [19 x i8] c"Type second number\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca [30 x i8]
%4 = alloca i32
%5 = alloca [10 x i8]
%6 = bitcast float* %1 to i8*
%7 = bitcast float* %2 to i8*
%8 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%9 = bitcast i32* %4 to i8*
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.11, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%15 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %4)
%17 = load i32, i32* %4
switch i32 %17, label %46 [
i32 1, label %18
i32 2, label %22
i32 3, label %26
i32 4, label %30
]
18: ; preds = %0
%19 = load float, float* %1
%20 = load float, float* %2
%21 = fadd float %19, %20
br label %34
22: ; preds = %0
%23 = load float, float* %1
%24 = load float, float* %2
%25 = fsub float %23, %24
br label %34
26: ; preds = %0
%27 = load float, float* %1
%28 = load float, float* %2
%29 = fmul float %27, %28
br label %34
30: ; preds = %0
%31 = load float, float* %1
%32 = load float, float* %2
%33 = fdiv float %31, %32
br label %34
34: ; preds = %30, %26, %22, %18
%35 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), %30 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), %26 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), %22 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), %18 ]
%36 = phi float [ %33, %30 ], [ %29, %26 ], [ %25, %22 ], [ %21, %18 ]
%37 = call i32 @strcat(i8* %10, i8* %35)
%38 = load float, float* %1
%39 = load float, float* %2
%40 = fpext float %39 to double
%41 = fpext float %36 to double
%42 = call i32 (i8*, i32, i8*, float, ...) @snprintf(i8* %8, i32 30, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0), float %38, i8* %10, double %40, double %41)
%43 = call i32 @system(i8* %8)
%44 = call i32 (i8*, i32, i8*, float, ...) @snprintf(i8* %8, i32 30, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), float %36)
%45 = call i32 @system(i8* %8)
br label %46
46: ; preds = %0, %34
%47 = phi i32 [ 0, %34 ], [ -1, %0 ]
ret i32 %47
}