#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 */
double OPER(double);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ stderr;
double strtod(char *, char **);
int main(int argc, char *argv[]) {
  double arg = 0.0;
  char *endptr = NULL;
  if (2 != argc) {
    fprintf(stderr, "Argument required\n");
    return 1;
  }
  arg = strtod(argv[1], &endptr);
  if (0 == arg && endptr == argv[1]) {
    fprintf(stderr, "Argument (%s) is not a valid number\n", argv[1]);
    return 1;
  }
  printf("%.10g\n", OPER(arg));
  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)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    $0x2,%eax
cmp    -0x8(%rbp),%eax
je     1197 <main+0x57>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
lea    0xe7c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    121b <main+0xdb>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strtod@plt>
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    11fe <main+0xbe>
jp     11fe <main+0xbe>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmp    0x8(%rcx),%rax
jne    11fe <main+0xbe>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe28(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    121b <main+0xdb>
movsd  -0x18(%rbp),%xmm0
call   1060 <OPER@plt>
lea    0xe29(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
cmp    $0x2,%edi
jne    1190 <main+0x50>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0x8(%rsp),%rsi
call   1030 <strtod@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    117b <main+0x3b>
jp     117b <main+0x3b>
mov    0x8(%rsp),%rdx
cmp    0x8(%rbx),%rdx
je     11a9 <main+0x69>
call   1060 <OPER@plt>
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
jmp    11c5 <main+0x85>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
lea    0xe60(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    11c0 <main+0x80>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
lea    0xe5a(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"Argument required\0A\00"
@.str.1 = [37 x i8] c"Argument (%s) is not a valid number\0A\00"
@.str.2 = [7 x i8] c"%.10g\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 0.000000e+00, double* %6
store i8* null, i8** %7
%8 = load i32, i32* %4
%9 = icmp ne i32 2, %8
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %36
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call double @strtod(i8* %16, i8** %7)
store double %17, double* %6
%18 = load double, double* %6
%19 = fcmp oeq double 0.000000e+00, %18
br i1 %19, label %20, label %32
20: ; preds = %13
%21 = load i8*, i8** %7
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = icmp eq i8* %21, %24
br i1 %25, label %26, label %32
26: ; preds = %20
%27 = load i32, i32* @stderr
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %30)
store i32 1, i32* %3
br label %36
32: ; preds = %20, %13
%33 = load double, double* %6
%34 = call double @OPER(double %33)
%35 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %34)
store i32 0, i32* %3
br label %36
36: ; preds = %32, %26, %10
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"Argument required\0A\00"
@.str.1 = [37 x i8] c"Argument (%s) is not a valid number\0A\00"
@.str.2 = [7 x i8] c"%.10g\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%5 = icmp eq i32 %0, 2
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %24
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = call double @strtod(i8* %11, i8** %3)
%13 = fcmp oeq double %12, 0.000000e+00
br i1 %13, label %14, label %21
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = load i8*, i8** %10
%17 = icmp eq i8* %15, %16
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = load i32, i32* @stderr
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %15)
br label %24
21: ; preds = %14, %9
%22 = tail call double @OPER(double %12)
%23 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %22)
br label %24
24: ; preds = %21, %18, %6
%25 = phi i32 [ 1, %6 ], [ 1, %18 ], [ 0, %21 ]
ret i32 %25
}