#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*/ isOctDigit(char const);
int strlen(char const *);
int isOctNumber(const char *numero) {
  if (numero[0] == '0') {
    int i;
    for (i = 1; i < strlen(numero); i++) {
      if (!isOctDigit(numero[i]))
        return 0;
    }
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<isOctNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    11a4 <isOctNumber+0x84>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    1198 <isOctNumber+0x78>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isOctDigit@plt>
cmp    $0x0,%eax
jne    1185 <isOctNumber+0x65>
movl   $0x0,-0x4(%rbp)
jmp    11ab <isOctNumber+0x8b>
jmp    118a <isOctNumber+0x6a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1143 <isOctNumber+0x23>
movl   $0x1,-0x4(%rbp)
jmp    11ab <isOctNumber+0x8b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isOctNumber>:
push   %rbp
push   %r14
push   %rbx
xor    %r14d,%r14d
cmpb   $0x30,(%rdi)
jne    1166 <isOctNumber+0x46>
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     1160 <isOctNumber+0x40>
mov    $0x1,%ebp
xchg   %ax,%ax
movsbl (%rbx,%rbp,1),%edi
call   1040 <isOctDigit@plt>
test   %eax,%eax
je     1166 <isOctNumber+0x46>
add    $0x1,%rbp
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbp
jl     1140 <isOctNumber+0x20>
mov    $0x1,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @isOctNumber(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 48
br i1 %3, label %4, label %18
4: ; preds = %1
%5 = tail call i32 @strlen(i8* %0)
%6 = icmp sgt i32 %5, 1
br i1 %6, label %11, label %18
7: ; preds = %11
%8 = tail call i32 @strlen(i8* %0)
%9 = sext i32 %8 to i64
%10 = icmp slt i64 %17, %9
br i1 %10, label %11, label %18
11: ; preds = %4, %7
%12 = phi i64 [ %17, %7 ], [ 1, %4 ]
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = tail call i32 @isOctDigit(i8 signext %14)
%16 = icmp eq i32 %15, 0
%17 = add nuw nsw i64 %12, 1
br i1 %16, label %18, label %7
18: ; preds = %7, %11, %4, %1
%19 = phi i32 [ 0, %1 ], [ 1, %4 ], [ 1, %7 ], [ 0, %11 ]
ret i32 %19
}