#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);
int strlen(char *);
int doubleOK(char myString[]) {
  int stringSize = strlen(myString);
  int i, counter;
  counter = 0;
  for (i = 0; i < stringSize; i++) {
    if (isdigit(myString[i])) {
      continue;
    } else if (myString[i] == '.') {
      counter++;
      continue;
    } else {
      return 0;
    }
  }
  if (counter > 1) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<doubleOK>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11af <doubleOK+0x8f>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1172 <doubleOK+0x52>
jmp    11a1 <doubleOK+0x81>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    1195 <doubleOK+0x75>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a1 <doubleOK+0x81>
movl   $0x0,-0x4(%rbp)
jmp    11cc <doubleOK+0xac>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1146 <doubleOK+0x26>
cmpl   $0x1,-0x1c(%rbp)
jle    11c5 <doubleOK+0xa5>
movl   $0x0,-0x4(%rbp)
jmp    11cc <doubleOK+0xac>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doubleOK>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <strlen@plt>
test   %eax,%eax
jle    1163 <doubleOK+0x43>
mov    %eax,%r15d
xor    %ebp,%ebp
xor    %r14d,%r14d
jmp    1149 <doubleOK+0x29>
nopl   (%rax)
add    $0x1,%rbp
cmp    %rbp,%r15
je     1166 <doubleOK+0x46>
movsbl (%rbx,%rbp,1),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
jne    1140 <doubleOK+0x20>
cmpb   $0x2e,(%rbx,%rbp,1)
jne    117a <doubleOK+0x5a>
add    $0x1,%r14d
jmp    1140 <doubleOK+0x20>
xor    %r14d,%r14d
xor    %eax,%eax
cmp    $0x2,%r14d
setl   %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
jmp    116f <doubleOK+0x4f>

LLVM IR (-O0):
define i32 @doubleOK(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 = call i32 @strlen(i8* %7)
store i32 %8, i32* %4
store i32 0, i32* %6
store i32 0, i32* %5
br label %9
9: ; preds = %34, %1
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %37
13: ; preds = %9
%14 = load i8*, i8** %3
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = call i64 @isdigit(i8 signext %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %13
br label %34
22: ; preds = %13
%23 = load i8*, i8** %3
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 46
br i1 %29, label %30, label %33
30: ; preds = %22
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
br label %34
33: ; preds = %22
store i32 0, i32* %2
br label %42
34: ; preds = %30, %21
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %9
37: ; preds = %9
%38 = load i32, i32* %6
%39 = icmp sgt i32 %38, 1
br i1 %39, label %40, label %41
40: ; preds = %37
store i32 0, i32* %2
br label %42
41: ; preds = %37
store i32 1, i32* %2
br label %42
42: ; preds = %41, %40, %33
%43 = load i32, i32* %2
ret i32 %43
}

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