#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*/ convNumIP(char *, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, char *, char const);
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
void geraEndIPSR(const char *nIPBin, const char *maskBin, char *nIPSRDec,
                 char *nIPSRBin) {
  register char i = 0;
  *(nIPSRDec + 0) = '\0';
  *(nIPSRBin + 0) = '\0';
  while (*(maskBin + i) == '1') {
    sprintf(nIPSRBin,
            "%s"
            "%c",
            nIPSRBin, *(nIPBin + i));
    ++i;
  }
  while (strlen(nIPSRBin) < 32)
    strcat(nIPSRBin, "0");
  convNumIP(nIPSRDec, nIPSRBin, 1);
}


x86 assembly (clang, -O0):
<geraEndIPSR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movb   $0x0,-0x21(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movsbl -0x21(%rbp),%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x31,%eax
jne    11b2 <geraEndIPSR+0x72>
mov    -0x20(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x8(%rbp),%rax
movsbl -0x21(%rbp),%ecx
movslq %ecx,%rcx
lea    0xe64(%rip),%rsi
movsbl (%rax,%rcx,1),%ecx
call   1060 <sprintf@plt>
mov    -0x21(%rbp),%al
add    $0x1,%al
mov    %al,-0x21(%rbp)
jmp    116a <geraEndIPSR+0x2a>
jmp    11b7 <geraEndIPSR+0x77>
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x20,%eax
jge    11de <geraEndIPSR+0x9e>
mov    -0x20(%rbp),%rdi
lea    0xe31(%rip),%rsi
call   1050 <strcat@plt>
jmp    11b7 <geraEndIPSR+0x77>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x1,%edx
call   1030 <convNumIP@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geraEndIPSR>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdx,%r14
movb   $0x0,(%rdx)
movb   $0x0,(%rcx)
cmpb   $0x31,(%rsi)
jne    1192 <geraEndIPSR+0x52>
mov    %rsi,%r15
mov    %rdi,%r12
xor    %ebp,%ebp
lea    0xe95(%rip),%r13
nopl   0x0(%rax,%rax,1)
movsbl (%r12,%rbp,1),%ecx
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1060 <sprintf@plt>
add    $0x1,%bpl
movsbq %bpl,%rbp
cmpb   $0x31,(%r15,%rbp,1)
je     1170 <geraEndIPSR+0x30>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x1f,%eax
jg     11c8 <geraEndIPSR+0x88>
lea    0xe5f(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x20,%eax
jl     11b0 <geraEndIPSR+0x70>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <convNumIP@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%s%c\00"
@.str.1 = [2 x i8] c"0\00"
define void @geraEndIPSR(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
store i8 0, i8* %9
%10 = load i8*, i8** %7
%11 = getelementptr inbounds i8, i8* %10, i64 0
store i8 0, i8* %11
%12 = load i8*, i8** %8
%13 = getelementptr inbounds i8, i8* %12, i64 0
store i8 0, i8* %13
br label %14
14: ; preds = %23, %4
%15 = load i8*, i8** %6
%16 = load i8, i8* %9
%17 = sext i8 %16 to i32
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %15, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 49
br i1 %22, label %23, label %35
23: ; preds = %14
%24 = load i8*, i8** %8
%25 = load i8*, i8** %8
%26 = load i8*, i8** %5
%27 = load i8, i8* %9
%28 = sext i8 %27 to i32
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %26, i64 %29
%31 = load i8, i8* %30
%32 = call i32 @sprintf(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %25, i8 signext %31)
%33 = load i8, i8* %9
%34 = add i8 %33, 1
store i8 %34, i8* %9
br label %14
35: ; preds = %14
br label %36
36: ; preds = %40, %35
%37 = load i8*, i8** %8
%38 = call i32 @strlen(i8* %37)
%39 = icmp slt i32 %38, 32
br i1 %39, label %40, label %43
40: ; preds = %36
%41 = load i8*, i8** %8
%42 = call i32 @strcat(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %36
43: ; preds = %36
%44 = load i8*, i8** %7
%45 = load i8*, i8** %8
%46 = call i32 @convNumIP(i8* %44, i8* %45, i32 1)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s%c\00"
@.str.1 = [2 x i8] c"0\00"
define void @geraEndIPSR(i8* nocapture %0, i8* nocapture %1, i8* %2, i8* %3) {
store i8 0, i8* %2
store i8 0, i8* %3
%5 = load i8, i8* %1
%6 = icmp eq i8 %5, 49
br i1 %6, label %10, label %7
7: ; preds = %10, %4
%8 = tail call i32 @strlen(i8* %3)
%9 = icmp slt i32 %8, 32
br i1 %9, label %21, label %25
10: ; preds = %4, %10
%11 = phi i64 [ %17, %10 ], [ 0, %4 ]
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = tail call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %3, i8 signext %13)
%15 = shl nsw i64 %11, 56
%16 = add i64 %15, 72057594037927936
%17 = ashr exact i64 %16, 56
%18 = getelementptr inbounds i8, i8* %1, i64 %17
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 49
br i1 %20, label %10, label %7
21: ; preds = %7, %21
%22 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%23 = tail call i32 @strlen(i8* %3)
%24 = icmp slt i32 %23, 32
br i1 %24, label %21, label %25
25: ; preds = %21, %7
%26 = tail call i32 @convNumIP(i8* %2, i8* %3, i32 1)
ret void
}