#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*/ calculate(int, char);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main() {
  char word[100];
  int length = 0;
  int i = 0;
  scanf("%s", word);
  length = strlen(word);
  char c;
  int number = 0;
  int flag = 0;
  for (; i < length; i++) {
    if ((int)word[i] >= 48 && (int)word[i] <= 57) {
      number = (number * 10) + (word[i] - 48);
    } else {
      if (flag == 1) {
        calculate(number, c);
        number = 0;
      }
      c = word[i];
      flag = 1;
    }
  }
  calculate(number, c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x78(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xea5(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x74(%rbp)
movl   $0x0,-0x80(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x74(%rbp),%eax
jge    120f <main+0xdf>
movslq -0x78(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x30,%eax
jl     11c7 <main+0x97>
movslq -0x78(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x39,%eax
jg     11c7 <main+0x97>
imul   $0xa,-0x80(%rbp),%eax
movslq -0x78(%rbp),%rcx
movsbl -0x70(%rbp,%rcx,1),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0x80(%rbp)
jmp    11fc <main+0xcc>
cmpl   $0x1,-0x84(%rbp)
jne    11e7 <main+0xb7>
mov    -0x80(%rbp),%edi
movsbl -0x79(%rbp),%esi
call   1040 <calculate@plt>
movl   $0x0,-0x80(%rbp)
movslq -0x78(%rbp),%rax
mov    -0x70(%rbp,%rax,1),%al
mov    %al,-0x79(%rbp)
movl   $0x1,-0x84(%rbp)
jmp    1201 <main+0xd1>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    117d <main+0x4d>
mov    -0x80(%rbp),%edi
movsbl -0x79(%rbp),%esi
call   1040 <calculate@plt>
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x68,%rsp
lea    0xec2(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%r14d
xor    %ebx,%ebx
xor    %ecx,%ecx
xor    %edi,%edi
jmp    1175 <main+0x45>
nopl   0x0(%rax)
movzbl %dl,%edx
lea    (%rdi,%rdi,4),%esi
lea    (%rdx,%rsi,2),%edi
add    $0xffffffd0,%edi
add    $0x1,%rbx
cmp    %rbx,%r14
je     11a9 <main+0x79>
movzbl (%rsp,%rbx,1),%edx
lea    -0x30(%rdx),%esi
cmp    $0x9,%sil
jbe    1160 <main+0x30>
cmp    $0x1,%ecx
jne    11a0 <main+0x70>
movsbl %al,%esi
call   1040 <calculate@plt>
movzbl (%rsp,%rbx,1),%eax
xor    %edi,%edi
jmp    11a2 <main+0x72>
nopw   0x0(%rax,%rax,1)
mov    %edx,%eax
mov    $0x1,%ecx
jmp    116c <main+0x3c>
movsbl %al,%esi
call   1040 <calculate@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%11 = call i32 @strlen(i8* %10)
store i32 %11, i32* %3
store i32 0, i32* %6
store i32 0, i32* %7
br label %12
12: ; preds = %53, %0
%13 = load i32, i32* %4
%14 = load i32, i32* %3
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %56
16: ; preds = %12
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp sge i32 %21, 48
br i1 %22, label %23, label %40
23: ; preds = %16
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp sle i32 %28, 57
br i1 %29, label %30, label %40
30: ; preds = %23
%31 = load i32, i32* %6
%32 = mul nsw i32 %31, 10
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = sub nsw i32 %37, 48
%39 = add nsw i32 %32, %38
store i32 %39, i32* %6
br label %52
40: ; preds = %23, %16
%41 = load i32, i32* %7
%42 = icmp eq i32 %41, 1
br i1 %42, label %43, label %47
43: ; preds = %40
%44 = load i32, i32* %6
%45 = load i8, i8* %5
%46 = call i32 @calculate(i32 %44, i8 signext %45)
store i32 0, i32* %6
br label %47
47: ; preds = %43, %40
%48 = load i32, i32* %4
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %49
%51 = load i8, i8* %50
store i8 %51, i8* %5
store i32 1, i32* %7
br label %52
52: ; preds = %47, %30
br label %53
53: ; preds = %52
%54 = load i32, i32* %4
%55 = add nsw i32 %54, 1
store i32 %55, i32* %4
br label %12
56: ; preds = %12
%57 = load i32, i32* %6
%58 = load i8, i8* %5
%59 = call i32 @calculate(i32 %57, i8 signext %58)
%60 = load i32, i32* %1
ret i32 %60
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @strlen(i8* %2)
%5 = icmp sgt i32 %4, 0
%6 = zext i32 %4 to i64
br label %7
7: ; preds = %0, %26
%8 = phi i64 [ 0, %0 ], [ %30, %26 ]
%9 = phi i32 [ 0, %0 ], [ %29, %26 ]
%10 = phi i32 [ 0, %0 ], [ %28, %26 ]
%11 = phi i8 [ undef, %0 ], [ %27, %26 ]
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %8
%13 = load i8, i8* %12
%14 = add i8 %13, -48
%15 = icmp ult i8 %14, 10
br i1 %15, label %16, label %21
16: ; preds = %7
%17 = zext i8 %13 to i32
%18 = mul nsw i32 %10, 10
%19 = add i32 %18, -48
%20 = add i32 %19, %17
br label %26
21: ; preds = %7
%22 = icmp eq i32 %9, 1
br i1 %22, label %23, label %26
23: ; preds = %21
%24 = call i32 @calculate(i32 %10, i8 signext %11)
%25 = load i8, i8* %12
br label %26
26: ; preds = %21, %23, %16
%27 = phi i8 [ %11, %16 ], [ %25, %23 ], [ %13, %21 ]
%28 = phi i32 [ %20, %16 ], [ 0, %23 ], [ %10, %21 ]
%29 = phi i32 [ %9, %16 ], [ 1, %23 ], [ 1, %21 ]
%30 = add nuw nsw i64 %8, 1
%31 = icmp eq i64 %30, %6
br i1 %31, label %32, label %7
32: ; preds = %26
%33 = call i32 @calculate(i32 %28, i8 signext %27)
ret i32 0
}