#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 isNumber(char *code) {
  int good = 1;
  for (int i = 0; i < strlen(code); ++i) {
    char c = code[i];
    if (c > 57 && c < 48)
      ;
    else
      good = 0;
  }
  return good;
}


x86 assembly (clang, -O0):
<isNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    118d <isNumber+0x7d>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x39,%eax
jle    1173 <isNumber+0x63>
movsbl -0x11(%rbp),%eax
cmp    $0x30,%eax
jge    1173 <isNumber+0x63>
jmp    117a <isNumber+0x6a>
movl   $0x0,-0xc(%rbp)
jmp    117f <isNumber+0x6f>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112a <isNumber+0x1a>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isNumber>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %eax,%eax
jle    1141 <isNumber+0x31>
xor    %r14d,%r14d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1030 <strlen@plt>
add    $0x1,%ebp
cmp    %eax,%ebp
jl     1130 <isNumber+0x20>
jmp    1147 <isNumber+0x37>
mov    $0x1,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @isNumber(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i8* %0, i8** %2
store i32 1, i32* %3
store i32 0, i32* %4
br label %6
6: ; preds = %27, %1
%7 = load i32, i32* %4
%8 = load i8*, i8** %2
%9 = call i32 @strlen(i8* %8)
%10 = icmp slt i32 %7, %9
br i1 %10, label %11, label %30
11: ; preds = %6
%12 = load i8*, i8** %2
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
store i8 %16, i8* %5
%17 = load i8, i8* %5
%18 = sext i8 %17 to i32
%19 = icmp sgt i32 %18, 57
br i1 %19, label %20, label %25
20: ; preds = %11
%21 = load i8, i8* %5
%22 = sext i8 %21 to i32
%23 = icmp slt i32 %22, 48
br i1 %23, label %24, label %25
24: ; preds = %20
br label %26
25: ; preds = %20, %11
store i32 0, i32* %3
br label %26
26: ; preds = %25, %24
br label %27
27: ; preds = %26
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %6
30: ; preds = %6
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
define i32 @isNumber(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 1, %1 ]
%6 = tail call i32 @strlen(i8* %0)
%7 = icmp slt i32 %5, %6
%8 = add nuw nsw i32 %5, 1
br i1 %7, label %4, label %9
9: ; preds = %4, %1
%10 = phi i32 [ 1, %1 ], [ 0, %4 ]
ret i32 %10
}