#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*/ calculate(char *, char *, char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char *a = (char *)malloc(sizeof(1000));
  char *b = (char *)malloc(sizeof(1000));
  char *op = (char *)malloc(sizeof(1));
  while (1) {
    puts("please enter first number:");
    scanf("%s", a);
    puts("please enter operator:");
    scanf("%s", op);
    puts("please enter second number:");
    scanf("%s", b);
    calculate(a, b, op);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
lea    0xe80(%rip),%rdi
call   1030 <puts@plt>
mov    -0x10(%rbp),%rsi
lea    0xe8b(%rip),%rdi
call   1060 <scanf@plt>
lea    0xe82(%rip),%rdi
call   1030 <puts@plt>
mov    -0x20(%rbp),%rsi
lea    0xe6f(%rip),%rdi
call   1060 <scanf@plt>
lea    0xe7d(%rip),%rdi
call   1030 <puts@plt>
mov    -0x18(%rbp),%rsi
lea    0xe53(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <calculate@plt>
jmp    1179 <main+0x39>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,%r15
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xea2(%rip),%r13
lea    0xe9e(%rip),%rbp
lea    0xeae(%rip),%r12
nopw   0x0(%rax,%rax,1)
lea    0xe69(%rip),%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %r14,%rsi
call   1060 <scanf@plt>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <calculate@plt>
jmp    1190 <main+0x50>

LLVM IR (-O0):
@.str = [27 x i8] c"please enter first number:\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [23 x i8] c"please enter operator:\00"
@.str.3 = [28 x i8] c"please enter second number:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
%5 = call i64 @malloc(i32 4)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %2
%7 = call i64 @malloc(i32 4)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %3
%9 = call i64 @malloc(i32 4)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %4
br label %11
11: ; preds = %0, %11
%12 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %2
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%16 = load i8*, i8** %4
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%19 = load i8*, i8** %3
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = load i8*, i8** %2
%22 = load i8*, i8** %3
%23 = load i8*, i8** %4
%24 = call i32 @calculate(i8* %21, i8* %22, i8* %23)
br label %11
}

LLVM IR (-O2):
@.str = [27 x i8] c"please enter first number:\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [23 x i8] c"please enter operator:\00"
@.str.3 = [28 x i8] c"please enter second number:\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 4)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i64 @malloc(i32 4)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i64 @malloc(i32 4)
%6 = inttoptr i64 %5 to i8*
br label %7
7: ; preds = %7, %0
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%13 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%14 = tail call i32 @calculate(i8* %2, i8* %4, i8* %6)
br label %7
}