#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*/ endwin();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ printw(char *);
int recur_maths();
int /*<<< orphan*/ refresh();
int main(int argc, char **argv) {
  initscr();
  printw("Implemention elementary arithmetic functions by recursion\n");
  printw("By mewrox99\n");
  printw("Please enter your expression in infix notation e.g 3+6\n");
  refresh();
  int c;
  while ((c = recur_maths()) != 0)
    continue;
  endwin();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <initscr@plt>
lea    0xe8c(%rip),%rdi
call   1040 <printw@plt>
lea    0xebb(%rip),%rdi
call   1040 <printw@plt>
lea    0xebc(%rip),%rdi
call   1040 <printw@plt>
mov    $0x0,%al
call   1060 <refresh@plt>
mov    $0x0,%al
call   1050 <recur_maths@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     11b0 <main+0x60>
jmp    1198 <main+0x48>
mov    $0x0,%al
call   1070 <endwin@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <initscr@plt>
lea    0xea1(%rip),%rdi
call   1040 <printw@plt>
lea    0xed0(%rip),%rdi
call   1040 <printw@plt>
lea    0xed1(%rip),%rdi
call   1040 <printw@plt>
xor    %eax,%eax
call   1060 <refresh@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1050 <recur_maths@plt>
test   %eax,%eax
jne    1190 <main+0x40>
xor    %eax,%eax
call   1070 <endwin@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [59 x i8] c"Implemention elementary arithmetic functions by recursion\0A\00"
@.str.1 = [13 x i8] c"By mewrox99\0A\00"
@.str.2 = [56 x i8] c"Please enter your expression in infix notation e.g 3+6\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @initscr()
%8 = call i32 @printw(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @printw(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @printw(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (...) @refresh()
br label %12
12: ; preds = %15, %2
%13 = call i32 (...) @recur_maths()
store i32 %13, i32* %6
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %12
br label %12
16: ; preds = %12
%17 = call i32 (...) @endwin()
ret i32 0
}

LLVM IR (-O2):
@.str = [59 x i8] c"Implemention elementary arithmetic functions by recursion\0A\00"
@.str.1 = [13 x i8] c"By mewrox99\0A\00"
@.str.2 = [56 x i8] c"Please enter your expression in infix notation e.g 3+6\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @initscr()
%4 = tail call i32 @printw(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @printw(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @printw(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 (...) @refresh()
br label %8
8: ; preds = %8, %2
%9 = tail call i32 (...) @recur_maths()
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %8
11: ; preds = %8
%12 = tail call i32 (...) @endwin()
ret i32 0
}