#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 btp_parse_unsigned_integer(char const **, unsigned int *);
int /*<<< orphan*/ btp_skip_char(char const **, char);
int btp_skip_char_sequence(char const **, char);
int btp_frame_parse_frame_start(const char **input, unsigned *number) {
  const char *local_input = *input;
  if (!btp_skip_char(&local_input, '#'))
    return 0;
  int count = 1;
  int digits = btp_parse_unsigned_integer(&local_input, number);
  count += digits;
  if (0 == digits)
    return 0;
  int spaces = btp_skip_char_sequence(&local_input, ' ');
  count += spaces;
  if (0 == spaces)
    return 0;
  *input = local_input;
  return count;
}


x86 assembly (clang, -O0):
<btp_frame_parse_frame_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x23,%esi
call   1040 <btp_skip_char@plt>
cmp    $0x0,%eax
jne    116e <btp_frame_parse_frame_start+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    11e7 <btp_frame_parse_frame_start+0xb7>
movl   $0x1,-0x24(%rbp)
mov    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdi
call   1050 <btp_parse_unsigned_integer@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
xor    %eax,%eax
cmp    -0x28(%rbp),%eax
jne    11a5 <btp_frame_parse_frame_start+0x75>
movl   $0x0,-0x4(%rbp)
jmp    11e7 <btp_frame_parse_frame_start+0xb7>
lea    -0x20(%rbp),%rdi
mov    $0x20,%esi
call   1030 <btp_skip_char_sequence@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
xor    %eax,%eax
cmp    -0x2c(%rbp),%eax
jne    11d6 <btp_frame_parse_frame_start+0xa6>
movl   $0x0,-0x4(%rbp)
jmp    11e7 <btp_frame_parse_frame_start+0xb7>
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btp_frame_parse_frame_start>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rdi),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x23,%esi
call   1040 <btp_skip_char@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     118f <btp_frame_parse_frame_start+0x5f>
lea    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   1050 <btp_parse_unsigned_integer@plt>
test   %eax,%eax
je     118f <btp_frame_parse_frame_start+0x5f>
mov    %eax,%ebx
lea    0x8(%rsp),%rdi
mov    $0x20,%esi
call   1030 <btp_skip_char_sequence@plt>
test   %eax,%eax
je     118f <btp_frame_parse_frame_start+0x5f>
lea    (%rbx,%rax,1),%ebp
add    $0x1,%ebp
mov    0x8(%rsp),%rax
mov    %rax,(%r14)
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @btp_frame_parse_frame_start(i8** %0, i32* %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8** %0, i8*** %4
store i32* %1, i32** %5
%10 = load i8**, i8*** %4
%11 = load i8*, i8** %10
store i8* %11, i8** %6
%12 = call i32 @btp_skip_char(i8** %6, i8 signext 35)
%13 = icmp ne i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %2
store i32 0, i32* %3
br label %36
15: ; preds = %2
store i32 1, i32* %7
%16 = load i32*, i32** %5
%17 = call i32 @btp_parse_unsigned_integer(i8** %6, i32* %16)
store i32 %17, i32* %8
%18 = load i32, i32* %8
%19 = load i32, i32* %7
%20 = add nsw i32 %19, %18
store i32 %20, i32* %7
%21 = load i32, i32* %8
%22 = icmp eq i32 0, %21
br i1 %22, label %23, label %24
23: ; preds = %15
store i32 0, i32* %3
br label %36
24: ; preds = %15
%25 = call i32 @btp_skip_char_sequence(i8** %6, i8 signext 32)
store i32 %25, i32* %9
%26 = load i32, i32* %9
%27 = load i32, i32* %7
%28 = add nsw i32 %27, %26
store i32 %28, i32* %7
%29 = load i32, i32* %9
%30 = icmp eq i32 0, %29
br i1 %30, label %31, label %32
31: ; preds = %24
store i32 0, i32* %3
br label %36
32: ; preds = %24
%33 = load i8*, i8** %6
%34 = load i8**, i8*** %4
store i8* %33, i8** %34
%35 = load i32, i32* %7
store i32 %35, i32* %3
br label %36
36: ; preds = %32, %31, %23, %14
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
define i32 @btp_frame_parse_frame_start(i8** nocapture %0, i32* %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = load i8*, i8** %0
store i8* %5, i8** %3
%6 = call i32 @btp_skip_char(i8** %3, i8 signext 35)
%7 = icmp eq i32 %6, 0
br i1 %7, label %18, label %8
8: ; preds = %2
%9 = call i32 @btp_parse_unsigned_integer(i8** %3, i32* %1)
%10 = icmp eq i32 %9, 0
br i1 %10, label %18, label %11
11: ; preds = %8
%12 = call i32 @btp_skip_char_sequence(i8** %3, i8 signext 32)
%13 = icmp eq i32 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %11
%15 = add nsw i32 %9, 1
%16 = add nsw i32 %15, %12
%17 = load i8*, i8** %3
store i8* %17, i8** %0
br label %18
18: ; preds = %8, %11, %14, %2
%19 = phi i32 [ 0, %2 ], [ 0, %8 ], [ %16, %14 ], [ 0, %11 ]
ret i32 %19
}