#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*/ LC_ALL;
int atoi(char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strncpy(char *, char *, int);
char *strpbrk(char *, char *);
int strspn(char *, char *);
int main() {
  setlocale(LC_ALL, "RUS");
  char expression[99];
  char op_left[9], op_right[9];
  char operation, *beg;
  char numbers[] = "0123456789";
  int len, result, value_left, value_right;
  printf("Введите арифметическое выражение (число, знак, число):\n");
  fgets(expression, 99, stdin);
  beg = strpbrk(expression, numbers);
  len = strspn(beg, numbers);
  strncpy(op_left, beg, len);
  op_left[len] = '\0';
  value_left = atoi(op_left);
  beg = strpbrk(beg, "+-*/");
  operation = *beg;
  beg = strpbrk(beg, numbers);
  len = strspn(beg, numbers);
  strncpy(op_right, beg, len);
  op_right[len] = '\0';
  value_right = atoi(op_right);
  switch (operation) {
  case '+':
    result = value_left + value_right;
    break;
  case '-':
    result = value_left - value_right;
    break;
  case '*':
    result = value_left * value_right;
    break;
  case '/':
    if (value_right != 0)
      result = value_left / value_right;
    else {
      printf("Ошибка! Деление на нуль\n");
      return 1;
    }
    break;
  default:
    printf("Неизвестная операция\n");
    return 1;
  }
  printf("Введённое выражение:\n%s %c %s = %d\n", op_left, operation, op_right,
         result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
lea    0xe86(%rip),%rsi
call   1080 <setlocale@plt>
movabs $0x3736353433323130,%rax
35 36 37
mov    %rax,-0xa0(%rbp)
movl   $0x393837,-0x99(%rbp)
lea    0xe6e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e21(%rip),%rax
mov    (%rax),%edx
lea    -0x70(%rbp),%rdi
mov    %rdi,-0xd8(%rbp)
mov    $0x63,%esi
call   1060 <fgets@plt>
mov    -0xd8(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    %rsi,-0xc8(%rbp)
call   1070 <strpbrk@plt>
mov    -0xc8(%rbp),%rsi
mov    %rax,-0x90(%rbp)
mov    -0x90(%rbp),%rdi
call   1050 <strspn@plt>
mov    %eax,-0xa4(%rbp)
mov    -0x90(%rbp),%rsi
mov    -0xa4(%rbp),%edx
lea    -0x79(%rbp),%rdi
mov    %rdi,-0xd0(%rbp)
call   1030 <strncpy@plt>
mov    -0xd0(%rbp),%rdi
movslq -0xa4(%rbp),%rax
movb   $0x0,-0x79(%rbp,%rax,1)
call   1090 <atoi@plt>
mov    %eax,-0xac(%rbp)
mov    -0x90(%rbp),%rdi
lea    0xe2a(%rip),%rsi
call   1070 <strpbrk@plt>
mov    -0xc8(%rbp),%rsi
mov    %rax,-0x90(%rbp)
mov    -0x90(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x83(%rbp)
mov    -0x90(%rbp),%rdi
call   1070 <strpbrk@plt>
mov    -0xc8(%rbp),%rsi
mov    %rax,-0x90(%rbp)
mov    -0x90(%rbp),%rdi
call   1050 <strspn@plt>
mov    %eax,-0xa4(%rbp)
mov    -0x90(%rbp),%rsi
mov    -0xa4(%rbp),%edx
lea    -0x82(%rbp),%rdi
mov    %rdi,-0xc0(%rbp)
call   1030 <strncpy@plt>
mov    -0xc0(%rbp),%rdi
movslq -0xa4(%rbp),%rax
movb   $0x0,-0x82(%rbp,%rax,1)
call   1090 <atoi@plt>
mov    %eax,-0xb0(%rbp)
movsbl -0x83(%rbp),%eax
add    $0xffffffd6,%eax
mov    %eax,%ecx
mov    %rcx,-0xb8(%rbp)
sub    $0x5,%eax
ja     13ad <main+0x23d>
mov    -0xb8(%rbp),%rax
lea    0xce6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0xac(%rbp),%eax
add    -0xb0(%rbp),%eax
mov    %eax,-0xa8(%rbp)
jmp    13c7 <main+0x257>
mov    -0xac(%rbp),%eax
sub    -0xb0(%rbp),%eax
mov    %eax,-0xa8(%rbp)
jmp    13c7 <main+0x257>
mov    -0xac(%rbp),%eax
imul   -0xb0(%rbp),%eax
mov    %eax,-0xa8(%rbp)
jmp    13c7 <main+0x257>
cmpl   $0x0,-0xb0(%rbp)
je     138e <main+0x21e>
mov    -0xac(%rbp),%eax
cltd
idivl  -0xb0(%rbp)
mov    %eax,-0xa8(%rbp)
jmp    13a8 <main+0x238>
lea    0xcfb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13f5 <main+0x285>
jmp    13c7 <main+0x257>
lea    0xd08(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    13f5 <main+0x285>
lea    -0x79(%rbp),%rsi
movsbl -0x83(%rbp),%edx
lea    -0x82(%rbp),%rcx
mov    -0xa8(%rbp),%r8d
lea    0xcfe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x90,%rsp
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
lea    0xe79(%rip),%rsi
call   1090 <setlocale@plt>
lea    0xeb7(%rip),%rdi
call   1040 <puts@plt>
mov    0x2e31(%rip),%rax
mov    (%rax),%edx
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x63,%esi
call   1070 <fgets@plt>
lea    0xe4a(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <strpbrk@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
call   1060 <strspn@plt>
mov    %eax,%ebp
lea    0x17(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncpy@plt>
movslq %ebp,%rax
movb   $0x0,0x17(%rsp,%rax,1)
mov    %r14,%rdi
call   10a0 <atoi@plt>
mov    %eax,%r14d
lea    0xe0e(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strpbrk@plt>
movsbl (%rax),%r12d
mov    %rax,%rdi
mov    %r15,%rsi
call   1080 <strpbrk@plt>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %r15,%rsi
call   1060 <strspn@plt>
mov    %eax,%ebx
lea    0xe(%rsp),%r15
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %eax,%edx
call   1030 <strncpy@plt>
movslq %ebx,%rax
movb   $0x0,0xe(%rsp,%rax,1)
mov    %r15,%rdi
call   10a0 <atoi@plt>
mov    %eax,%r8d
lea    -0x2a(%r12),%eax
cmp    $0x5,%eax
ja     128a <main+0x10a>
lea    0xd8a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
imul   %r14d,%r8d
jmp    12aa <main+0x12a>
add    %r14d,%r8d
jmp    12aa <main+0x12a>
lea    0xe5f(%rip),%rdi
jmp    12d0 <main+0x150>
sub    %r8d,%r14d
mov    %r14d,%r8d
jmp    12aa <main+0x12a>
test   %r8d,%r8d
je     12c9 <main+0x149>
mov    %r14d,%eax
cltd
idiv   %r8d
mov    %eax,%r8d
lea    0xd7b(%rip),%rdi
xor    %ebp,%ebp
lea    0x17(%rsp),%rsi
lea    0xe(%rsp),%rcx
mov    %r12d,%edx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    12da <main+0x15a>
lea    0xdf5(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x90,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [4 x i8] c"RUS\00"
@__const.main.numbers = [11 x i8] c"0123456789\00"
@.str.1 = [100 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D0\B0\D1\80\D0\B8\D1\84\D0\BC\D0\B5\D1\82\D0\B8\D1\87\D0\B5\D1\81\D0\BA\D0\BE\D0\B5 \D0\B2\D1\8B\D1\80\D0\B0\D0\B6\D0\B5\D0\BD\D0\B8\D0\B5 (\D1\87\D0\B8\D1\81\D0\BB\D0\BE, \D0\B7\D0\BD\D0\B0\D0\BA, \D1\87\D0\B8\D1\81\D0\BB\D0\BE):\0A\00"
@stdin = global i32 0
@.str.2 = [5 x i8] c"+-*/\00"
@.str.3 = [44 x i8] c"\D0\9E\D1\88\D0\B8\D0\B1\D0\BA\D0\B0! \D0\94\D0\B5\D0\BB\D0\B5\D0\BD\D0\B8\D0\B5 \D0\BD\D0\B0 \D0\BD\D1\83\D0\BB\D1\8C\0A\00"
@.str.4 = [41 x i8] c"\D0\9D\D0\B5\D0\B8\D0\B7\D0\B2\D0\B5\D1\81\D1\82\D0\BD\D0\B0\D1\8F \D0\BE\D0\BF\D0\B5\D1\80\D0\B0\D1\86\D0\B8\D1\8F\0A\00"
@.str.5 = [54 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D1\91\D0\BD\D0\BD\D0\BE\D0\B5 \D0\B2\D1\8B\D1\80\D0\B0\D0\B6\D0\B5\D0\BD\D0\B8\D0\B5:\0A%s %c %s = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [99 x i8]
%3 = alloca [9 x i8]
%4 = alloca [9 x i8]
%5 = alloca i8
%6 = alloca i8*
%7 = alloca [11 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
%12 = load i32, i32* @LC_ALL
%13 = call i32 @setlocale(i32 %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%14 = bitcast [11 x i8]* %7 to i8*
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.1, i64 0, i64 0))
%16 = getelementptr inbounds [99 x i8], [99 x i8]* %2, i64 0, i64 0
%17 = load i32, i32* @stdin
%18 = call i32 @fgets(i8* %16, i32 99, i32 %17)
%19 = getelementptr inbounds [99 x i8], [99 x i8]* %2, i64 0, i64 0
%20 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%21 = call i8* @strpbrk(i8* %19, i8* %20)
store i8* %21, i8** %6
%22 = load i8*, i8** %6
%23 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%24 = call i32 @strspn(i8* %22, i8* %23)
store i32 %24, i32* %8
%25 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%26 = load i8*, i8** %6
%27 = load i32, i32* %8
%28 = call i32 @strncpy(i8* %25, i8* %26, i32 %27)
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 %30
store i8 0, i8* %31
%32 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%33 = call i32 @atoi(i8* %32)
store i32 %33, i32* %10
%34 = load i8*, i8** %6
%35 = call i8* @strpbrk(i8* %34, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store i8* %35, i8** %6
%36 = load i8*, i8** %6
%37 = load i8, i8* %36
store i8 %37, i8* %5
%38 = load i8*, i8** %6
%39 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%40 = call i8* @strpbrk(i8* %38, i8* %39)
store i8* %40, i8** %6
%41 = load i8*, i8** %6
%42 = getelementptr inbounds [11 x i8], [11 x i8]* %7, i64 0, i64 0
%43 = call i32 @strspn(i8* %41, i8* %42)
store i32 %43, i32* %8
%44 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 0
%45 = load i8*, i8** %6
%46 = load i32, i32* %8
%47 = call i32 @strncpy(i8* %44, i8* %45, i32 %46)
%48 = load i32, i32* %8
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 %49
store i8 0, i8* %50
%51 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 0
%52 = call i32 @atoi(i8* %51)
store i32 %52, i32* %11
%53 = load i8, i8* %5
%54 = sext i8 %53 to i32
switch i32 %54, label %77 [
i32 43, label %55
i32 45, label %59
i32 42, label %63
i32 47, label %67
]
55: ; preds = %0
%56 = load i32, i32* %10
%57 = load i32, i32* %11
%58 = add nsw i32 %56, %57
store i32 %58, i32* %9
br label %79
59: ; preds = %0
%60 = load i32, i32* %10
%61 = load i32, i32* %11
%62 = sub nsw i32 %60, %61
store i32 %62, i32* %9
br label %79
63: ; preds = %0
%64 = load i32, i32* %10
%65 = load i32, i32* %11
%66 = mul nsw i32 %64, %65
store i32 %66, i32* %9
br label %79
67: ; preds = %0
%68 = load i32, i32* %11
%69 = icmp ne i32 %68, 0
br i1 %69, label %70, label %74
70: ; preds = %67
%71 = load i32, i32* %10
%72 = load i32, i32* %11
%73 = sdiv i32 %71, %72
store i32 %73, i32* %9
br label %76
74: ; preds = %67
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %1
br label %86
76: ; preds = %70
br label %79
77: ; preds = %0
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %1
br label %86
79: ; preds = %76, %63, %59, %55
%80 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%81 = load i8, i8* %5
%82 = sext i8 %81 to i32
%83 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 0
%84 = load i32, i32* %9
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0), i8* %80, i32 %82, i8* %83, i32 %84)
store i32 0, i32* %1
br label %86
86: ; preds = %79, %77, %74
%87 = load i32, i32* %1
ret i32 %87
}

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [4 x i8] c"RUS\00"
@__const.main.numbers = [11 x i8] c"0123456789\00"
@stdin = global i32 0
@.str.2 = [5 x i8] c"+-*/\00"
@.str.5 = [54 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D1\91\D0\BD\D0\BD\D0\BE\D0\B5 \D0\B2\D1\8B\D1\80\D0\B0\D0\B6\D0\B5\D0\BD\D0\B8\D0\B5:\0A%s %c %s = %d\0A\00"
@str = [99 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D0\B0\D1\80\D0\B8\D1\84\D0\BC\D0\B5\D1\82\D0\B8\D1\87\D0\B5\D1\81\D0\BA\D0\BE\D0\B5 \D0\B2\D1\8B\D1\80\D0\B0\D0\B6\D0\B5\D0\BD\D0\B8\D0\B5 (\D1\87\D0\B8\D1\81\D0\BB\D0\BE, \D0\B7\D0\BD\D0\B0\D0\BA, \D1\87\D0\B8\D1\81\D0\BB\D0\BE):\00"
@str.6 = [43 x i8] c"\D0\9E\D1\88\D0\B8\D0\B1\D0\BA\D0\B0! \D0\94\D0\B5\D0\BB\D0\B5\D0\BD\D0\B8\D0\B5 \D0\BD\D0\B0 \D0\BD\D1\83\D0\BB\D1\8C\00"
@str.7 = [40 x i8] c"\D0\9D\D0\B5\D0\B8\D0\B7\D0\B2\D0\B5\D1\81\D1\82\D0\BD\D0\B0\D1\8F \D0\BE\D0\BF\D0\B5\D1\80\D0\B0\D1\86\D0\B8\D1\8F\00"
define i32 @main() {
%1 = alloca [99 x i8]
%2 = alloca [9 x i8]
%3 = alloca [9 x i8]
%4 = load i32, i32* @LC_ALL
%5 = tail call i32 @setlocale(i32 %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [99 x i8], [99 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([99 x i8], [99 x i8]* @str, i64 0, i64 0))
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %6, i32 99, i32 %10)
%12 = call i8* @strpbrk(i8* %6, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__const.main.numbers, i64 0, i64 0))
%13 = call i32 @strspn(i8* %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__const.main.numbers, i64 0, i64 0))
%14 = call i32 @strncpy(i8* %7, i8* %12, i32 %13)
%15 = sext i32 %13 to i64
%16 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 %15
store i8 0, i8* %16
%17 = call i32 @atoi(i8* %7)
%18 = call i8* @strpbrk(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%19 = load i8, i8* %18
%20 = call i8* @strpbrk(i8* %18, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__const.main.numbers, i64 0, i64 0))
%21 = call i32 @strspn(i8* %20, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__const.main.numbers, i64 0, i64 0))
%22 = call i32 @strncpy(i8* %8, i8* %20, i32 %21)
%23 = sext i32 %21 to i64
%24 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 %23
store i8 0, i8* %24
%25 = call i32 @atoi(i8* %8)
%26 = sext i8 %19 to i32
switch i32 %26, label %39 [
i32 43, label %27
i32 45, label %29
i32 42, label %31
i32 47, label %33
]
27: ; preds = %0
%28 = add nsw i32 %25, %17
br label %41
29: ; preds = %0
%30 = sub nsw i32 %17, %25
br label %41
31: ; preds = %0
%32 = mul nsw i32 %25, %17
br label %41
33: ; preds = %0
%34 = icmp eq i32 %25, 0
br i1 %34, label %37, label %35
35: ; preds = %33
%36 = sdiv i32 %17, %25
br label %41
37: ; preds = %33
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.6, i64 0, i64 0))
br label %44
39: ; preds = %0
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.7, i64 0, i64 0))
br label %44
41: ; preds = %35, %31, %29, %27
%42 = phi i32 [ %36, %35 ], [ %32, %31 ], [ %30, %29 ], [ %28, %27 ]
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0), i8* %7, i32 %26, i8* %8, i32 %42)
br label %44
44: ; preds = %41, %39, %37
%45 = phi i32 [ 1, %39 ], [ 0, %41 ], [ 1, %37 ]
ret i32 %45
}