#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 /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, char *);
int is_number(char *);
int /*<<< orphan*/ stderr;
int test_number(void) {
  char **test;
  int i, ret;
  char *input[] = {"0", "00", "-2", "02", "0.0", " 0", NULL};
  int result[] = {1, 0, 0, 0, 0, 0};
  test = input;
  i = 0;
  ret = 1;
  while ((*test) != NULL) {
    if (is_number(*test) != result[i]) {
      fprintf(stderr, "test_number(): test %d failed with test=\"%s\"\n", i,
              *test);
      ret = 0;
    }
    test++;
    i++;
  }
  return ret;
}


x86 assembly (clang, -O0):
<test_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x38,%edx
call   1040 <memset@plt>
lea    0xebf(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    0xea6(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0xe9e(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xe96(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xe8e(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe87(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xeaf(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xeac(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xea9(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1229 <test_number+0xf9>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <is_number@plt>
movslq -0xc(%rbp),%rcx
cmp    -0x70(%rbp,%rcx,4),%eax
je     120f <test_number+0xdf>
mov    0x2df0(%rip),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
lea    0xe0d(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c1 <test_number+0x91>
mov    -0x10(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_number>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x40,%rsp
movq   $0x0,0x30(%rsp)
lea    0xed2(%rip),%rdi
mov    %rdi,(%rsp)
lea    0xeb9(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xeb0(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xea7(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xe9e(%rip),%rax
mov    %rax,0x20(%rsp)
lea    0xe96(%rip),%rax
mov    %rax,0x28(%rsp)
mov    $0x1,%r15d
lea    0xeb7(%rip),%rbp
xor    %ebx,%ebx
mov    0x2e4e(%rip),%r12
lea    0xe77(%rip),%r14
jmp    11b2 <test_number+0x92>
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp,%rbx,8),%rdi
add    $0x1,%rbx
add    $0x4,%rbp
test   %rdi,%rdi
je     11d3 <test_number+0xb3>
call   1030 <is_number@plt>
cmp    0x0(%rbp),%eax
je     11a0 <test_number+0x80>
mov    (%r12),%edi
mov    (%rsp,%rbx,8),%rcx
mov    %r14,%rsi
mov    %ebx,%edx
call   1040 <fprintf@plt>
xor    %r15d,%r15d
jmp    11a0 <test_number+0x80>
mov    %r15d,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"0\00"
@.str.1 = [3 x i8] c"00\00"
@.str.2 = [3 x i8] c"-2\00"
@.str.3 = [3 x i8] c"02\00"
@.str.4 = [4 x i8] c"0.0\00"
@.str.5 = [3 x i8] c" 0\00"
@__const.test_number.result = [6 x i32] [i32 1, i32 0, i32 0, i32 0, i32 0, i32 0]
@stderr = global i32 0
@.str.6 = [46 x i8] c"test_number(): test %d failed with test=\22%s\22\0A\00"
define i32 @test_number() {
%1 = alloca i8**
%2 = alloca i32
%3 = alloca i32
%4 = alloca [7 x i8*]
%5 = alloca [6 x i32]
%6 = bitcast [7 x i8*]* %4 to i8*
%7 = bitcast i8* %6 to [7 x i8*]*
%8 = getelementptr inbounds [7 x i8*], [7 x i8*]* %7, i32 0, i32 0
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8** %8
%9 = getelementptr inbounds [7 x i8*], [7 x i8*]* %7, i32 0, i32 1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8** %9
%10 = getelementptr inbounds [7 x i8*], [7 x i8*]* %7, i32 0, i32 2
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i32 0, i32 0), i8** %10
%11 = getelementptr inbounds [7 x i8*], [7 x i8*]* %7, i32 0, i32 3
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i32 0, i32 0), i8** %11
%12 = getelementptr inbounds [7 x i8*], [7 x i8*]* %7, i32 0, i32 4
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8** %12
%13 = getelementptr inbounds [7 x i8*], [7 x i8*]* %7, i32 0, i32 5
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i32 0, i32 0), i8** %13
%14 = bitcast [6 x i32]* %5 to i8*
%15 = getelementptr inbounds [7 x i8*], [7 x i8*]* %4, i64 0, i64 0
store i8** %15, i8*** %1
store i32 0, i32* %2
store i32 1, i32* %3
br label %16
16: ; preds = %35, %0
%17 = load i8**, i8*** %1
%18 = load i8*, i8** %17
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %40
20: ; preds = %16
%21 = load i8**, i8*** %1
%22 = load i8*, i8** %21
%23 = call i32 @is_number(i8* %22)
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [6 x i32], [6 x i32]* %5, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = icmp ne i32 %23, %27
br i1 %28, label %29, label %35
29: ; preds = %20
%30 = load i32, i32* @stderr
%31 = load i32, i32* %2
%32 = load i8**, i8*** %1
%33 = load i8*, i8** %32
%34 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0), i32 %31, i8* %33)
store i32 0, i32* %3
br label %35
35: ; preds = %29, %20
%36 = load i8**, i8*** %1
%37 = getelementptr inbounds i8*, i8** %36, i32 1
store i8** %37, i8*** %1
%38 = load i32, i32* %2
%39 = add nsw i32 %38, 1
store i32 %39, i32* %2
br label %16
40: ; preds = %16
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@.str = [2 x i8] c"0\00"
@.str.1 = [3 x i8] c"00\00"
@.str.2 = [3 x i8] c"-2\00"
@.str.3 = [3 x i8] c"02\00"
@.str.4 = [4 x i8] c"0.0\00"
@.str.5 = [3 x i8] c" 0\00"
@__const.test_number.result = [6 x i32] [i32 1, i32 0, i32 0, i32 0, i32 0, i32 0]
@stderr = global i32 0
@.str.6 = [46 x i8] c"test_number(): test %d failed with test=\22%s\22\0A\00"
define i32 @test_number() {
%1 = alloca [7 x i8*]
%2 = bitcast [7 x i8*]* %1 to i8*
%3 = getelementptr inbounds [7 x i8*], [7 x i8*]* %1, i64 0, i64 6
%4 = bitcast i8** %3 to i64*
store i64 0, i64* %4
%5 = getelementptr inbounds [7 x i8*], [7 x i8*]* %1, i64 0, i64 0
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [7 x i8*], [7 x i8*]* %1, i64 0, i64 1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [7 x i8*], [7 x i8*]* %1, i64 0, i64 2
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [7 x i8*], [7 x i8*]* %1, i64 0, i64 3
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %8
%9 = getelementptr inbounds [7 x i8*], [7 x i8*]* %1, i64 0, i64 4
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8** %9
%10 = getelementptr inbounds [7 x i8*], [7 x i8*]* %1, i64 0, i64 5
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8** %10
br label %11
11: ; preds = %0, %25
%12 = phi i64 [ 0, %0 ], [ %28, %25 ]
%13 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %0 ], [ %29, %25 ]
%14 = phi i32 [ 1, %0 ], [ %26, %25 ]
%15 = phi i8** [ %5, %0 ], [ %27, %25 ]
%16 = tail call i32 @is_number(i8* %13)
%17 = getelementptr inbounds [6 x i32], [6 x i32]* @__const.test_number.result, i64 0, i64 %12
%18 = load i32, i32* %17
%19 = icmp eq i32 %16, %18
br i1 %19, label %25, label %20
20: ; preds = %11
%21 = load i32, i32* @stderr
%22 = load i8*, i8** %15
%23 = trunc i64 %12 to i32
%24 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0), i32 %23, i8* %22)
br label %25
25: ; preds = %20, %11
%26 = phi i32 [ 0, %20 ], [ %14, %11 ]
%27 = getelementptr inbounds i8*, i8** %15, i64 1
%28 = add nuw i64 %12, 1
%29 = load i8*, i8** %27
%30 = icmp eq i8* %29, null
br i1 %30, label %31, label %11
31: ; preds = %25
ret i32 %26
}