#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*/ free(char *);
scalar_t__ isdigit(char);
char *numeral_alloc(char *, int const);
char *strsep(char **, char *);
int moral_regla10(char *numero, char *result[], const int verbose) {
  int n = 0;
  char *buffer = NULL;
  char *token = NULL;
  if (isdigit(*numero)) {
    buffer = numeral_alloc(numero, verbose);
    for ((token = strsep(&buffer, " ")); token != NULL && n < 3;
         token = strsep(&buffer, " ")) {
      result[n] = token;
      n++;
    }
    free(buffer);
  }
  return n;
}


x86 assembly (clang, -O0):
<moral_regla10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%rax
je     1209 <moral_regla10+0xc9>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1060 <numeral_alloc@plt>
mov    %rax,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
lea    0xe65(%rip),%rsi
call   1050 <strsep@plt>
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x28(%rbp)
mov    %al,-0x29(%rbp)
je     11be <moral_regla10+0x7e>
cmpl   $0x3,-0x18(%rbp)
setl   %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    11ce <moral_regla10+0x8e>
jmp    1200 <moral_regla10+0xc0>
mov    -0x28(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
lea    0xe0e(%rip),%rsi
call   1050 <strsep@plt>
mov    %rax,-0x28(%rbp)
jmp    11a4 <moral_regla10+0x64>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<moral_regla10>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1040 <isdigit@plt>
test   %rax,%rax
je     11c3 <moral_regla10+0x83>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1060 <numeral_alloc@plt>
mov    %rax,0x8(%rsp)
lea    0xe89(%rip),%rsi
lea    0x8(%rsp),%rdi
call   1050 <strsep@plt>
test   %rax,%rax
je     11c7 <moral_regla10+0x87>
xor    %ebx,%ebx
lea    0xe71(%rip),%r15
lea    0x8(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rax,(%r14,%rbx,8)
lea    0x1(%rbx),%rbp
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <strsep@plt>
test   %rax,%rax
je     11c9 <moral_regla10+0x89>
cmp    $0x2,%rbx
mov    %rbp,%rbx
jb     11a0 <moral_regla10+0x60>
jmp    11c9 <moral_regla10+0x89>
xor    %ebp,%ebp
jmp    11d3 <moral_regla10+0x93>
xor    %ebp,%ebp
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
define i32 @moral_regla10(i8* %0, i8** %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
store i32 0, i32* %7
store i8* null, i8** %8
store i8* null, i8** %9
%10 = load i8*, i8** %4
%11 = load i8, i8* %10
%12 = call i64 @isdigit(i8 signext %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %40
14: ; preds = %3
%15 = load i8*, i8** %4
%16 = load i32, i32* %6
%17 = call i8* @numeral_alloc(i8* %15, i32 %16)
store i8* %17, i8** %8
%18 = call i8* @strsep(i8** %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %18, i8** %9
br label %19
19: ; preds = %35, %14
%20 = load i8*, i8** %9
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32, i32* %7
%24 = icmp slt i32 %23, 3
br label %25
25: ; preds = %22, %19
%26 = phi i1 [ false, %19 ], [ %24, %22 ]
br i1 %26, label %27, label %37
27: ; preds = %25
%28 = load i8*, i8** %9
%29 = load i8**, i8*** %5
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %29, i64 %31
store i8* %28, i8** %32
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
br label %35
35: ; preds = %27
%36 = call i8* @strsep(i8** %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %36, i8** %9
br label %19
37: ; preds = %25
%38 = load i8*, i8** %8
%39 = call i32 @free(i8* %38)
br label %40
40: ; preds = %37, %3
%41 = load i32, i32* %7
ret i32 %41
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define i32 @moral_regla10(i8* %0, i8** nocapture writeonly %1, i32 %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = load i8, i8* %0
%7 = tail call i64 @isdigit(i8 signext %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %28, label %9
9: ; preds = %3
%10 = tail call i8* @numeral_alloc(i8* %0, i32 %2)
store i8* %10, i8** %4
%11 = call i8* @strsep(i8** %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i8* %11, null
br i1 %12, label %24, label %13
13: ; preds = %9, %13
%14 = phi i64 [ %17, %13 ], [ 0, %9 ]
%15 = phi i8* [ %18, %13 ], [ %11, %9 ]
%16 = getelementptr inbounds i8*, i8** %1, i64 %14
store i8* %15, i8** %16
%17 = add nuw nsw i64 %14, 1
%18 = call i8* @strsep(i8** %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%19 = icmp ne i8* %18, null
%20 = icmp ult i64 %14, 2
%21 = select i1 %19, i1 %20, i1 false
br i1 %21, label %13, label %22
22: ; preds = %13
%23 = trunc i64 %17 to i32
br label %24
24: ; preds = %22, %9
%25 = phi i32 [ 0, %9 ], [ %23, %22 ]
%26 = load i8*, i8** %4
%27 = call i32 @free(i8* %26)
br label %28
28: ; preds = %24, %3
%29 = phi i32 [ %25, %24 ], [ 0, %3 ]
ret i32 %29
}