#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 stack {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ gets(char *);
scalar_t__ pivot(char);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
struct stack *stack_create(int);
char stack_get_top(struct stack *);
int /*<<< orphan*/ stack_is_empty(struct stack *);
int /*<<< orphan*/ stack_pop(struct stack *);
int /*<<< orphan*/ stack_push(struct stack *, char);
int strlen(char *);
int main(int argc, char **argv) {
  int lines;
  char input[1000];
  char output[1000];
  scanf("%d", &lines);
  getchar();
  while (lines--) {
    gets(input);
    int i, j, length = strlen(input);
    struct stack *s = stack_create(length);
    for (i = j = 0; i < length; i++) {
      if (input[i] <= '9' && input[i] >= '0')
        output[j++] = input[i];
      else if (input[i] == '(')
        stack_push(s, '(');
      else if (input[i] == ')') {
        char op;
        while ((op = stack_get_top(s)) != '(') {
          output[j++] = op;
          stack_pop(s);
        }
        stack_pop(s);
      } else {
        char op;
        while (!stack_is_empty(s)) {
          op = stack_get_top(s);
          if (pivot(op) >= pivot(input[i])) {
            output[j++] = op;
            stack_pop(s);
          } else
            break;
        }
        stack_push(s, input[i]);
      }
    }
    while (!stack_is_empty(s)) {
      output[j++] = stack_get_top(s);
      stack_pop(s);
    }
    output[j] = '\0';
    puts(output);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe30(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1090 <scanf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     14bc <main+0x30c>
lea    -0x400(%rbp),%rdi
call   1080 <gets@plt>
lea    -0x400(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x7fc(%rbp)
mov    -0x7fc(%rbp),%edi
call   1060 <stack_create@plt>
mov    %rax,-0x808(%rbp)
movl   $0x0,-0x7f8(%rbp)
movl   $0x0,-0x7f4(%rbp)
mov    -0x7f4(%rbp),%eax
cmp    -0x7fc(%rbp),%eax
jge    143d <main+0x28d>
movslq -0x7f4(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%eax
ff
cmp    $0x39,%eax
jg     12a7 <main+0xf7>
movslq -0x7f4(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%eax
ff
cmp    $0x30,%eax
jl     12a7 <main+0xf7>
movslq -0x7f4(%rbp),%rax
mov    -0x400(%rbp,%rax,1),%cl
mov    -0x7f8(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x7f8(%rbp)
cltq
mov    %cl,-0x7f0(%rbp,%rax,1)
jmp    1424 <main+0x274>
movslq -0x7f4(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%eax
ff
cmp    $0x28,%eax
jne    12d5 <main+0x125>
mov    -0x808(%rbp),%rdi
mov    $0x28,%esi
call   10c0 <stack_push@plt>
jmp    141f <main+0x26f>
movslq -0x7f4(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%eax
ff
cmp    $0x29,%eax
jne    1352 <main+0x1a2>
jmp    12f2 <main+0x142>
mov    -0x808(%rbp),%rdi
call   1070 <stack_get_top@plt>
mov    %al,-0x809(%rbp)
movsbl %al,%eax
cmp    $0x28,%eax
je     1341 <main+0x191>
mov    -0x809(%rbp),%cl
mov    -0x7f8(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x7f8(%rbp)
cltq
mov    %cl,-0x7f0(%rbp,%rax,1)
mov    -0x808(%rbp),%rdi
call   10d0 <stack_pop@plt>
jmp    12f2 <main+0x142>
mov    -0x808(%rbp),%rdi
call   10d0 <stack_pop@plt>
jmp    141a <main+0x26a>
jmp    1357 <main+0x1a7>
mov    -0x808(%rbp),%rdi
call   10b0 <stack_is_empty@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1378 <main+0x1c8>
jmp    13ff <main+0x24f>
mov    -0x808(%rbp),%rdi
call   1070 <stack_get_top@plt>
mov    %al,-0x80a(%rbp)
movsbl -0x80a(%rbp),%edi
call   10a0 <pivot@plt>
mov    %rax,-0x818(%rbp)
movslq -0x7f4(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%edi
ff
call   10a0 <pivot@plt>
mov    %rax,%rcx
mov    -0x818(%rbp),%rax
cmp    %rcx,%rax
jl     13f5 <main+0x245>
mov    -0x80a(%rbp),%cl
mov    -0x7f8(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x7f8(%rbp)
cltq
mov    %cl,-0x7f0(%rbp,%rax,1)
mov    -0x808(%rbp),%rdi
call   10d0 <stack_pop@plt>
jmp    13fa <main+0x24a>
jmp    13ff <main+0x24f>
jmp    1357 <main+0x1a7>
mov    -0x808(%rbp),%rdi
movslq -0x7f4(%rbp),%rax
movsbl -0x400(%rbp,%rax,1),%esi
ff
call   10c0 <stack_push@plt>
jmp    141f <main+0x26f>
jmp    1424 <main+0x274>
jmp    1429 <main+0x279>
mov    -0x7f4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7f4(%rbp)
jmp    1238 <main+0x88>
jmp    1442 <main+0x292>
mov    -0x808(%rbp),%rdi
call   10b0 <stack_is_empty@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1463 <main+0x2b3>
jmp    149c <main+0x2ec>
mov    -0x808(%rbp),%rdi
call   1070 <stack_get_top@plt>
mov    %al,%cl
mov    -0x7f8(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x7f8(%rbp)
cltq
mov    %cl,-0x7f0(%rbp,%rax,1)
mov    -0x808(%rbp),%rdi
call   10d0 <stack_pop@plt>
jmp    1442 <main+0x292>
movslq -0x7f8(%rbp),%rax
movb   $0x0,-0x7f0(%rbp,%rax,1)
lea    -0x7f0(%rbp),%rdi
call   1030 <puts@plt>
jmp    11e0 <main+0x30>
xor    %eax,%eax
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x7e8,%rsp
lea    0xe38(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1090 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
jmp    11f2 <main+0x42>
nopl   0x0(%rax,%rax,1)
movslq %ebp,%rax
movb   $0x0,0x10(%rsp,%rax,1)
lea    0x10(%rsp),%rdi
call   1030 <puts@plt>
subl   $0x1,0xc(%rsp)
jb     137a <main+0x1ca>
lea    0x400(%rsp),%rbx
mov    %rbx,%rdi
call   1080 <gets@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1060 <stack_create@plt>
mov    %rax,%r12
test   %ebx,%ebx
jle    1330 <main+0x180>
mov    %ebx,%r14d
xor    %r15d,%r15d
xor    %ebp,%ebp
jmp    1257 <main+0xa7>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movslq %ebp,%rcx
add    $0x1,%ebp
mov    %al,0x10(%rsp,%rcx,1)
add    $0x1,%r15
cmp    %r14,%r15
je     1332 <main+0x182>
mov    0x400(%rsp,%r15,1),%al
lea    -0x30(%rax),%ecx
cmp    $0x9,%cl
jbe    1240 <main+0x90>
mov    %r12,%rdi
cmp    $0x28,%al
je     12b7 <main+0x107>
cmp    $0x29,%al
jne    12be <main+0x10e>
call   1070 <stack_get_top@plt>
cmp    $0x28,%al
je     12ad <main+0xfd>
movslq %ebp,%rcx
lea    (%rsp,%rcx,1),%rbx
add    $0x10,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %al,(%rbx)
mov    %r12,%rdi
call   10d0 <stack_pop@plt>
mov    %r12,%rdi
call   1070 <stack_get_top@plt>
add    $0x1,%rbx
add    $0x1,%ebp
cmp    $0x28,%al
jne    1290 <main+0xe0>
mov    %r12,%rdi
call   10d0 <stack_pop@plt>
jmp    124a <main+0x9a>
mov    $0x28,%esi
jmp    1320 <main+0x170>
call   10b0 <stack_is_empty@plt>
test   %eax,%eax
jne    1314 <main+0x164>
movslq %ebp,%rbp
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1070 <stack_get_top@plt>
mov    %eax,%ebx
movsbl %al,%edi
call   10a0 <pivot@plt>
mov    %rax,%r13
movsbl 0x400(%rsp,%r15,1),%edi
call   10a0 <pivot@plt>
cmp    %rax,%r13
jl     1314 <main+0x164>
mov    %bl,0x10(%rsp,%rbp,1)
add    $0x1,%rbp
mov    %r12,%rdi
call   10d0 <stack_pop@plt>
mov    %r12,%rdi
call   10b0 <stack_is_empty@plt>
test   %eax,%eax
je     12d0 <main+0x120>
movsbl 0x400(%rsp,%r15,1),%esi
mov    %r12,%rdi
call   10c0 <stack_push@plt>
jmp    124a <main+0x9a>
nopw   0x0(%rax,%rax,1)
xor    %ebp,%ebp
mov    %r12,%rdi
call   10b0 <stack_is_empty@plt>
test   %eax,%eax
jne    11e0 <main+0x30>
movslq %ebp,%rax
lea    (%rsp,%rax,1),%rbx
add    $0x10,%rbx
nopl   (%rax)
mov    %r12,%rdi
call   1070 <stack_get_top@plt>
mov    %al,(%rbx)
mov    %r12,%rdi
call   10d0 <stack_pop@plt>
mov    %r12,%rdi
call   10b0 <stack_is_empty@plt>
add    $0x1,%rbx
add    $0x1,%ebp
test   %eax,%eax
je     1350 <main+0x1a0>
jmp    11e0 <main+0x30>
xor    %eax,%eax
add    $0x7e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stack = type { i32 }
@.str = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [1000 x i8]
%8 = alloca [1000 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca %struct.stack*
%13 = alloca i8
%14 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%16 = call i32 (...) @getchar()
br label %17
17: ; preds = %144, %2
%18 = load i32, i32* %6
%19 = add nsw i32 %18, -1
store i32 %19, i32* %6
%20 = icmp ne i32 %18, 0
br i1 %20, label %21, label %150
21: ; preds = %17
%22 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%23 = call i32 @gets(i8* %22)
%24 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%25 = call i32 @strlen(i8* %24)
store i32 %25, i32* %11
%26 = load i32, i32* %11
%27 = call %struct.stack* @stack_create(i32 %26)
store %struct.stack* %27, %struct.stack** %12
store i32 0, i32* %10
store i32 0, i32* %9
br label %28
28: ; preds = %126, %21
%29 = load i32, i32* %9
%30 = load i32, i32* %11
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %129
32: ; preds = %28
%33 = load i32, i32* %9
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp sle i32 %37, 57
br i1 %38, label %39, label %55
39: ; preds = %32
%40 = load i32, i32* %9
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp sge i32 %44, 48
br i1 %45, label %46, label %55
46: ; preds = %39
%47 = load i32, i32* %9
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 %48
%50 = load i8, i8* %49
%51 = load i32, i32* %10
%52 = add nsw i32 %51, 1
store i32 %52, i32* %10
%53 = sext i32 %51 to i64
%54 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 %53
store i8 %50, i8* %54
br label %125
55: ; preds = %39, %32
%56 = load i32, i32* %9
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 %57
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = icmp eq i32 %60, 40
br i1 %61, label %62, label %65
62: ; preds = %55
%63 = load %struct.stack*, %struct.stack** %12
%64 = call i32 @stack_push(%struct.stack* %63, i8 signext 40)
br label %124
65: ; preds = %55
%66 = load i32, i32* %9
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 %67
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp eq i32 %70, 41
br i1 %71, label %72, label %89
72: ; preds = %65
br label %73
73: ; preds = %78, %72
%74 = load %struct.stack*, %struct.stack** %12
%75 = call signext i8 @stack_get_top(%struct.stack* %74)
store i8 %75, i8* %13
%76 = sext i8 %75 to i32
%77 = icmp ne i32 %76, 40
br i1 %77, label %78, label %86
78: ; preds = %73
%79 = load i8, i8* %13
%80 = load i32, i32* %10
%81 = add nsw i32 %80, 1
store i32 %81, i32* %10
%82 = sext i32 %80 to i64
%83 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 %82
store i8 %79, i8* %83
%84 = load %struct.stack*, %struct.stack** %12
%85 = call i32 @stack_pop(%struct.stack* %84)
br label %73
86: ; preds = %73
%87 = load %struct.stack*, %struct.stack** %12
%88 = call i32 @stack_pop(%struct.stack* %87)
br label %123
89: ; preds = %65
br label %90
90: ; preds = %115, %89
%91 = load %struct.stack*, %struct.stack** %12
%92 = call i32 @stack_is_empty(%struct.stack* %91)
%93 = icmp ne i32 %92, 0
%94 = xor i1 %93, true
br i1 %94, label %95, label %116
95: ; preds = %90
%96 = load %struct.stack*, %struct.stack** %12
%97 = call signext i8 @stack_get_top(%struct.stack* %96)
store i8 %97, i8* %14
%98 = load i8, i8* %14
%99 = call i64 @pivot(i8 signext %98)
%100 = load i32, i32* %9
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 %101
%103 = load i8, i8* %102
%104 = call i64 @pivot(i8 signext %103)
%105 = icmp sge i64 %99, %104
br i1 %105, label %106, label %114
106: ; preds = %95
%107 = load i8, i8* %14
%108 = load i32, i32* %10
%109 = add nsw i32 %108, 1
store i32 %109, i32* %10
%110 = sext i32 %108 to i64
%111 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 %110
store i8 %107, i8* %111
%112 = load %struct.stack*, %struct.stack** %12
%113 = call i32 @stack_pop(%struct.stack* %112)
br label %115
114: ; preds = %95
br label %116
115: ; preds = %106
br label %90
116: ; preds = %114, %90
%117 = load %struct.stack*, %struct.stack** %12
%118 = load i32, i32* %9
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 %119
%121 = load i8, i8* %120
%122 = call i32 @stack_push(%struct.stack* %117, i8 signext %121)
br label %123
123: ; preds = %116, %86
br label %124
124: ; preds = %123, %62
br label %125
125: ; preds = %124, %46
br label %126
126: ; preds = %125
%127 = load i32, i32* %9
%128 = add nsw i32 %127, 1
store i32 %128, i32* %9
br label %28
129: ; preds = %28
br label %130
130: ; preds = %135, %129
%131 = load %struct.stack*, %struct.stack** %12
%132 = call i32 @stack_is_empty(%struct.stack* %131)
%133 = icmp ne i32 %132, 0
%134 = xor i1 %133, true
br i1 %134, label %135, label %144
135: ; preds = %130
%136 = load %struct.stack*, %struct.stack** %12
%137 = call signext i8 @stack_get_top(%struct.stack* %136)
%138 = load i32, i32* %10
%139 = add nsw i32 %138, 1
store i32 %139, i32* %10
%140 = sext i32 %138 to i64
%141 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 %140
store i8 %137, i8* %141
%142 = load %struct.stack*, %struct.stack** %12
%143 = call i32 @stack_pop(%struct.stack* %142)
br label %130
144: ; preds = %130
%145 = load i32, i32* %10
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 %146
store i8 0, i8* %147
%148 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%149 = call i32 @puts(i8* %148)
br label %17
150: ; preds = %17
ret i32 0
}

LLVM IR (-O2):
%struct.stack = type { i32 }
@.str = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [1000 x i8]
%5 = alloca [1000 x i8]
%6 = bitcast i32* %3 to i8*
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = call i32 (...) @getchar()
%11 = load i32, i32* %3
%12 = add nsw i32 %11, -1
store i32 %12, i32* %3
%13 = icmp eq i32 %11, 0
br i1 %13, label %106, label %14
14: ; preds = %2, %98
%15 = call i32 @gets(i8* %7)
%16 = call i32 @strlen(i8* %7)
%17 = call %struct.stack* @stack_create(i32 %16)
%18 = icmp sgt i32 %16, 0
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = zext i32 %16 to i64
br label %27
21: ; preds = %84, %14
%22 = phi i32 [ 0, %14 ], [ %85, %84 ]
%23 = call i32 @stack_is_empty(%struct.stack* %17)
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %98
25: ; preds = %21
%26 = sext i32 %22 to i64
br label %88
27: ; preds = %19, %84
%28 = phi i64 [ 0, %19 ], [ %86, %84 ]
%29 = phi i32 [ 0, %19 ], [ %85, %84 ]
%30 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 %28
%31 = load i8, i8* %30
%32 = add i8 %31, -48
%33 = icmp ult i8 %32, 10
br i1 %33, label %34, label %38
34: ; preds = %27
%35 = add nsw i32 %29, 1
%36 = sext i32 %29 to i64
%37 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %36
store i8 %31, i8* %37
br label %84
38: ; preds = %27
switch i8 %31, label %44 [
i8 40, label %49
i8 41, label %39
]
39: ; preds = %38
%40 = call signext i8 @stack_get_top(%struct.stack* %17)
%41 = icmp eq i8 %40, 40
br i1 %41, label %61, label %42
42: ; preds = %39
%43 = sext i32 %29 to i64
br label %51
44: ; preds = %38
%45 = call i32 @stack_is_empty(%struct.stack* %17)
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %80
47: ; preds = %44
%48 = sext i32 %29 to i64
br label %64
49: ; preds = %38
%50 = call i32 @stack_push(%struct.stack* %17, i8 signext 40)
br label %84
51: ; preds = %42, %51
%52 = phi i64 [ %43, %42 ], [ %54, %51 ]
%53 = phi i8 [ %40, %42 ], [ %57, %51 ]
%54 = add i64 %52, 1
%55 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %52
store i8 %53, i8* %55
%56 = call i32 @stack_pop(%struct.stack* %17)
%57 = call signext i8 @stack_get_top(%struct.stack* %17)
%58 = icmp eq i8 %57, 40
br i1 %58, label %59, label %51
59: ; preds = %51
%60 = trunc i64 %54 to i32
br label %61
61: ; preds = %59, %39
%62 = phi i32 [ %29, %39 ], [ %60, %59 ]
%63 = call i32 @stack_pop(%struct.stack* %17)
br label %84
64: ; preds = %47, %71
%65 = phi i64 [ %48, %47 ], [ %72, %71 ]
%66 = call signext i8 @stack_get_top(%struct.stack* %17)
%67 = call i64 @pivot(i8 signext %66)
%68 = load i8, i8* %30
%69 = call i64 @pivot(i8 signext %68)
%70 = icmp slt i64 %67, %69
br i1 %70, label %77, label %71
71: ; preds = %64
%72 = add i64 %65, 1
%73 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %65
store i8 %66, i8* %73
%74 = call i32 @stack_pop(%struct.stack* %17)
%75 = call i32 @stack_is_empty(%struct.stack* %17)
%76 = icmp eq i32 %75, 0
br i1 %76, label %64, label %77
77: ; preds = %64, %71
%78 = phi i64 [ %72, %71 ], [ %65, %64 ]
%79 = trunc i64 %78 to i32
br label %80
80: ; preds = %77, %44
%81 = phi i32 [ %29, %44 ], [ %79, %77 ]
%82 = load i8, i8* %30
%83 = call i32 @stack_push(%struct.stack* %17, i8 signext %82)
br label %84
84: ; preds = %34, %61, %80, %49
%85 = phi i32 [ %35, %34 ], [ %29, %49 ], [ %62, %61 ], [ %81, %80 ]
%86 = add nuw nsw i64 %28, 1
%87 = icmp eq i64 %86, %20
br i1 %87, label %21, label %27
88: ; preds = %25, %88
%89 = phi i64 [ %26, %25 ], [ %91, %88 ]
%90 = call signext i8 @stack_get_top(%struct.stack* %17)
%91 = add i64 %89, 1
%92 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %89
store i8 %90, i8* %92
%93 = call i32 @stack_pop(%struct.stack* %17)
%94 = call i32 @stack_is_empty(%struct.stack* %17)
%95 = icmp eq i32 %94, 0
br i1 %95, label %88, label %96
96: ; preds = %88
%97 = trunc i64 %91 to i32
br label %98
98: ; preds = %96, %21
%99 = phi i32 [ %22, %21 ], [ %97, %96 ]
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 %100
store i8 0, i8* %101
%102 = call i32 @puts(i8* %8)
%103 = load i32, i32* %3
%104 = add nsw i32 %103, -1
store i32 %104, i32* %3
%105 = icmp eq i32 %103, 0
br i1 %105, label %106, label %14
106: ; preds = %98, %2
ret i32 0
}