#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__ isdigit(char const);
int strlen(char const *);
int IsDouble(const char *pchValue) {
  if (pchValue == NULL)
    return (0);
  int inLength = strlen(pchValue);
  if (pchValue[0] == '-' && inLength == 1)
    return (0);
  int inSt = (pchValue[0] == '-') ? 1 : 0;
  int inCnt;
  for (inCnt = inSt; inCnt < inLength; inCnt++) {
    if (isdigit(pchValue[inCnt]))
      continue;
    if (pchValue[inCnt] == '.')
      continue;
    return (0);
  }
  return (1);
}


x86 assembly (clang, -O0):
<IsDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1143 <IsDouble+0x23>
movl   $0x0,-0x4(%rbp)
jmp    11f9 <IsDouble+0xd9>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1175 <IsDouble+0x55>
cmpl   $0x1,-0x14(%rbp)
jne    1175 <IsDouble+0x55>
movl   $0x0,-0x4(%rbp)
jmp    11f9 <IsDouble+0xd9>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x2d,%edx
cmove  %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f2 <IsDouble+0xd2>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     11be <IsDouble+0x9e>
jmp    11e4 <IsDouble+0xc4>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    11d8 <IsDouble+0xb8>
jmp    11e4 <IsDouble+0xc4>
movl   $0x0,-0x4(%rbp)
jmp    11f9 <IsDouble+0xd9>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1192 <IsDouble+0x72>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsDouble>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %r14d,%r14d
test   %rdi,%rdi
je     1185 <IsDouble+0x65>
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    (%rbx),%cl
cmp    $0x2d,%cl
jne    1143 <IsDouble+0x23>
cmp    $0x1,%eax
je     1185 <IsDouble+0x65>
xor    %edx,%edx
cmp    $0x2d,%cl
sete   %dl
cmp    %edx,%eax
jle    117f <IsDouble+0x5f>
xor    %ebp,%ebp
cmp    $0x2d,%cl
sete   %bpl
mov    %eax,%r15d
jmp    1169 <IsDouble+0x49>
nopl   (%rax)
add    $0x1,%rbp
cmp    %rbp,%r15
je     117f <IsDouble+0x5f>
movsbl (%rbx,%rbp,1),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
jne    1160 <IsDouble+0x40>
cmpb   $0x2e,(%rbx,%rbp,1)
je     1160 <IsDouble+0x40>
jmp    1185 <IsDouble+0x65>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @IsDouble(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %58
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i32 @strlen(i8* %11)
store i32 %12, i32* %4
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 0
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 45
br i1 %17, label %18, label %22
18: ; preds = %10
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %22
21: ; preds = %18
store i32 0, i32* %2
br label %58
22: ; preds = %18, %10
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i64 0
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 45
%28 = zext i1 %27 to i64
%29 = select i1 %27, i32 1, i32 0
store i32 %29, i32* %5
%30 = load i32, i32* %5
store i32 %30, i32* %6
br label %31
31: ; preds = %54, %22
%32 = load i32, i32* %6
%33 = load i32, i32* %4
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %57
35: ; preds = %31
%36 = load i8*, i8** %3
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %36, i64 %38
%40 = load i8, i8* %39
%41 = call i64 @isdigit(i8 signext %40)
%42 = icmp ne i64 %41, 0
br i1 %42, label %43, label %44
43: ; preds = %35
br label %54
44: ; preds = %35
%45 = load i8*, i8** %3
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %45, i64 %47
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 46
br i1 %51, label %52, label %53
52: ; preds = %44
br label %54
53: ; preds = %44
store i32 0, i32* %2
br label %58
54: ; preds = %52, %43
%55 = load i32, i32* %6
%56 = add nsw i32 %55, 1
store i32 %56, i32* %6
br label %31
57: ; preds = %31
store i32 1, i32* %2
br label %58
58: ; preds = %57, %53, %21, %9
%59 = load i32, i32* %2
ret i32 %59
}

LLVM IR (-O2):
define i32 @IsDouble(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %27, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 45
%7 = icmp eq i32 %4, 1
%8 = select i1 %6, i1 %7, i1 false
br i1 %8, label %27, label %9
9: ; preds = %3
%10 = zext i1 %6 to i32
%11 = icmp sgt i32 %4, %10
br i1 %11, label %12, label %27
12: ; preds = %9
%13 = zext i1 %6 to i64
%14 = zext i32 %4 to i64
br label %15
15: ; preds = %12, %24
%16 = phi i64 [ %13, %12 ], [ %25, %24 ]
%17 = getelementptr inbounds i8, i8* %0, i64 %16
%18 = load i8, i8* %17
%19 = tail call i64 @isdigit(i8 signext %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = load i8, i8* %17
%23 = icmp eq i8 %22, 46
br i1 %23, label %24, label %27
24: ; preds = %21, %15
%25 = add nuw nsw i64 %16, 1
%26 = icmp eq i64 %25, %14
br i1 %26, label %27, label %15
27: ; preds = %21, %24, %9, %3, %1
%28 = phi i32 [ 0, %1 ], [ 0, %3 ], [ 1, %9 ], [ 0, %21 ], [ 1, %24 ]
ret i32 %28
}