#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int rm_so;
  int rm_eo;
};
typedef TYPE_1__ regmatch_t;
typedef int /*<<< orphan*/ regex_t;

/* Variables and functions */
int AF_INET;
int /*<<< orphan*/ EXIT_FAILURE;
size_t INET6_ADDRSTRLEN;
size_t INET_ADDRSTRLEN;
int /*<<< orphan*/ REG_EXTENDED;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
char *gettext(char *);
int inet_pton(int, char *, char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, size_t);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ regcomp(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ regexec(int /*<<< orphan*/ *, char *, int, TYPE_1__ *,
                           int /*<<< orphan*/);
int /*<<< orphan*/ regfree(int /*<<< orphan*/ *);
int /*<<< orphan*/ strncpy(char *, char *, int);
scalar_t__ strtoul(char *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ transfer_to_pdu(int, char *, char *, int *, int);
int /*<<< orphan*/ transfer_to_string(char *, char **, char *);
void ipParser(int ip_V4or6, char *optarg, char **combinedString,
              char *combinedBeacon, int *currentByte) {
  int IP_binaryLength = (ip_V4or6 == AF_INET) ? 5 : 17;
  size_t ip_strlen = (ip_V4or6 == AF_INET) ? INET_ADDRSTRLEN : INET6_ADDRSTRLEN;
  char foundAddress[ip_strlen];
  char ip_AddressesInBinary[200] = "";
  int gefundeneIPAdressenAnzahl = 0, endOfLastString = 0;
  regex_t compiled_regex;
  regmatch_t regex_matches_pointer[3];
  regex_matches_pointer[0].rm_so = regex_matches_pointer[0].rm_eo = 0;
  regcomp(&compiled_regex,
          ip_V4or6 == AF_INET ? "([0-9.]{7,15})\\/([0-9]{1,2})"
                              : "([a-fA-F0-9:]{4,45})\\/([0-9]{1,3})",
          REG_EXTENDED);
  while (1) {
    endOfLastString += regex_matches_pointer[0].rm_eo;
    if (gefundeneIPAdressenAnzahl < 10 &&
        !regexec(&compiled_regex, &optarg[endOfLastString], 3,
                 regex_matches_pointer, 0)) {
      memset(foundAddress, 0, ip_strlen);
      strncpy(foundAddress,
              &optarg[endOfLastString + regex_matches_pointer[1].rm_so],
              regex_matches_pointer[1].rm_eo - regex_matches_pointer[1].rm_so);
      if (1 != inet_pton(ip_V4or6, foundAddress,
                         &ip_AddressesInBinary[gefundeneIPAdressenAnzahl *
                                               IP_binaryLength]))
        printf(gettext("Error Parsing IP-address: %s\n"), optarg);
      memset(foundAddress, 0, ip_strlen);
      strncpy(foundAddress,
              &optarg[endOfLastString + regex_matches_pointer[2].rm_so],
              regex_matches_pointer[2].rm_eo - regex_matches_pointer[2].rm_so);
      ip_AddressesInBinary[gefundeneIPAdressenAnzahl * IP_binaryLength +
                           IP_binaryLength - 1] =
          (unsigned char)strtoul(foundAddress, NULL, 10);
      gefundeneIPAdressenAnzahl++;
    } else
      break;
  }
  transfer_to_string(ip_V4or6 == AF_INET ? gettext("IPv4:") : gettext("IPv6:"),
                     combinedString, optarg);
  transfer_to_pdu(ip_V4or6 == AF_INET ? 203 : 204, ip_AddressesInBinary,
                  combinedBeacon, currentByte,
                  gefundeneIPAdressenAnzahl * IP_binaryLength);
  if (gefundeneIPAdressenAnzahl < 1) {
    printf(
        gettext(
            "Exiting since no valid IP networks (format e.g. 192.168.178.1/24) "
            "could be found in provided string \"%s\". \n"),
        optarg);
    exit(EXIT_FAILURE);
  }
  regfree(&compiled_regex);
  return;
}


x86 assembly (clang, -O0):
<ipParser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%edx
mov    0x2df8(%rip),%rax
mov    (%rax),%esi
mov    $0x11,%eax
mov    $0x5,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2dda(%rip),%rcx
cmp    (%rcx),%eax
jne    1224 <ipParser+0x64>
mov    0x2dbb(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x148(%rbp)
jmp    1235 <ipParser+0x75>
mov    0x2dbd(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x148(%rbp)
mov    -0x148(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rsp,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x150(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0xc8,%edx
call   1090 <memset@plt>
movl   $0x0,-0x114(%rbp)
movl   $0x0,-0x118(%rbp)
movl   $0x0,-0x13c(%rbp)
movl   $0x0,-0x140(%rbp)
mov    -0x4(%rbp),%ecx
mov    0x2d31(%rip),%rax
mov    (%rax),%edx
lea    0xd65(%rip),%rsi
lea    0xd41(%rip),%rax
cmp    %edx,%ecx
cmove  %rax,%rsi
mov    0x2cf4(%rip),%rax
mov    (%rax),%edx
lea    -0x11c(%rbp),%rdi
call   10a0 <regcomp@plt>
jmp    12df <ipParser+0x11f>
mov    -0x13c(%rbp),%eax
add    -0x118(%rbp),%eax
mov    %eax,-0x118(%rbp)
cmpl   $0xa,-0x114(%rbp)
jge    143e <ipParser+0x27e>
mov    -0x10(%rbp),%rsi
movslq -0x118(%rbp),%rax
add    %rax,%rsi
lea    -0x140(%rbp),%rcx
lea    -0x11c(%rbp),%rdi
mov    $0x3,%edx
xor    %r8d,%r8d
call   10c0 <regexec@plt>
cmp    $0x0,%eax
jne    143e <ipParser+0x27e>
mov    -0x150(%rbp),%rdi
mov    -0x38(%rbp),%rdx
xor    %esi,%esi
call   1090 <memset@plt>
mov    -0x150(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x118(%rbp),%eax
add    -0x138(%rbp),%eax
cltq
add    %rax,%rsi
mov    -0x134(%rbp),%edx
sub    -0x138(%rbp),%edx
call   1040 <strncpy@plt>
mov    -0x150(%rbp),%rsi
mov    -0x4(%rbp),%edi
mov    -0x114(%rbp),%eax
imul   -0x2c(%rbp),%eax
cltq
lea    -0x110(%rbp),%rdx
add    %rax,%rdx
call   10b0 <inet_pton@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
je     13bb <ipParser+0x1fb>
lea    0xc96(%rip),%rdi
call   1070 <gettext@plt>
mov    %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1080 <printf@plt>
mov    -0x150(%rbp),%rdi
mov    -0x38(%rbp),%rdx
xor    %esi,%esi
call   1090 <memset@plt>
mov    -0x150(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x118(%rbp),%eax
add    -0x130(%rbp),%eax
cltq
add    %rax,%rsi
mov    -0x12c(%rbp),%edx
sub    -0x130(%rbp),%edx
call   1040 <strncpy@plt>
mov    -0x150(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10d0 <strtoul@plt>
mov    %al,%cl
mov    -0x114(%rbp),%eax
imul   -0x2c(%rbp),%eax
add    -0x2c(%rbp),%eax
sub    $0x1,%eax
cltq
mov    %cl,-0x110(%rbp,%rax,1)
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    1443 <ipParser+0x283>
jmp    1448 <ipParser+0x288>
jmp    12da <ipParser+0x11a>
mov    -0x4(%rbp),%eax
mov    0x2b8e(%rip),%rcx
cmp    (%rcx),%eax
jne    1472 <ipParser+0x2b2>
lea    0xbfd(%rip),%rdi
call   1070 <gettext@plt>
mov    %rax,-0x158(%rbp)
jmp    1485 <ipParser+0x2c5>
lea    0xbeb(%rip),%rdi
call   1070 <gettext@plt>
mov    %rax,-0x158(%rbp)
mov    -0x158(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <transfer_to_string@plt>
mov    -0x4(%rbp),%ecx
mov    0x2b3d(%rip),%rax
mov    (%rax),%edx
mov    $0xcc,%edi
mov    $0xcb,%eax
cmp    %edx,%ecx
cmove  %eax,%edi
lea    -0x110(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x114(%rbp),%r8d
imul   -0x2c(%rbp),%r8d
call   1050 <transfer_to_pdu@plt>
cmpl   $0x1,-0x114(%rbp)
jge    1507 <ipParser+0x347>
lea    0xb82(%rip),%rdi
call   1070 <gettext@plt>
mov    %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1080 <printf@plt>
mov    0x2ac8(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
lea    -0x11c(%rbp),%rdi
call   1060 <regfree@plt>
mov    -0x40(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipParser>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x128,%rsp
mov    0x2e05(%rip),%rax
mov    %edi,-0x2c(%rbp)
cmp    %edi,(%rax)
mov    $0x5,%eax
mov    $0x11,%ebx
cmove  %eax,%ebx
mov    0x2df4(%rip),%rax
cmove  0x2dd4(%rip),%rax
mov    %r8,-0x78(%rbp)
mov    %rcx,-0x70(%rbp)
mov    %rdx,-0x68(%rbp)
mov    %rsi,-0x40(%rbp)
mov    (%rax),%rcx
lea    0xdea(%rip),%rax
lea    0xe00(%rip),%rsi
cmove  %rax,%rsi
mov    %rcx,-0x48(%rbp)
lea    0xf(%rcx),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%r15
sub    %rax,%r15
mov    %r15,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,-0xa0(%rbp)
movaps %xmm0,-0xb0(%rbp)
movaps %xmm0,-0xc0(%rbp)
movaps %xmm0,-0xd0(%rbp)
movaps %xmm0,-0xe0(%rbp)
movaps %xmm0,-0xf0(%rbp)
movaps %xmm0,-0x100(%rbp)
movaps %xmm0,-0x110(%rbp)
movaps %xmm0,-0x120(%rbp)
movaps %xmm0,-0x130(%rbp)
movaps %xmm0,-0x140(%rbp)
movaps %xmm0,-0x150(%rbp)
movq   $0x0,-0x90(%rbp)
movq   $0x0,-0x60(%rbp)
mov    0x2d19(%rip),%rax
mov    (%rax),%edx
lea    -0x30(%rbp),%rdi
call   10a0 <regcomp@plt>
mov    %rbx,-0x38(%rbp)
lea    -0x1(%rbx),%eax
mov    %rax,-0x80(%rbp)
xor    %r14d,%r14d
lea    -0x150(%rbp),%r13
xor    %r12d,%r12d
jmp    132b <ipParser+0x16b>
nopl   0x0(%rax)
mov    %r15,%rdi
xor    %esi,%esi
mov    -0x48(%rbp),%rdx
call   1090 <memset@plt>
mov    -0x50(%rbp),%eax
mov    -0x4c(%rbp),%edx
lea    (%rax,%r12,1),%ecx
movslq %ecx,%rsi
add    %rbx,%rsi
sub    %eax,%edx
mov    %r15,%rdi
call   1040 <strncpy@plt>
mov    $0xa,%ebx
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10d0 <strtoul@plt>
mov    -0x80(%rbp),%rcx
mov    %al,0x0(%r13,%rcx,1)
add    $0x1,%r14
add    -0x5c(%rbp),%r12d
add    -0x38(%rbp),%r13
cmp    $0xa,%r14
je     13ac <ipParser+0x1ec>
movslq %r12d,%rsi
mov    -0x40(%rbp),%rbx
add    %rbx,%rsi
lea    -0x30(%rbp),%rdi
mov    $0x3,%edx
lea    -0x60(%rbp),%rcx
xor    %r8d,%r8d
call   10c0 <regexec@plt>
test   %eax,%eax
jne    13a9 <ipParser+0x1e9>
mov    %r15,%rdi
xor    %esi,%esi
mov    -0x48(%rbp),%rdx
call   1090 <memset@plt>
mov    -0x58(%rbp),%eax
mov    -0x54(%rbp),%edx
lea    (%rax,%r12,1),%ecx
movslq %ecx,%rsi
add    %rbx,%rsi
sub    %eax,%edx
mov    %r15,%rdi
call   1040 <strncpy@plt>
mov    -0x2c(%rbp),%edi
mov    %r15,%rsi
mov    %r13,%rdx
call   10b0 <inet_pton@plt>
cmp    $0x1,%eax
je     12d0 <ipParser+0x110>
lea    0xcac(%rip),%rdi
call   1070 <gettext@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1080 <printf@plt>
jmp    12d0 <ipParser+0x110>
mov    %r14d,%ebx
mov    -0x2c(%rbp),%r14d
mov    0x2c29(%rip),%r15
cmp    %r14d,(%r15)
lea    0xc9d(%rip),%rax
lea    0xc9c(%rip),%rdi
cmove  %rax,%rdi
call   1070 <gettext@plt>
mov    %rax,%rdi
mov    -0x68(%rbp),%rsi
mov    -0x40(%rbp),%r12
mov    %r12,%rdx
call   1030 <transfer_to_string@plt>
xor    %eax,%eax
cmp    %r14d,(%r15)
sete   %al
mov    $0xcc,%edi
sub    %eax,%edi
mov    -0x38(%rbp),%r8
imul   %ebx,%r8d
lea    -0x150(%rbp),%rsi
mov    -0x70(%rbp),%rdx
mov    -0x78(%rbp),%rcx
call   1050 <transfer_to_pdu@plt>
test   %ebx,%ebx
je     142b <ipParser+0x26b>
lea    -0x30(%rbp),%rdi
call   1060 <regfree@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc38(%rip),%rdi
call   1070 <gettext@plt>
mov    %rax,%rdi
mov    %r12,%rsi
call   1080 <printf@plt>
mov    0x2b7f(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32 }
@AF_INET = global i32 0
@INET_ADDRSTRLEN = global i64 0
@INET6_ADDRSTRLEN = global i64 0
@.str = [29 x i8] c"([0-9.]{7,15})\\/([0-9]{1,2})\00"
@.str.1 = [35 x i8] c"([a-fA-F0-9:]{4,45})\\/([0-9]{1,3})\00"
@REG_EXTENDED = global i32 0
@.str.2 = [30 x i8] c"Error Parsing IP-address: %s\0A\00"
@.str.3 = [6 x i8] c"IPv4:\00"
@.str.4 = [6 x i8] c"IPv6:\00"
@.str.5 = [108 x i8] c"Exiting since no valid IP networks (format e.g. 192.168.178.1/24) could be found in provided string \22%s\22. \0A\00"
@EXIT_FAILURE = global i32 0
define void @ipParser(i32 %0, i8* %1, i8** %2, i8* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8**
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i64
%13 = alloca i8*
%14 = alloca i64
%15 = alloca [200 x i8]
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca [3 x %struct.TYPE_3__]
store i32 %0, i32* %6
store i8* %1, i8** %7
store i8** %2, i8*** %8
store i8* %3, i8** %9
store i32* %4, i32** %10
%20 = load i32, i32* %6
%21 = load i32, i32* @AF_INET
%22 = icmp eq i32 %20, %21
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 5, i32 17
store i32 %24, i32* %11
%25 = load i32, i32* %6
%26 = load i32, i32* @AF_INET
%27 = icmp eq i32 %25, %26
br i1 %27, label %28, label %30
28: ; preds = %5
%29 = load i64, i64* @INET_ADDRSTRLEN
br label %32
30: ; preds = %5
%31 = load i64, i64* @INET6_ADDRSTRLEN
br label %32
32: ; preds = %30, %28
%33 = phi i64 [ %29, %28 ], [ %31, %30 ]
store i64 %33, i64* %12
%34 = load i64, i64* %12
%35 = call i8* @llvm.stacksave()
store i8* %35, i8** %13
%36 = alloca i8, i64 %34
store i64 %34, i64* %14
%37 = bitcast [200 x i8]* %15 to i8*
store i32 0, i32* %16
store i32 0, i32* %17
%38 = getelementptr inbounds [3 x %struct.TYPE_3__], [3 x %struct.TYPE_3__]* %19, i64 0, i64 0
%39 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %38, i32 0, i32 1
store i32 0, i32* %39
%40 = getelementptr inbounds [3 x %struct.TYPE_3__], [3 x %struct.TYPE_3__]* %19, i64 0, i64 0
%41 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %40, i32 0, i32 0
store i32 0, i32* %41
%42 = load i32, i32* %6
%43 = load i32, i32* @AF_INET
%44 = icmp eq i32 %42, %43
%45 = zext i1 %44 to i64
%46 = select i1 %44, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0)
%47 = load i32, i32* @REG_EXTENDED
%48 = call i32 @regcomp(i32* %18, i8* %46, i32 %47)
br label %49
49: ; preds = %129, %32
br label %50
50: ; preds = %49
%51 = getelementptr inbounds [3 x %struct.TYPE_3__], [3 x %struct.TYPE_3__]* %19, i64 0, i64 0
%52 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %51, i32 0, i32 1
%53 = load i32, i32* %52
%54 = load i32, i32* %17
%55 = add nsw i32 %54, %53
store i32 %55, i32* %17
%56 = load i32, i32* %16
%57 = icmp slt i32 %56, 10
br i1 %57, label %58, label %128
58: ; preds = %50
%59 = load i8*, i8** %7
%60 = load i32, i32* %17
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %59, i64 %61
%63 = getelementptr inbounds [3 x %struct.TYPE_3__], [3 x %struct.TYPE_3__]* %19, i64 0, i64 0
%64 = call i32 @regexec(i32* %18, i8* %62, i32 3, %struct.TYPE_3__* %63, i32 0)
%65 = icmp ne i32 %64, 0
br i1 %65, label %128, label %66
66: ; preds = %58
%67 = load i64, i64* %12
%68 = call i32 @memset(i8* %36, i32 0, i64 %67)
%69 = load i8*, i8** %7
%70 = load i32, i32* %17
%71 = getelementptr inbounds [3 x %struct.TYPE_3__], [3 x %struct.TYPE_3__]* %19, i64 0, i64 1
%72 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %71, i32 0, i32 0
%73 = load i32, i32* %72
%74 = add nsw i32 %70, %73
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8, i8* %69, i64 %75
%77 = getelementptr inbounds [3 x %struct.TYPE_3__], [3 x %struct.TYPE_3__]* %19, i64 0, i64 1
%78 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %77, i32 0, i32 1
%79 = load i32, i32* %78
%80 = getelementptr inbounds [3 x %struct.TYPE_3__], [3 x %struct.TYPE_3__]* %19, i64 0, i64 1
%81 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %80, i32 0, i32 0
%82 = load i32, i32* %81
%83 = sub nsw i32 %79, %82
%84 = call i32 @strncpy(i8* %36, i8* %76, i32 %83)
%85 = load i32, i32* %6
%86 = load i32, i32* %16
%87 = load i32, i32* %11
%88 = mul nsw i32 %86, %87
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [200 x i8], [200 x i8]* %15, i64 0, i64 %89
%91 = call i32 @inet_pton(i32 %85, i8* %36, i8* %90)
%92 = icmp ne i32 1, %91
br i1 %92, label %93, label %97
93: ; preds = %66
%94 = call i8* @gettext(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%95 = load i8*, i8** %7
%96 = call i32 @printf(i8* %94, i8* %95)
br label %97
97: ; preds = %93, %66
%98 = load i64, i64* %12
%99 = call i32 @memset(i8* %36, i32 0, i64 %98)
%100 = load i8*, i8** %7
%101 = load i32, i32* %17
%102 = getelementptr inbounds [3 x %struct.TYPE_3__], [3 x %struct.TYPE_3__]* %19, i64 0, i64 2
%103 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %102, i32 0, i32 0
%104 = load i32, i32* %103
%105 = add nsw i32 %101, %104
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i8, i8* %100, i64 %106
%108 = getelementptr inbounds [3 x %struct.TYPE_3__], [3 x %struct.TYPE_3__]* %19, i64 0, i64 2
%109 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %108, i32 0, i32 1
%110 = load i32, i32* %109
%111 = getelementptr inbounds [3 x %struct.TYPE_3__], [3 x %struct.TYPE_3__]* %19, i64 0, i64 2
%112 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %111, i32 0, i32 0
%113 = load i32, i32* %112
%114 = sub nsw i32 %110, %113
%115 = call i32 @strncpy(i8* %36, i8* %107, i32 %114)
%116 = call i64 @strtoul(i8* %36, i32* null, i32 10)
%117 = trunc i64 %116 to i8
%118 = load i32, i32* %16
%119 = load i32, i32* %11
%120 = mul nsw i32 %118, %119
%121 = load i32, i32* %11
%122 = add nsw i32 %120, %121
%123 = sub nsw i32 %122, 1
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds [200 x i8], [200 x i8]* %15, i64 0, i64 %124
store i8 %117, i8* %125
%126 = load i32, i32* %16
%127 = add nsw i32 %126, 1
store i32 %127, i32* %16
br label %129
128: ; preds = %58, %50
br label %130
129: ; preds = %97
br label %49
130: ; preds = %128
%131 = load i32, i32* %6
%132 = load i32, i32* @AF_INET
%133 = icmp eq i32 %131, %132
br i1 %133, label %134, label %136
134: ; preds = %130
%135 = call i8* @gettext(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %138
136: ; preds = %130
%137 = call i8* @gettext(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %138
138: ; preds = %136, %134
%139 = phi i8* [ %135, %134 ], [ %137, %136 ]
%140 = load i8**, i8*** %8
%141 = load i8*, i8** %7
%142 = call i32 @transfer_to_string(i8* %139, i8** %140, i8* %141)
%143 = load i32, i32* %6
%144 = load i32, i32* @AF_INET
%145 = icmp eq i32 %143, %144
%146 = zext i1 %145 to i64
%147 = select i1 %145, i32 203, i32 204
%148 = getelementptr inbounds [200 x i8], [200 x i8]* %15, i64 0, i64 0
%149 = load i8*, i8** %9
%150 = load i32*, i32** %10
%151 = load i32, i32* %16
%152 = load i32, i32* %11
%153 = mul nsw i32 %151, %152
%154 = call i32 @transfer_to_pdu(i32 %147, i8* %148, i8* %149, i32* %150, i32 %153)
%155 = load i32, i32* %16
%156 = icmp slt i32 %155, 1
br i1 %156, label %157, label %163
157: ; preds = %138
%158 = call i8* @gettext(i8* getelementptr inbounds ([108 x i8], [108 x i8]* @.str.5, i64 0, i64 0))
%159 = load i8*, i8** %7
%160 = call i32 @printf(i8* %158, i8* %159)
%161 = load i32, i32* @EXIT_FAILURE
%162 = call i32 @exit(i32 %161)
unreachable
163: ; preds = %138
%164 = call i32 @regfree(i32* %18)
%165 = load i8*, i8** %13
ret void
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i32 }
@AF_INET = global i32 0
@INET_ADDRSTRLEN = global i64 0
@INET6_ADDRSTRLEN = global i64 0
@.str = [29 x i8] c"([0-9.]{7,15})\\/([0-9]{1,2})\00"
@.str.1 = [35 x i8] c"([a-fA-F0-9:]{4,45})\\/([0-9]{1,3})\00"
@REG_EXTENDED = global i32 0
@.str.2 = [30 x i8] c"Error Parsing IP-address: %s\0A\00"
@.str.3 = [6 x i8] c"IPv4:\00"
@.str.4 = [6 x i8] c"IPv6:\00"
@.str.5 = [108 x i8] c"Exiting since no valid IP networks (format e.g. 192.168.178.1/24) could be found in provided string \22%s\22. \0A\00"
@EXIT_FAILURE = global i32 0
define void @ipParser(i32 %0, i8* %1, i8** %2, i8* %3, i32* %4) {
%6 = alloca [200 x i8]
%7 = alloca i32
%8 = alloca [3 x %struct.TYPE_3__]
%9 = load i32, i32* @AF_INET
%10 = icmp eq i32 %9, %0
%11 = select i1 %10, i32 5, i32 17
%12 = load i64, i64* @INET_ADDRSTRLEN
%13 = load i64, i64* @INET6_ADDRSTRLEN
%14 = select i1 %10, i64 %12, i64 %13
%15 = alloca i8, i64 %14
%16 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%17 = bitcast i32* %7 to i8*
%18 = bitcast [3 x %struct.TYPE_3__]* %8 to i8*
%19 = getelementptr inbounds [3 x %struct.TYPE_3__], [3 x %struct.TYPE_3__]* %8, i64 0, i64 0
%20 = getelementptr inbounds [3 x %struct.TYPE_3__], [3 x %struct.TYPE_3__]* %8, i64 0, i64 0, i32 1
store i32 0, i32* %20
%21 = getelementptr inbounds [3 x %struct.TYPE_3__], [3 x %struct.TYPE_3__]* %8, i64 0, i64 0, i32 0
store i32 0, i32* %21
%22 = select i1 %10, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0)
%23 = load i32, i32* @REG_EXTENDED
%24 = call i32 @regcomp(i32* %7, i8* %22, i32 %23)
%25 = getelementptr inbounds [3 x %struct.TYPE_3__], [3 x %struct.TYPE_3__]* %8, i64 0, i64 1, i32 0
%26 = getelementptr inbounds [3 x %struct.TYPE_3__], [3 x %struct.TYPE_3__]* %8, i64 0, i64 1, i32 1
%27 = getelementptr inbounds [3 x %struct.TYPE_3__], [3 x %struct.TYPE_3__]* %8, i64 0, i64 2, i32 0
%28 = getelementptr inbounds [3 x %struct.TYPE_3__], [3 x %struct.TYPE_3__]* %8, i64 0, i64 2, i32 1
%29 = add nsw i32 %11, -1
%30 = zext i32 %11 to i64
%31 = zext i32 %29 to i64
br label %32
32: ; preds = %5, %55
%33 = phi i64 [ 0, %5 ], [ %68, %55 ]
%34 = phi i32 [ 0, %5 ], [ %70, %55 ]
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %1, i64 %35
%37 = call i32 @regexec(i32* %7, i8* %36, i32 3, %struct.TYPE_3__* %19, i32 0)
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %72
39: ; preds = %32
%40 = call i32 @memset(i8* %15, i32 0, i64 %14)
%41 = load i32, i32* %25
%42 = add nsw i32 %41, %34
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %1, i64 %43
%45 = load i32, i32* %26
%46 = sub nsw i32 %45, %41
%47 = call i32 @strncpy(i8* %15, i8* %44, i32 %46)
%48 = mul nuw nsw i64 %33, %30
%49 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 %48
%50 = call i32 @inet_pton(i32 %0, i8* %15, i8* %49)
%51 = icmp eq i32 %50, 1
br i1 %51, label %55, label %52
52: ; preds = %39
%53 = call i8* @gettext(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%54 = call i32 @printf(i8* %53, i8* %1)
br label %55
55: ; preds = %52, %39
%56 = call i32 @memset(i8* %15, i32 0, i64 %14)
%57 = load i32, i32* %27
%58 = add nsw i32 %57, %34
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %1, i64 %59
%61 = load i32, i32* %28
%62 = sub nsw i32 %61, %57
%63 = call i32 @strncpy(i8* %15, i8* %60, i32 %62)
%64 = call i64 @strtoul(i8* nocapture %15, i32* null, i32 10)
%65 = trunc i64 %64 to i8
%66 = add nuw nsw i64 %48, %31
%67 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 %66
store i8 %65, i8* %67
%68 = add nuw nsw i64 %33, 1
%69 = load i32, i32* %20
%70 = add nsw i32 %69, %34
%71 = icmp eq i64 %68, 10
br i1 %71, label %74, label %32
72: ; preds = %32
%73 = trunc i64 %33 to i32
br label %74
74: ; preds = %55, %72
%75 = phi i32 [ %73, %72 ], [ 10, %55 ]
%76 = load i32, i32* @AF_INET
%77 = icmp eq i32 %76, %0
%78 = select i1 %77, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0)
%79 = call i8* @gettext(i8* %78)
%80 = call i32 @transfer_to_string(i8* %79, i8** %2, i8* %1)
%81 = load i32, i32* @AF_INET
%82 = icmp eq i32 %81, %0
%83 = select i1 %82, i32 203, i32 204
%84 = mul nsw i32 %75, %11
%85 = call i32 @transfer_to_pdu(i32 %83, i8* %16, i8* %3, i32* %4, i32 %84)
%86 = icmp eq i32 %75, 0
br i1 %86, label %87, label %92
87: ; preds = %74
%88 = call i8* @gettext(i8* getelementptr inbounds ([108 x i8], [108 x i8]* @.str.5, i64 0, i64 0))
%89 = call i32 @printf(i8* %88, i8* %1)
%90 = load i32, i32* @EXIT_FAILURE
%91 = call i32 @exit(i32 %90)
unreachable
92: ; preds = %74
%93 = call i32 @regfree(i32* %7)
ret void
}