#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 is_number(char);
int strlen(char *);
int is_numeric(char *ll) {
  int len, flag;
  len = strlen(ll);
  if (len == 0)
    return 0;
  flag = is_number(ll[0]);
  if (flag == 0)
    return 0;
  else if (flag == -1) {
    if (len == 1 || is_number(ll[1]) != 1)
      return 0;
    else
      return 1;
  } else
    return 1;
}


x86 assembly (clang, -O0):
<is_numeric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    114e <is_numeric+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    11bc <is_numeric+0x9c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <is_number@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1173 <is_numeric+0x53>
movl   $0x0,-0x4(%rbp)
jmp    11bc <is_numeric+0x9c>
cmpl   $0xffffffff,-0x18(%rbp)
jne    11b5 <is_numeric+0x95>
cmpl   $0x1,-0x14(%rbp)
je     119d <is_numeric+0x7d>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <is_number@plt>
cmp    $0x1,%eax
je     11a9 <is_numeric+0x89>
movl   $0x0,-0x4(%rbp)
jmp    11bc <is_numeric+0x9c>
movl   $0x1,-0x4(%rbp)
jmp    11bc <is_numeric+0x9c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_numeric>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
xor    %r14d,%r14d
test   %eax,%eax
je     116b <is_numeric+0x4b>
mov    %eax,%ebp
movsbl (%rbx),%edi
call   1030 <is_number@plt>
test   %eax,%eax
je     1160 <is_numeric+0x40>
cmp    $0xffffffff,%eax
jne    1165 <is_numeric+0x45>
cmp    $0x1,%ebp
je     116b <is_numeric+0x4b>
movsbl 0x1(%rbx),%edi
call   1030 <is_number@plt>
xor    %r14d,%r14d
cmp    $0x1,%eax
sete   %r14b
jmp    116b <is_numeric+0x4b>
mov    %eax,%r14d
jmp    116b <is_numeric+0x4b>
mov    $0x1,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @is_numeric(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 0, i32* %2
br label %34
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = call i32 @is_number(i8 signext %14)
store i32 %15, i32* %5
%16 = load i32, i32* %5
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %11
store i32 0, i32* %2
br label %34
19: ; preds = %11
%20 = load i32, i32* %5
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %33
22: ; preds = %19
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 1
br i1 %24, label %31, label %25
25: ; preds = %22
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i64 1
%28 = load i8, i8* %27
%29 = call i32 @is_number(i8 signext %28)
%30 = icmp ne i32 %29, 1
br i1 %30, label %31, label %32
31: ; preds = %25, %22
store i32 0, i32* %2
br label %34
32: ; preds = %25
store i32 1, i32* %2
br label %34
33: ; preds = %19
store i32 1, i32* %2
br label %34
34: ; preds = %33, %32, %31, %18, %10
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
define i32 @is_numeric(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1
%5 = load i8, i8* %0
%6 = tail call i32 @is_number(i8 signext %5)
switch i32 %6, label %15 [
i32 0, label %16
i32 -1, label %7
]
7: ; preds = %4
%8 = icmp eq i32 %2, 1
br i1 %8, label %16, label %9
9: ; preds = %7
%10 = getelementptr inbounds i8, i8* %0, i64 1
%11 = load i8, i8* %10
%12 = tail call i32 @is_number(i8 signext %11)
%13 = icmp eq i32 %12, 1
%14 = zext i1 %13 to i32
br label %16
15: ; preds = %4
br label %16
16: ; preds = %9, %7, %4, %1, %15
%17 = phi i32 [ 1, %15 ], [ 0, %1 ], [ %6, %4 ], [ 0, %7 ], [ %14, %9 ]
ret i32 %17
}