#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 */
scalar_t__ strcmp(char *, char *);
double strtod(char *, char **);
int isNumber(char *s, double *num) {
  char *end;
  double returnNum;
  if (strcmp(s, "0") == 0) {
    *num = 0;
    return 1;
  } else {
    returnNum = strtod(s, &end);
    if ((returnNum != 0.0) && (strcmp(end, "") == 0)) {
      *num = returnNum;
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<isNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1161 <isNumber+0x41>
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    11cf <isNumber+0xaf>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strtod@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1190 <isNumber+0x70>
jp     1190 <isNumber+0x70>
jmp    11c3 <isNumber+0xa3>
mov    -0x20(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11c3 <isNumber+0xa3>
movsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    11cf <isNumber+0xaf>
jmp    11c8 <isNumber+0xa8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isNumber>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0xecd(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     117c <isNumber+0x5c>
lea    0x10(%rsp),%rsi
mov    %rbp,%rdi
call   1030 <strtod@plt>
xor    %ebp,%ebp
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1158 <isNumber+0x38>
jnp    1189 <isNumber+0x69>
movsd  %xmm0,0x8(%rsp)
mov    0x10(%rsp),%rdi
lea    0xe97(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1189 <isNumber+0x69>
movsd  0x8(%rsp),%xmm0
jmp    1180 <isNumber+0x60>
xorpd  %xmm0,%xmm0
movsd  %xmm0,(%rbx)
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"0\00"
@.str.1 = [1 x i8] zeroinitializer
define i32 @isNumber(i8* %0, double* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca double*
%6 = alloca i8*
%7 = alloca double
store i8* %0, i8** %4
store double* %1, double** %5
%8 = load i8*, i8** %4
%9 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load double*, double** %5
store double 0.000000e+00, double* %12
store i32 1, i32* %3
br label %27
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = call double @strtod(i8* %14, i8** %6)
store double %15, double* %7
%16 = load double, double* %7
%17 = fcmp une double %16, 0.000000e+00
br i1 %17, label %18, label %25
18: ; preds = %13
%19 = load i8*, i8** %6
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = load double, double* %7
%24 = load double*, double** %5
store double %23, double* %24
store i32 1, i32* %3
br label %27
25: ; preds = %18, %13
br label %26
26: ; preds = %25
store i32 0, i32* %3
br label %27
27: ; preds = %26, %22, %11
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@.str = [2 x i8] c"0\00"
@.str.1 = [1 x i8] zeroinitializer
define i32 @isNumber(i8* %0, double* nocapture writeonly %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %2
%8 = call double @strtod(i8* %0, i8** %3)
%9 = fcmp une double %8, 0.000000e+00
br i1 %9, label %10, label %16
10: ; preds = %7
%11 = load i8*, i8** %3
%12 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10, %2
%15 = phi double [ 0.000000e+00, %2 ], [ %8, %10 ]
store double %15, double* %1
br label %16
16: ; preds = %14, %10, %7
%17 = phi i32 [ 0, %7 ], [ 0, %10 ], [ 1, %14 ]
ret i32 %17
}