#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 */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ptg_parse_ip_string(char const *);
char *strchr(char const *, char);
int /*<<< orphan*/ strncpy(char *, char const *, int);
void ptg_parse_ip_line(const char *lnstr, uint32_t *ip1, uint32_t *ip2) {
  char ipbuf[64] = {'\0'};
  char *sp;
  sp = strchr(lnstr, '-');
  if (sp == NULL) {
    *ip1 = *ip2 = ptg_parse_ip_string(lnstr);
  } else {
    strncpy(ipbuf, lnstr, sp - lnstr);
    *ip1 = ptg_parse_ip_string(ipbuf);
    *ip2 = ptg_parse_ip_string(sp + 1);
  }
}


x86 assembly (clang, -O0):
<ptg_parse_ip_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
mov    -0x8(%rbp),%rdi
mov    $0x2d,%esi
call   1040 <strchr@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
jne    119d <ptg_parse_ip_line+0x5d>
mov    -0x8(%rbp),%rdi
call   1060 <ptg_parse_ip_string@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    11dd <ptg_parse_ip_line+0x9d>
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x68(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1030 <strncpy@plt>
lea    -0x60(%rbp),%rdi
call   1060 <ptg_parse_ip_string@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x68(%rbp),%rdi
add    $0x1,%rdi
call   1060 <ptg_parse_ip_string@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ptg_parse_ip_line>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x40,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    $0x2d,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     119d <ptg_parse_ip_line+0x6d>
mov    %rax,%rbx
mov    %ebx,%edx
sub    %r12d,%edx
mov    %rsp,%r13
mov    %r13,%rdi
mov    %r12,%rsi
call   1030 <strncpy@plt>
mov    %r13,%rdi
call   1050 <ptg_parse_ip_string@plt>
mov    %eax,(%r15)
add    $0x1,%rbx
mov    %rbx,%rdi
call   1050 <ptg_parse_ip_string@plt>
mov    %eax,(%r14)
jmp    11ab <ptg_parse_ip_line+0x7b>
mov    %r12,%rdi
call   1050 <ptg_parse_ip_string@plt>
mov    %eax,(%r14)
mov    %eax,(%r15)
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @ptg_parse_ip_line(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca [64 x i8]
%8 = alloca i8*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%9 = bitcast [64 x i8]* %7 to i8*
%10 = load i8*, i8** %4
%11 = call i8* @strchr(i8* %10, i8 signext 45)
store i8* %11, i8** %8
%12 = load i8*, i8** %8
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %19
14: ; preds = %3
%15 = load i8*, i8** %4
%16 = call i32 @ptg_parse_ip_string(i8* %15)
%17 = load i32*, i32** %6
store i32 %16, i32* %17
%18 = load i32*, i32** %5
store i32 %16, i32* %18
br label %36
19: ; preds = %3
%20 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%21 = load i8*, i8** %4
%22 = load i8*, i8** %8
%23 = load i8*, i8** %4
%24 = ptrtoint i8* %22 to i64
%25 = ptrtoint i8* %23 to i64
%26 = sub i64 %24, %25
%27 = trunc i64 %26 to i32
%28 = call i32 @strncpy(i8* %20, i8* %21, i32 %27)
%29 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%30 = call i32 @ptg_parse_ip_string(i8* %29)
%31 = load i32*, i32** %5
store i32 %30, i32* %31
%32 = load i8*, i8** %8
%33 = getelementptr inbounds i8, i8* %32, i64 1
%34 = call i32 @ptg_parse_ip_string(i8* %33)
%35 = load i32*, i32** %6
store i32 %34, i32* %35
br label %36
36: ; preds = %19, %14
ret void
}

LLVM IR (-O2):
define void @ptg_parse_ip_line(i8* %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = alloca [64 x i8]
%5 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%6 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 45)
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = tail call i32 @ptg_parse_ip_string(i8* %0)
store i32 %9, i32* %2
store i32 %9, i32* %1
br label %19
10: ; preds = %3
%11 = ptrtoint i8* %6 to i64
%12 = ptrtoint i8* %0 to i64
%13 = sub i64 %11, %12
%14 = trunc i64 %13 to i32
%15 = call i32 @strncpy(i8* %5, i8* %0, i32 %14)
%16 = call i32 @ptg_parse_ip_string(i8* %5)
store i32 %16, i32* %1
%17 = getelementptr inbounds i8, i8* %6, i64 1
%18 = call i32 @ptg_parse_ip_string(i8* %17)
store i32 %18, i32* %2
br label %19
19: ; preds = %10, %8
ret void
}