#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 */
char *match(char *, char *);
size_t strlen(char *);
char *parse_l(char *string, size_t *count) {
  char *result;
  if (string == 0)
    return 0;
  if (count == 0)
    return 0;
  result = match(string, "^[0-9]{1,}");
  if (result == 0) {
    return (char *)0;
  }
  *count = strlen(result);
  return result;
}


x86 assembly (clang, -O0):
<parse_l>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1148 <parse_l+0x28>
movq   $0x0,-0x8(%rbp)
jmp    11a7 <parse_l+0x87>
cmpq   $0x0,-0x18(%rbp)
jne    1160 <parse_l+0x40>
movq   $0x0,-0x8(%rbp)
jmp    11a7 <parse_l+0x87>
mov    -0x10(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1040 <match@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    118c <parse_l+0x6c>
movq   $0x0,-0x8(%rbp)
jmp    11a7 <parse_l+0x87>
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_l>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
test   %rdi,%rdi
je     1156 <parse_l+0x36>
mov    %rsi,%r14
test   %rsi,%rsi
je     1156 <parse_l+0x36>
lea    0xec6(%rip),%rsi
call   1040 <match@plt>
test   %rax,%rax
je     1154 <parse_l+0x34>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <strlen@plt>
mov    %rax,(%r14)
jmp    1156 <parse_l+0x36>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [11 x i8] c"^[0-9]{1,}\00"
define i8* @parse_l(i8* %0, i64* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64*
%6 = alloca i8*
store i8* %0, i8** %4
store i64* %1, i64** %5
%7 = load i8*, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %2
store i8* null, i8** %3
br label %25
10: ; preds = %2
%11 = load i64*, i64** %5
%12 = icmp eq i64* %11, null
br i1 %12, label %13, label %14
13: ; preds = %10
store i8* null, i8** %3
br label %25
14: ; preds = %10
%15 = load i8*, i8** %4
%16 = call i8* @match(i8* %15, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i8* %16, i8** %6
%17 = load i8*, i8** %6
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %20
19: ; preds = %14
store i8* null, i8** %3
br label %25
20: ; preds = %14
%21 = load i8*, i8** %6
%22 = call i64 @strlen(i8* %21)
%23 = load i64*, i64** %5
store i64 %22, i64* %23
%24 = load i8*, i8** %6
store i8* %24, i8** %3
br label %25
25: ; preds = %20, %19, %13, %9
%26 = load i8*, i8** %3
ret i8* %26
}

LLVM IR (-O2):
@.str = [11 x i8] c"^[0-9]{1,}\00"
define i8* @parse_l(i8* %0, i64* writeonly %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i64* %1, null
%5 = or i1 %3, %4
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = tail call i8* @match(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i64 @strlen(i8* %7)
store i64 %10, i64* %1
br label %11
11: ; preds = %6, %2, %9
%12 = phi i8* [ %7, %9 ], [ null, %2 ], [ null, %6 ]
ret i8* %12
}