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

/* Variables and functions */
struct expr *infix_to_RPN(struct expr *);
char *pretreatment(char *);
int /*<<< orphan*/ print_infix(struct expr *);
int /*<<< orphan*/ printf(char *, char *);
struct expr *s_to_infix(char *);
int main(void) {
  char s[] = "(x+1)/(x-1)*(x-1)";
  char *p = pretreatment(s);
  printf("%s\n", p);
  struct expr *ptr = s_to_infix(p);
  print_infix(ptr);
  struct expr *ptr2 = infix_to_RPN(ptr);
  print_infix(ptr2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe9a(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe97(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe94(%rip),%ax
mov    %ax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
call   1070 <pretreatment@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe7a(%rip),%rdi
call   1050 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <s_to_infix@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
call   1060 <print_infix@plt>
mov    -0x30(%rbp),%rdi
call   1040 <infix_to_RPN@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1060 <print_infix@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movaps 0xea4(%rip),%xmm0
movaps %xmm0,(%rsp)
movw   $0x29,0x10(%rsp)
mov    %rsp,%rdi
call   1070 <pretreatment@plt>
mov    %rax,%rbx
lea    0xe99(%rip),%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <s_to_infix@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <print_infix@plt>
mov    %rbx,%rdi
call   1040 <infix_to_RPN@plt>
mov    %rax,%rdi
call   1060 <print_infix@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.expr = type { i32 }
@__const.main.s = [18 x i8] c"(x+1)/(x-1)*(x-1)\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [18 x i8]
%3 = alloca i8*
%4 = alloca %struct.expr*
%5 = alloca %struct.expr*
store i32 0, i32* %1
%6 = bitcast [18 x i8]* %2 to i8*
%7 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 0
%8 = call i8* @pretreatment(i8* %7)
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i8*, i8** %3
%12 = call %struct.expr* @s_to_infix(i8* %11)
store %struct.expr* %12, %struct.expr** %4
%13 = load %struct.expr*, %struct.expr** %4
%14 = call i32 @print_infix(%struct.expr* %13)
%15 = load %struct.expr*, %struct.expr** %4
%16 = call %struct.expr* @infix_to_RPN(%struct.expr* %15)
store %struct.expr* %16, %struct.expr** %5
%17 = load %struct.expr*, %struct.expr** %5
%18 = call i32 @print_infix(%struct.expr* %17)
ret i32 0
}

LLVM IR (-O2):
%struct.expr = type { i32 }
@__const.main.s = [18 x i8] c"(x+1)/(x-1)*(x-1)\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [18 x i8]
%2 = getelementptr inbounds [18 x i8], [18 x i8]* %1, i64 0, i64 0
%3 = call i8* @pretreatment(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call %struct.expr* @s_to_infix(i8* %3)
%6 = call i32 @print_infix(%struct.expr* %5)
%7 = call %struct.expr* @infix_to_RPN(%struct.expr* %5)
%8 = call i32 @print_infix(%struct.expr* %7)
ret i32 0
}