#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 */
struct node {
  int dummy;
};

/* Variables and functions */
struct node *parse_tree(char *, int *);
int /*<<< orphan*/ postorder(struct node *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ update_precedence();
int main() {
  int t, i;
  update_precedence();
  scanf("%d", &t);
  char str[101];
  struct node *expr;
  while (t--) {
    scanf("%s", str);
    i = 0;
    expr = parse_tree(str, &i);
    postorder(expr);
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <update_precedence@plt>
lea    0xe90(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11d9 <main+0x89>
lea    -0x80(%rbp),%rsi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
movl   $0x0,-0xc(%rbp)
lea    -0x80(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <parse_tree@plt>
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rdi
call   1050 <postorder@plt>
lea    0xe37(%rip),%rdi
call   1030 <printf@plt>
jmp    117b <main+0x2b>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
xor    %eax,%eax
call   1070 <update_precedence@plt>
lea    0xe96(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
subl   $0x1,0x8(%rsp)
jb     11c9 <main+0x79>
lea    0xe7f(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0xc(%rsp),%r15
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
movl   $0x0,0xc(%rsp)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <parse_tree@plt>
mov    %rax,%rdi
call   1050 <postorder@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
subl   $0x1,0x8(%rsp)
jae    1190 <main+0x40>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.node = type { i32 }
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [101 x i8]
%5 = alloca %struct.node*
store i32 0, i32* %1
%6 = call i32 (...) @update_precedence()
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %8
8: ; preds = %12, %0
%9 = load i32, i32* %2
%10 = add nsw i32 %9, -1
store i32 %10, i32* %2
%11 = icmp ne i32 %9, 0
br i1 %11, label %12, label %20
12: ; preds = %8
%13 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %13)
store i32 0, i32* %3
%15 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%16 = call %struct.node* @parse_tree(i8* %15, i32* %3)
store %struct.node* %16, %struct.node** %5
%17 = load %struct.node*, %struct.node** %5
%18 = call i32 @postorder(%struct.node* %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %8
20: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [101 x i8]
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = tail call i32 (...) @update_precedence()
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = getelementptr inbounds [101 x i8], [101 x i8]* %3, i64 0, i64 0
%9 = load i32, i32* %1
%10 = add nsw i32 %9, -1
store i32 %10, i32* %1
%11 = icmp eq i32 %9, 0
br i1 %11, label %20, label %12
12: ; preds = %0, %12
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
store i32 0, i32* %2
%14 = call %struct.node* @parse_tree(i8* %8, i32* %2)
%15 = call i32 @postorder(%struct.node* %14)
%16 = call i32 @putchar(i32 10)
%17 = load i32, i32* %1
%18 = add nsw i32 %17, -1
store i32 %18, i32* %1
%19 = icmp eq i32 %17, 0
br i1 %19, label %20, label %12
20: ; preds = %12, %0
ret i32 0
}