#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*/ chmatch(char, char *);
int /*<<< orphan*/ skipchars(char **, char *);
int parseAddrs(char *ptr, char **myaddr, char **heraddr) {
  if (!skipchars(&ptr, " \t"))
    return -1;
  *myaddr = ptr;
  if (!skipchars(&ptr, "1234567890"))
    return -1;
  if (!chmatch(*ptr, " \t,"))
    return -1;
  *ptr++ = '\0';
  if (!skipchars(&ptr, " \t,"))
    return -1;
  *heraddr = ptr;
  skipchars(&ptr, "1234567890");
  if (!chmatch(*ptr, " \n\r"))
    return -1;
  *ptr = '\0';
  return 0;
}


x86 assembly (clang, -O0):
<parseAddrs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
lea    -0x10(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1030 <skipchars@plt>
cmp    $0x0,%eax
jne    1159 <parseAddrs+0x39>
movl   $0xffffffff,-0x4(%rbp)
jmp    1239 <parseAddrs+0x119>
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
lea    -0x10(%rbp),%rdi
lea    0xe94(%rip),%rsi
call   1030 <skipchars@plt>
cmp    $0x0,%eax
jne    1189 <parseAddrs+0x69>
movl   $0xffffffff,-0x4(%rbp)
jmp    1239 <parseAddrs+0x119>
mov    -0x10(%rbp),%rax
lea    0xe7a(%rip),%rsi
movsbl (%rax),%edi
call   1040 <chmatch@plt>
cmp    $0x0,%eax
jne    11b1 <parseAddrs+0x91>
movl   $0xffffffff,-0x4(%rbp)
jmp    1239 <parseAddrs+0x119>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,(%rax)
lea    -0x10(%rbp),%rdi
lea    0xe40(%rip),%rsi
call   1030 <skipchars@plt>
cmp    $0x0,%eax
jne    11e8 <parseAddrs+0xc8>
movl   $0xffffffff,-0x4(%rbp)
jmp    1239 <parseAddrs+0x119>
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
lea    -0x10(%rbp),%rdi
lea    0xe05(%rip),%rsi
call   1030 <skipchars@plt>
mov    -0x10(%rbp),%rax
lea    0xe04(%rip),%rsi
movsbl (%rax),%edi
call   1040 <chmatch@plt>
cmp    $0x0,%eax
jne    122b <parseAddrs+0x10b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1239 <parseAddrs+0x119>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseAddrs>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,0x8(%rsp)
lea    0xec6(%rip),%rsi
lea    0x8(%rsp),%rdi
call   1030 <skipchars@plt>
mov    $0xffffffff,%ebp
test   %eax,%eax
je     11e7 <parseAddrs+0xc7>
mov    0x8(%rsp),%rax
mov    %rax,(%rbx)
lea    0xea3(%rip),%rsi
lea    0x8(%rsp),%rdi
call   1030 <skipchars@plt>
test   %eax,%eax
je     11e7 <parseAddrs+0xc7>
mov    0x8(%rsp),%rax
movsbl (%rax),%edi
lea    0xe91(%rip),%rsi
call   1040 <chmatch@plt>
test   %eax,%eax
je     11e7 <parseAddrs+0xc7>
mov    0x8(%rsp),%rax
lea    0x1(%rax),%rcx
mov    %rcx,0x8(%rsp)
movb   $0x0,(%rax)
lea    0xe70(%rip),%rsi
lea    0x8(%rsp),%rdi
call   1030 <skipchars@plt>
test   %eax,%eax
je     11e7 <parseAddrs+0xc7>
mov    0x8(%rsp),%rax
mov    %rax,(%r14)
lea    0xe48(%rip),%rsi
lea    0x8(%rsp),%rdi
call   1030 <skipchars@plt>
mov    0x8(%rsp),%rax
movsbl (%rax),%edi
lea    0xe3e(%rip),%rsi
call   1040 <chmatch@plt>
test   %eax,%eax
je     11e7 <parseAddrs+0xc7>
mov    0x8(%rsp),%rax
movb   $0x0,(%rax)
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c" \09\00"
@.str.1 = [11 x i8] c"1234567890\00"
@.str.2 = [4 x i8] c" \09,\00"
@.str.3 = [4 x i8] c" \0A\0D\00"
define i32 @parseAddrs(i8* %0, i8** nocapture writeonly %1, i8** nocapture writeonly %2) {
%4 = alloca i8*
store i8* %0, i8** %4
%5 = call i32 @skipchars(i8** %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %30, label %7
7: ; preds = %3
%8 = load i8*, i8** %4
store i8* %8, i8** %1
%9 = call i32 @skipchars(i8** %4, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %30, label %11
11: ; preds = %7
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = call i32 @chmatch(i8 signext %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %30, label %16
16: ; preds = %11
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i64 1
store i8* %18, i8** %4
store i8 0, i8* %17
%19 = call i32 @skipchars(i8** %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %30, label %21
21: ; preds = %16
%22 = load i8*, i8** %4
store i8* %22, i8** %2
%23 = call i32 @skipchars(i8** %4, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%24 = load i8*, i8** %4
%25 = load i8, i8* %24
%26 = call i32 @chmatch(i8 signext %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp eq i32 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %21
%29 = load i8*, i8** %4
store i8 0, i8* %29
br label %30
30: ; preds = %21, %16, %11, %7, %3, %28
%31 = phi i32 [ 0, %28 ], [ -1, %3 ], [ -1, %7 ], [ -1, %11 ], [ -1, %16 ], [ -1, %21 ]
ret i32 %31
}