#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 */
int strlen(char *);
int edflib_is_duration_number(char *str) {
  int i, l, hasdot = 0;
  l = strlen(str);
  if (!l)
    return 1;
  if ((str[0] == '.') || (str[l - 1] == '.'))
    return 1;
  for (i = 0; i < l; i++) {
    if (str[i] == '.') {
      if (hasdot)
        return 1;
      hasdot++;
    } else {
      if ((str[i] < 48) || (str[i] > 57))
        return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<edflib_is_duration_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1145 <edflib_is_duration_number+0x35>
movl   $0x1,-0x4(%rbp)
jmp    121c <edflib_is_duration_number+0x10c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
je     116f <edflib_is_duration_number+0x5f>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    117b <edflib_is_duration_number+0x6b>
movl   $0x1,-0x4(%rbp)
jmp    121c <edflib_is_duration_number+0x10c>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1215 <edflib_is_duration_number+0x105>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    11c7 <edflib_is_duration_number+0xb7>
cmpl   $0x0,-0x1c(%rbp)
je     11b9 <edflib_is_duration_number+0xa9>
movl   $0x1,-0x4(%rbp)
jmp    121c <edflib_is_duration_number+0x10c>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1202 <edflib_is_duration_number+0xf2>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jl     11f1 <edflib_is_duration_number+0xe1>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jle    11fd <edflib_is_duration_number+0xed>
movl   $0x1,-0x4(%rbp)
jmp    121c <edflib_is_duration_number+0x10c>
jmp    1202 <edflib_is_duration_number+0xf2>
jmp    1207 <edflib_is_duration_number+0xf7>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1182 <edflib_is_duration_number+0x72>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<edflib_is_duration_number>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %eax,%eax
je     112e <edflib_is_duration_number+0x1e>
mov    (%rbx),%cl
cmp    $0x2e,%cl
je     112e <edflib_is_duration_number+0x1e>
movslq %eax,%rdx
cmpb   $0x2e,-0x1(%rdx,%rbx,1)
jne    1135 <edflib_is_duration_number+0x25>
mov    $0x1,%eax
pop    %rbx
ret
test   %eax,%eax
jle    117c <edflib_is_duration_number+0x6c>
mov    %eax,%edi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x1,%eax
cmp    $0x2e,%cl
je     1160 <edflib_is_duration_number+0x50>
nopl   0x0(%rax)
add    $0xc6,%cl
cmp    $0xf6,%cl
jae    1169 <edflib_is_duration_number+0x59>
jmp    112e <edflib_is_duration_number+0x1e>
nopw   0x0(%rax,%rax,1)
test   %esi,%esi
mov    $0x1,%esi
jne    1133 <edflib_is_duration_number+0x23>
cmp    %rdx,%rdi
je     117c <edflib_is_duration_number+0x6c>
mov    (%rbx,%rdx,1),%cl
add    $0x1,%rdx
cmp    $0x2e,%cl
jne    1150 <edflib_is_duration_number+0x40>
jmp    1160 <edflib_is_duration_number+0x50>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @edflib_is_duration_number(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %6
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %1
store i32 1, i32* %2
br label %71
12: ; preds = %1
%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, 46
br i1 %17, label %27, label %18
18: ; preds = %12
%19 = load i8*, i8** %3
%20 = load i32, i32* %5
%21 = sub nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %19, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 46
br i1 %26, label %27, label %28
27: ; preds = %18, %12
store i32 1, i32* %2
br label %71
28: ; preds = %18
store i32 0, i32* %4
br label %29
29: ; preds = %67, %28
%30 = load i32, i32* %4
%31 = load i32, i32* %5
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %70
33: ; preds = %29
%34 = load i8*, i8** %3
%35 = load i32, i32* %4
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %34, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 46
br i1 %40, label %41, label %48
41: ; preds = %33
%42 = load i32, i32* %6
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %41
store i32 1, i32* %2
br label %71
45: ; preds = %41
%46 = load i32, i32* %6
%47 = add nsw i32 %46, 1
store i32 %47, i32* %6
br label %66
48: ; preds = %33
%49 = load i8*, i8** %3
%50 = load i32, i32* %4
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %49, i64 %51
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = icmp slt i32 %54, 48
br i1 %55, label %64, label %56
56: ; preds = %48
%57 = load i8*, i8** %3
%58 = load i32, i32* %4
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %57, i64 %59
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = icmp sgt i32 %62, 57
br i1 %63, label %64, label %65
64: ; preds = %56, %48
store i32 1, i32* %2
br label %71
65: ; preds = %56
br label %66
66: ; preds = %65, %45
br label %67
67: ; preds = %66
%68 = load i32, i32* %4
%69 = add nsw i32 %68, 1
store i32 %69, i32* %4
br label %29
70: ; preds = %29
store i32 0, i32* %2
br label %71
71: ; preds = %70, %64, %44, %27, %11
%72 = load i32, i32* %2
ret i32 %72
}

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