#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*/ assert(int);
scalar_t__ strlen(char *);
int ee_get_num_len(char *eqn) {
  int i;
  for (i = 0; i < (signed int)strlen(eqn); i++)
    if (eqn[i] == ']')
      return (i + 1);
  assert("Should not be here!" && 0);
  return 0;
}


x86 assembly (clang, -O0):
<ee_get_num_len>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    1186 <ee_get_num_len+0x66>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5d,%eax
jne    1173 <ee_get_num_len+0x53>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11b9 <ee_get_num_len+0x99>
jmp    1178 <ee_get_num_len+0x58>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1133 <ee_get_num_len+0x13>
xor    %eax,%eax
mov    $0x1,%cl
test   $0x1,%cl
mov    %al,-0x19(%rbp)
jne    119b <ee_get_num_len+0x7b>
jmp    11a5 <ee_get_num_len+0x85>
xor    %eax,%eax
mov    %al,-0x19(%rbp)
jmp    11a5 <ee_get_num_len+0x85>
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ee_get_num_len>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %eax,%eax
jle    1150 <ee_get_num_len+0x30>
mov    %eax,%eax
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpb   $0x5d,(%r14,%rbx,1)
je     115b <ee_get_num_len+0x3b>
add    $0x1,%rbx
cmp    %rbx,%rax
jne    1140 <ee_get_num_len+0x20>
xor    %ebx,%ebx
xor    %edi,%edi
call   1040 <assert@plt>
jmp    115e <ee_get_num_len+0x3e>
add    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Should not be here!\00"
define i32 @ee_get_num_len(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
br label %5
5: ; preds = %23, %1
%6 = load i32, i32* %4
%7 = load i8*, i8** %3
%8 = call i64 @strlen(i8* %7)
%9 = trunc i64 %8 to i32
%10 = icmp slt i32 %6, %9
br i1 %10, label %11, label %26
11: ; preds = %5
%12 = load i8*, i8** %3
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 93
br i1 %18, label %19, label %22
19: ; preds = %11
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %32
22: ; preds = %11
br label %23
23: ; preds = %22
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %5
26: ; preds = %5
br i1 true, label %27, label %28
27: ; preds = %26
br label %28
28: ; preds = %27, %26
%29 = phi i1 [ false, %26 ], [ false, %27 ]
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
store i32 0, i32* %2
br label %32
32: ; preds = %28, %19
%33 = load i32, i32* %2
ret i32 %33
}

LLVM IR (-O2):
define i32 @ee_get_num_len(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = trunc i64 %2 to i32
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %18
5: ; preds = %1
%6 = and i64 %2, 4294967295
br label %7
7: ; preds = %5, %15
%8 = phi i64 [ 0, %5 ], [ %16, %15 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 93
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = trunc i64 %8 to i32
%14 = add nuw nsw i32 %13, 1
br label %20
15: ; preds = %7
%16 = add nuw nsw i64 %8, 1
%17 = icmp eq i64 %16, %6
br i1 %17, label %18, label %7
18: ; preds = %15, %1
%19 = tail call i32 @assert(i32 0)
br label %20
20: ; preds = %18, %12
%21 = phi i32 [ %14, %12 ], [ 0, %18 ]
ret i32 %21
}