#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__ isalnum(char);
scalar_t__ isoperator(char);
int /*<<< orphan*/ postfix(char *, char *);
int /*<<< orphan*/ printf(char *, char);
void generate(char e[]) {
  char S[40], p[40];
  int t = 1;
  int i, a, b, top = -1;
  postfix(e, p);
  for (i = 0; p[i] != '\0'; i++) {
    if (isalnum(p[i]))
      S[++top] = p[i];
    if (isoperator(p[i])) {
      a = S[top--];
      b = S[top--];
      printf("T%d=", t);
      if (b < 30)
        printf("T%d", b);
      else
        printf("%c", b);
      printf("%c", p[i]);
      if (a < 30)
        printf("T%d\n", a);
      else
        printf("%c\n", a);
      S[++top] = t++;
    }
  }
  printf("T%d=", t);
  if (S[0] < 30)
    printf("T%d\n", S[0]);
  else
    printf("%c\n", S[0]);
}


x86 assembly (clang, -O0):
<generate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0x64(%rbp)
movl   $0xffffffff,-0x74(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <postfix@plt>
movl   $0x0,-0x68(%rbp)
movslq -0x68(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     12b0 <generate+0x170>
movslq -0x68(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%edi
call   1060 <isalnum@plt>
cmp    $0x0,%rax
je     11b2 <generate+0x72>
movslq -0x68(%rbp),%rax
mov    -0x60(%rbp,%rax,1),%cl
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
cltq
mov    %cl,-0x30(%rbp,%rax,1)
movslq -0x68(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%edi
call   1040 <isoperator@plt>
cmp    $0x0,%rax
je     129d <generate+0x15d>
mov    -0x74(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x74(%rbp)
cltq
movsbl -0x30(%rbp,%rax,1),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x74(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x74(%rbp)
cltq
movsbl -0x30(%rbp,%rax,1),%eax
mov    %eax,-0x70(%rbp)
mov    -0x64(%rbp),%eax
lea    0xe02(%rip),%rdi
movsbl %al,%esi
call   1050 <printf@plt>
cmpl   $0x1e,-0x70(%rbp)
jge    1227 <generate+0xe7>
mov    -0x70(%rbp),%eax
lea    0xdeb(%rip),%rdi
movsbl %al,%esi
call   1050 <printf@plt>
jmp    1239 <generate+0xf9>
mov    -0x70(%rbp),%eax
lea    0xdd8(%rip),%rdi
movsbl %al,%esi
call   1050 <printf@plt>
movslq -0x68(%rbp),%rax
lea    0xdc5(%rip),%rdi
movsbl -0x60(%rbp,%rax,1),%esi
call   1050 <printf@plt>
cmpl   $0x1e,-0x6c(%rbp)
jge    126f <generate+0x12f>
mov    -0x6c(%rbp),%eax
lea    0xdaa(%rip),%rdi
movsbl %al,%esi
call   1050 <printf@plt>
jmp    1281 <generate+0x141>
mov    -0x6c(%rbp),%eax
lea    0xd98(%rip),%rdi
movsbl %al,%esi
call   1050 <printf@plt>
mov    -0x64(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x64(%rbp)
mov    %al,%cl
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
cltq
mov    %cl,-0x30(%rbp,%rax,1)
jmp    12a2 <generate+0x162>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1171 <generate+0x31>
mov    -0x64(%rbp),%eax
lea    0xd46(%rip),%rdi
movsbl %al,%esi
call   1050 <printf@plt>
movsbl -0x30(%rbp),%eax
cmp    $0x1e,%eax
jge    12e4 <generate+0x1a4>
lea    0xd36(%rip),%rdi
movsbl -0x30(%rbp),%esi
call   1050 <printf@plt>
jmp    12f4 <generate+0x1b4>
lea    0xd26(%rip),%rdi
movsbl -0x30(%rbp),%esi
call   1050 <printf@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0x40(%rsp),%rbx
mov    %rbx,%rsi
call   1030 <postfix@plt>
mov    0x40(%rsp),%al
test   %al,%al
je     1287 <generate+0x147>
movl   $0x1,0x8(%rsp)
mov    $0xffffffff,%r14d
jmp    1190 <generate+0x50>
nopw   0x0(%rax,%rax,1)
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1246 <generate+0x106>
movsbl %al,%edi
call   1060 <isalnum@plt>
movzbl (%rbx),%ecx
test   %rax,%rax
je     11ac <generate+0x6c>
movslq %r14d,%r14
mov    %cl,0x11(%rsp,%r14,1)
add    $0x1,%r14
movsbl %cl,%edi
call   1040 <isoperator@plt>
test   %rax,%rax
je     1180 <generate+0x40>
movslq %r14d,%r12
lea    -0x1(%r12),%r14
movsbl 0x10(%rsp,%r12,1),%r13d
movsbl 0xf(%rsp,%r12,1),%ebp
mov    0x8(%rsp),%r15d
movsbl %r15b,%esi
mov    %esi,0xc(%rsp)
lea    0xe1f(%rip),%rdi
call   1050 <printf@plt>
cmp    $0x1e,%ebp
lea    0xe19(%rip),%rdi
lea    0xe0e(%rip),%rax
cmovl  %rax,%rdi
mov    %ebp,%esi
call   1050 <printf@plt>
movsbl (%rbx),%esi
lea    0xdfd(%rip),%rdi
call   1050 <printf@plt>
cmp    $0x1e,%r13d
lea    0xdf5(%rip),%rdi
lea    0xde9(%rip),%rax
cmovl  %rax,%rdi
mov    %r13d,%esi
call   1050 <printf@plt>
add    $0x1,%r15d
mov    %r15d,0x8(%rsp)
mov    0xc(%rsp),%eax
mov    %al,0xf(%rsp,%r12,1)
jmp    1180 <generate+0x40>
movsbl 0x10(%rsp),%ebx
movsbl 0x8(%rsp),%esi
lea    0xda9(%rip),%rdi
call   1050 <printf@plt>
cmp    $0x1e,%ebx
lea    0xdab(%rip),%rdi
lea    0xd9f(%rip),%rax
cmovl  %rax,%rdi
mov    %ebx,%esi
call   1050 <printf@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd72(%rip),%rdi
mov    $0x1,%esi
call   1050 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"T%d=\00"
@.str.1 = [4 x i8] c"T%d\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [5 x i8] c"T%d\0A\00"
@.str.4 = [4 x i8] c"%c\0A\00"
define void @generate(i8* %0) {
%2 = alloca i8*
%3 = alloca [40 x i8]
%4 = alloca [40 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %2
store i32 1, i32* %5
store i32 -1, i32* %9
%10 = load i8*, i8** %2
%11 = getelementptr inbounds [40 x i8], [40 x i8]* %4, i64 0, i64 0
%12 = call i32 @postfix(i8* %10, i8* %11)
store i32 0, i32* %6
br label %13
13: ; preds = %94, %1
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [40 x i8], [40 x i8]* %4, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %97
20: ; preds = %13
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [40 x i8], [40 x i8]* %4, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = call i64 @isalnum(i8 signext %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %36
27: ; preds = %20
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [40 x i8], [40 x i8]* %4, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = load i32, i32* %9
%33 = add nsw i32 %32, 1
store i32 %33, i32* %9
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 %34
store i8 %31, i8* %35
br label %36
36: ; preds = %27, %20
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [40 x i8], [40 x i8]* %4, i64 0, i64 %38
%40 = load i8, i8* %39
%41 = call i64 @isoperator(i8 signext %40)
%42 = icmp ne i64 %41, 0
br i1 %42, label %43, label %93
43: ; preds = %36
%44 = load i32, i32* %9
%45 = add nsw i32 %44, -1
store i32 %45, i32* %9
%46 = sext i32 %44 to i64
%47 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
store i32 %49, i32* %7
%50 = load i32, i32* %9
%51 = add nsw i32 %50, -1
store i32 %51, i32* %9
%52 = sext i32 %50 to i64
%53 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 %52
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
store i32 %55, i32* %8
%56 = load i32, i32* %5
%57 = trunc i32 %56 to i8
%58 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext %57)
%59 = load i32, i32* %8
%60 = icmp slt i32 %59, 30
br i1 %60, label %61, label %65
61: ; preds = %43
%62 = load i32, i32* %8
%63 = trunc i32 %62 to i8
%64 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %63)
br label %69
65: ; preds = %43
%66 = load i32, i32* %8
%67 = trunc i32 %66 to i8
%68 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8 signext %67)
br label %69
69: ; preds = %65, %61
%70 = load i32, i32* %6
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [40 x i8], [40 x i8]* %4, i64 0, i64 %71
%73 = load i8, i8* %72
%74 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8 signext %73)
%75 = load i32, i32* %7
%76 = icmp slt i32 %75, 30
br i1 %76, label %77, label %81
77: ; preds = %69
%78 = load i32, i32* %7
%79 = trunc i32 %78 to i8
%80 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8 signext %79)
br label %85
81: ; preds = %69
%82 = load i32, i32* %7
%83 = trunc i32 %82 to i8
%84 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8 signext %83)
br label %85
85: ; preds = %81, %77
%86 = load i32, i32* %5
%87 = add nsw i32 %86, 1
store i32 %87, i32* %5
%88 = trunc i32 %86 to i8
%89 = load i32, i32* %9
%90 = add nsw i32 %89, 1
store i32 %90, i32* %9
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 %91
store i8 %88, i8* %92
br label %93
93: ; preds = %85, %36
br label %94
94: ; preds = %93
%95 = load i32, i32* %6
%96 = add nsw i32 %95, 1
store i32 %96, i32* %6
br label %13
97: ; preds = %13
%98 = load i32, i32* %5
%99 = trunc i32 %98 to i8
%100 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext %99)
%101 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 0
%102 = load i8, i8* %101
%103 = sext i8 %102 to i32
%104 = icmp slt i32 %103, 30
br i1 %104, label %105, label %109
105: ; preds = %97
%106 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 0
%107 = load i8, i8* %106
%108 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8 signext %107)
br label %113
109: ; preds = %97
%110 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 0
%111 = load i8, i8* %110
%112 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8 signext %111)
br label %113
113: ; preds = %109, %105
ret void
}

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