#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 */
scalar_t__ EOF;
scalar_t__ pop();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ push(int);
scalar_t__ scanf(char *, char *);
int /*<<< orphan*/ stackinit();
int main() {
  char c;
  for (stackinit(); scanf("%1s", &c) != EOF;) {
    if (c == ')')
      printf("%1c", (char)pop());
    if (c == '+')
      push((int)c);
    if (c == '*')
      push((int)c);
    while (c >= '0' && c <= '9') {
      printf("%1c", c);
      scanf("%1c", &c);
    }
    if (c == '(')
      printf(" ");
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <stackinit@plt>
lea    0xe93(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1060 <scanf@plt>
mov    0x2e6b(%rip),%rcx
cmp    (%rcx),%rax
je     1252 <main+0x102>
movsbl -0x5(%rbp),%eax
cmp    $0x29,%eax
jne    11ab <main+0x5b>
mov    $0x0,%al
call   1050 <pop@plt>
movsbl %al,%esi
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x2b,%eax
jne    11c1 <main+0x71>
movsbl -0x5(%rbp),%edi
call   1070 <push@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x2a,%eax
jne    11d7 <main+0x87>
movsbl -0x5(%rbp),%edi
call   1070 <push@plt>
jmp    11dc <main+0x8c>
movsbl -0x5(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x6(%rbp)
jl     11fb <main+0xab>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
test   $0x1,%al
jne    120b <main+0xbb>
jmp    1232 <main+0xe2>
movsbl -0x5(%rbp),%esi
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xde0(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1060 <scanf@plt>
jmp    11dc <main+0x8c>
movsbl -0x5(%rbp),%eax
cmp    $0x28,%eax
jne    124d <main+0xfd>
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1166 <main+0x16>
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <stackinit@plt>
lea    0xe8a(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x2e61(%rip),%r12
cmp    (%r12),%rax
jne    11a5 <main+0x45>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xe58(%rip),%rbx
lea    0x7(%rsp),%r14
lea    0xe48(%rip),%r15
jmp    11d1 <main+0x71>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r14,%rsi
call   1070 <scanf@plt>
cmp    (%r12),%rax
je     118d <main+0x2d>
mov    0x7(%rsp),%al
cmp    $0x29,%al
je     1240 <main+0xe0>
cmp    $0x2b,%al
je     125c <main+0xfc>
cmp    $0x2a,%al
jne    11ef <main+0x8f>
mov    $0x2a,%edi
call   1080 <push@plt>
mov    0x7(%rsp),%al
lea    -0x30(%rax),%ecx
cmp    $0x9,%cl
ja     1225 <main+0xc5>
nopw   0x0(%rax,%rax,1)
movzbl %al,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <scanf@plt>
movzbl 0x7(%rsp),%eax
lea    -0x30(%rax),%ecx
cmp    $0xa,%cl
jb     1200 <main+0xa0>
cmp    $0x28,%al
jne    11c0 <main+0x60>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    11c0 <main+0x60>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1060 <pop@plt>
movsbl %al,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x7(%rsp),%al
cmp    $0x2b,%al
jne    11dd <main+0x7d>
mov    $0x2b,%edi
call   1080 <push@plt>
mov    0x7(%rsp),%al
cmp    $0x2a,%al
je     11e1 <main+0x81>
jmp    11ef <main+0x8f>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%1s\00"
@EOF = global i64 0
@.str.1 = [4 x i8] c"%1c\00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 (...) @stackinit()
%3 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %49, label %6
6: ; preds = %0, %45
%7 = load i8, i8* %1
%8 = icmp eq i8 %7, 41
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = call i64 (...) @pop()
%11 = trunc i64 %10 to i32
%12 = shl i32 %11, 24
%13 = ashr exact i32 %12, 24
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = load i8, i8* %1
br label %16
16: ; preds = %9, %6
%17 = phi i8 [ %15, %9 ], [ %7, %6 ]
%18 = icmp eq i8 %17, 43
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = call i32 @push(i32 43)
%21 = load i8, i8* %1
br label %22
22: ; preds = %19, %16
%23 = phi i8 [ %21, %19 ], [ %17, %16 ]
%24 = icmp eq i8 %23, 42
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = call i32 @push(i32 42)
%27 = load i8, i8* %1
br label %28
28: ; preds = %25, %22
%29 = phi i8 [ %27, %25 ], [ %23, %22 ]
%30 = add i8 %29, -48
%31 = icmp ult i8 %30, 10
br i1 %31, label %32, label %40
32: ; preds = %28, %32
%33 = phi i8 [ %37, %32 ], [ %29, %28 ]
%34 = zext i8 %33 to i32
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%37 = load i8, i8* %1
%38 = add i8 %37, -48
%39 = icmp ult i8 %38, 10
br i1 %39, label %32, label %40
40: ; preds = %32, %28
%41 = phi i8 [ %29, %28 ], [ %37, %32 ]
%42 = icmp eq i8 %41, 40
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 @putchar(i32 32)
br label %45
45: ; preds = %43, %40
%46 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
%47 = load i64, i64* @EOF
%48 = icmp eq i64 %46, %47
br i1 %48, label %49, label %6
49: ; preds = %45, %0
%50 = call i32 @putchar(i32 10)
ret i32 0
}