#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 */
scalar_t__ isspace(char const);
int sscanf(char const *, char *, void **, char *, int *);
int newfunction(const char *str) {
  char fname[161];
  void *ptr;
  int nbytes;
  if (isspace(str[0]))
    return (0);
  if (sscanf(str, "%p <%[^>:]>:%n", &ptr, fname, &nbytes) != 2)
    return (0);
  return (nbytes);
}


x86 assembly (clang, -O0):
<newfunction>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     1151 <newfunction+0x31>
movl   $0x0,-0x4(%rbp)
jmp    1194 <newfunction+0x74>
mov    -0x10(%rbp),%rdi
lea    -0xc0(%rbp),%rcx
lea    0xe9d(%rip),%rsi
lea    -0xc8(%rbp),%rdx
lea    -0xcc(%rbp),%r8
call   1040 <sscanf@plt>
cmp    $0x2,%eax
je     118b <newfunction+0x6b>
movl   $0x0,-0x4(%rbp)
jmp    1194 <newfunction+0x74>
mov    -0xcc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<newfunction>:
push   %rbx
sub    $0xc0,%rsp
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <isspace@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    1168 <newfunction+0x48>
lea    0xebc(%rip),%rsi
lea    0x8(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0x4(%rsp),%r8
mov    %rbx,%rdi
call   1040 <sscanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x2,%ecx
jne    1168 <newfunction+0x48>
mov    0x4(%rsp),%eax
add    $0xc0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%p <%[^>:]>:%n\00"
define i32 @newfunction(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [161 x i8]
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = call i64 @isspace(i8 signext %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %1
store i32 0, i32* %2
br label %21
13: ; preds = %1
%14 = load i8*, i8** %3
%15 = getelementptr inbounds [161 x i8], [161 x i8]* %4, i64 0, i64 0
%16 = call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %5, i8* %15, i32* %6)
%17 = icmp ne i32 %16, 2
br i1 %17, label %18, label %19
18: ; preds = %13
store i32 0, i32* %2
br label %21
19: ; preds = %13
%20 = load i32, i32* %6
store i32 %20, i32* %2
br label %21
21: ; preds = %19, %18, %12
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
@.str = [15 x i8] c"%p <%[^>:]>:%n\00"
define i32 @newfunction(i8* nocapture %0) {
%2 = alloca [161 x i8]
%3 = alloca i8*
%4 = alloca i32
%5 = getelementptr inbounds [161 x i8], [161 x i8]* %2, i64 0, i64 0
%6 = bitcast i8** %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = load i8, i8* %0
%9 = tail call i64 @isspace(i8 signext %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %1
%12 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %3, i8* %5, i32* %4)
%13 = icmp eq i32 %12, 2
%14 = load i32, i32* %4
%15 = select i1 %13, i32 %14, i32 0
br label %16
16: ; preds = %11, %1
%17 = phi i32 [ 0, %1 ], [ %15, %11 ]
ret i32 %17
}