#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*/ convertToRPN(char *);
int /*<<< orphan*/ exit(int);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ scanf(char *, ...);
int main(int argc, char **argv) {
  int i, count, size;
  char *x;
  scanf("%d", &count);
  if (count > 100) {
    exit(1);
  }
  size = sizeof(char) * 401 * count;
  x = (char *)malloc(size);
  memset(x, 0, size);
  for (i = 0; i < count; i++) {
    scanf("%s", x + (i * 401));
  }
  for (i = 0; i < count; i++) {
    char *p = x + (i * 401);
    convertToRPN(p);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe93(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
cmpl   $0x64,-0x18(%rbp)
jle    118c <main+0x3c>
mov    $0x1,%edi
call   1070 <exit@plt>
movslq -0x18(%rbp),%rax
imul   $0x191,%rax,%rax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%edx
xor    %esi,%esi
call   1040 <memset@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11f3 <main+0xa3>
mov    -0x28(%rbp),%rsi
imul   $0x191,-0x14(%rbp),%eax
cltq
add    %rax,%rsi
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11bb <main+0x6b>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1232 <main+0xe2>
mov    -0x28(%rbp),%rax
imul   $0x191,-0x14(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1030 <convertToRPN@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11fa <main+0xaa>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xea1(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x65,%eax
jge    120b <main+0xbb>
imul   $0x191,%eax,%ebx
mov    %ebx,%edi
call   1050 <malloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   1040 <memset@plt>
cmpl   $0x0,0x4(%rsp)
jle    11fd <main+0xad>
lea    0xe61(%rip),%r14
mov    %r15,%r12
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
add    $0x191,%r12
cmp    %rax,%rbx
jl     11b0 <main+0x60>
test   %eax,%eax
jle    11fd <main+0xad>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1030 <convertToRPN@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
add    $0x191,%r15
cmp    %rax,%rbx
jl     11e0 <main+0x90>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    $0x1,%edi
call   1070 <exit@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = icmp sgt i32 %6, 100
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = mul i32 %6, 401
%12 = call i64 @malloc(i32 %11)
%13 = inttoptr i64 %12 to i8*
%14 = call i32 @memset(i8* %13, i32 0, i32 %11)
%15 = load i32, i32* %3
%16 = icmp sgt i32 %15, 0
br i1 %16, label %19, label %37
17: ; preds = %19
%18 = icmp sgt i32 %25, 0
br i1 %18, label %28, label %37
19: ; preds = %10, %19
%20 = phi i64 [ %24, %19 ], [ 0, %10 ]
%21 = mul nuw nsw i64 %20, 401
%22 = getelementptr inbounds i8, i8* %13, i64 %21
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = add nuw nsw i64 %20, 1
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = icmp slt i64 %24, %26
br i1 %27, label %19, label %17
28: ; preds = %17, %28
%29 = phi i64 [ %33, %28 ], [ 0, %17 ]
%30 = mul nuw nsw i64 %29, 401
%31 = getelementptr inbounds i8, i8* %13, i64 %30
%32 = call i32 @convertToRPN(i8* %31)
%33 = add nuw nsw i64 %29, 1
%34 = load i32, i32* %3
%35 = sext i32 %34 to i64
%36 = icmp slt i64 %33, %35
br i1 %36, label %28, label %37
37: ; preds = %28, %10, %17
ret i32 0
}