#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char **);
int /*<<< orphan*/ toprefix(char *);
int main() {
  char infix[100], postfix[100], rev[100];
  printf("\nenter the infix expression :");
  scanf("%s", &infix);
  int i = 0;
  int top = 0;
  while (infix[i] != '\0') {
    top++;
    i++;
  }
  rev[top] = '\0';
  top--;
  i = 0;
  while (infix[i] != '\0') {
    rev[top] = infix[i];
    i++;
    top--;
  }
  printf("%d", top);
  printf("%s", rev);
  toprefix(rev);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xec3(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0x154(%rbp)
movl   $0x0,-0x158(%rbp)
movslq -0x154(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11ac <main+0x7c>
mov    -0x158(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x158(%rbp)
mov    -0x154(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x154(%rbp)
jmp    1174 <main+0x44>
movslq -0x158(%rbp),%rax
movb   $0x0,-0x150(%rbp,%rax,1)
mov    -0x158(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x158(%rbp)
movl   $0x0,-0x154(%rbp)
movslq -0x154(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1225 <main+0xf5>
movslq -0x154(%rbp),%rax
mov    -0x70(%rbp,%rax,1),%cl
movslq -0x158(%rbp),%rax
mov    %cl,-0x150(%rbp,%rax,1)
mov    -0x154(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x154(%rbp)
mov    -0x158(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x158(%rbp)
jmp    11d4 <main+0xa4>
mov    -0x158(%rbp),%esi
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x150(%rbp),%rsi
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x150(%rbp),%rdi
call   1050 <toprefix@plt>
mov    -0x4(%rbp),%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xe0,%rsp
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    0x70(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x70(%rsp),%al
test   %al,%al
je     11b7 <main+0x87>
mov    $0x1,%edx
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
mov    %edx,%ecx
cmpb   $0x0,0x71(%rsp,%rsi,1)
lea    0x1(%rsi),%rsi
lea    0x1(%rcx),%edx
jne    1170 <main+0x40>
mov    %esi,%edx
movb   $0x0,(%rsp,%rdx,1)
test   %al,%al
je     11c2 <main+0x92>
mov    %ecx,%ecx
lea    (%rsp,%rcx,1),%rdx
add    $0xffffffffffffffff,%rdx
mov    $0x1,%ecx
nopl   0x0(%rax)
mov    %al,(%rdx)
movzbl 0x70(%rsp,%rcx,1),%eax
add    $0x1,%rcx
add    $0xffffffffffffffff,%rdx
test   %al,%al
jne    11a0 <main+0x70>
sub    %ecx,%esi
jmp    11c5 <main+0x95>
movb   $0x0,(%rsp)
mov    $0xffffffff,%esi
jmp    11c5 <main+0x95>
add    $0xffffffff,%esi
lea    0xe55(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe44(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1050 <toprefix@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [30 x i8] c"\0Aenter the infix expression :\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%6 = bitcast [100 x i8]* %1 to i8**
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %6)
%8 = load i8, i8* %3
%9 = icmp eq i8 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
store i8 0, i8* %11
br label %37
12: ; preds = %0, %12
%13 = phi i64 [ %14, %12 ], [ 0, %0 ]
%14 = add nuw nsw i64 %13, 1
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %12
18: ; preds = %12
%19 = trunc i64 %14 to i32
%20 = and i64 %14, 4294967295
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %20
store i8 0, i8* %21
%22 = add nsw i32 %19, -1
br i1 %9, label %37, label %23
23: ; preds = %18
%24 = add nsw i64 %20, -1
br label %25
25: ; preds = %23, %25
%26 = phi i64 [ 0, %23 ], [ %30, %25 ]
%27 = phi i64 [ %24, %23 ], [ %31, %25 ]
%28 = phi i8 [ %8, %23 ], [ %33, %25 ]
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %27
store i8 %28, i8* %29
%30 = add nuw nsw i64 %26, 1
%31 = add i64 %27, -1
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %30
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 0
br i1 %34, label %35, label %25
35: ; preds = %25
%36 = trunc i64 %31 to i32
br label %37
37: ; preds = %10, %35, %18
%38 = phi i32 [ %22, %18 ], [ %36, %35 ], [ -1, %10 ]
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %38)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%41 = call i32 @toprefix(i8* %4)
ret i32 0
}