#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 */
float atof(char *);
float calc(float, float, char);
int /*<<< orphan*/ printf(char *, float);
void main(int argc, char **argv) {
  float num1, num2;
  float result = 0;
  char op;
  num1 = atof(argv[1]);
  num2 = atof(argv[3]);
  op = *argv[2];
  result = calc(num1, num2, op);
  printf("Result=%f\n", result);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%al
mov    %al,-0x1d(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
movsbl -0x1d(%rbp),%edi
call   1050 <calc@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
lea    0xe64(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1030 <atof@plt>
movss  %xmm0,0xc(%rsp)
mov    0x18(%rbx),%rdi
call   1030 <atof@plt>
movaps %xmm0,%xmm1
mov    0x10(%rbx),%rax
movsbl (%rax),%edi
movss  0xc(%rsp),%xmm0
call   1050 <calc@plt>
lea    0xe94(%rip),%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"Result=%f\0A\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca i8
store i32 %0, i32* %3
store i8** %1, i8*** %4
store float 0.000000e+00, float* %7
%9 = load i8**, i8*** %4
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call float @atof(i8* %11)
store float %12, float* %5
%13 = load i8**, i8*** %4
%14 = getelementptr inbounds i8*, i8** %13, i64 3
%15 = load i8*, i8** %14
%16 = call float @atof(i8* %15)
store float %16, float* %6
%17 = load i8**, i8*** %4
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = load i8, i8* %19
store i8 %20, i8* %8
%21 = load float, float* %5
%22 = load float, float* %6
%23 = load i8, i8* %8
%24 = call float @calc(float %21, float %22, i8 signext %23)
store float %24, float* %7
%25 = load float, float* %7
%26 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), float %25)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"Result=%f\0A\00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call float @atof(i8* %4)
%6 = getelementptr inbounds i8*, i8** %1, i64 3
%7 = load i8*, i8** %6
%8 = tail call float @atof(i8* %7)
%9 = getelementptr inbounds i8*, i8** %1, i64 2
%10 = load i8*, i8** %9
%11 = load i8, i8* %10
%12 = tail call float @calc(float %5, float %8, i8 signext %11)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), float %12)
ret void
}