#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 */
unsigned long atol(char *);
int /*<<< orphan*/ paraDec(char *, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, char *, char const);
unsigned long int geraNumRelRede(const char *nIPBin, const char cIP) {
  register char i;
  char auxBin[32] = "\0", auxDec[10] = "\0";
  switch (cIP) {
  case 'A':
    for (i = 0; i <= 7; i++)
      sprintf(auxBin,
              "%s"
              "%c",
              auxBin, *(nIPBin + i));
    paraDec(auxBin, auxDec, 2);
    return atol(auxDec);
    break;
  case 'B':
    for (i = 0; i <= 15; i++)
      sprintf(auxBin,
              "%s"
              "%c",
              auxBin, *(nIPBin + i));
    paraDec(auxBin, auxDec, 2);
    return atol(auxDec);
    break;
  case 'C':
    for (i = 0; i <= 23; i++)
      sprintf(auxBin,
              "%s"
              "%c",
              auxBin, *(nIPBin + i));
    paraDec(auxBin, auxDec, 2);
    return atol(auxDec);
    break;
  default:
    return 0;
    break;
  }
}


x86 assembly (clang, -O0):
<geraNumRelRede>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
xorps  %xmm0,%xmm0
movaps %xmm0,-0x30(%rbp)
movaps %xmm0,-0x40(%rbp)
movw   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
movsbl -0x11(%rbp),%eax
mov    %eax,-0x54(%rbp)
sub    $0x41,%eax
je     1192 <geraNumRelRede+0x62>
jmp    1170 <geraNumRelRede+0x40>
mov    -0x54(%rbp),%eax
sub    $0x42,%eax
je     11f7 <geraNumRelRede+0xc7>
jmp    1181 <geraNumRelRede+0x51>
mov    -0x54(%rbp),%eax
sub    $0x43,%eax
je     125c <geraNumRelRede+0x12c>
jmp    12c1 <geraNumRelRede+0x191>
movb   $0x0,-0x12(%rbp)
movsbl -0x12(%rbp),%eax
cmp    $0x7,%eax
jg     11d3 <geraNumRelRede+0xa3>
lea    -0x40(%rbp),%rdi
lea    -0x40(%rbp),%rdx
mov    -0x10(%rbp),%rax
movsbl -0x12(%rbp),%ecx
movslq %ecx,%rcx
lea    0xe43(%rip),%rsi
movsbl (%rax,%rcx,1),%ecx
call   1050 <sprintf@plt>
mov    -0x12(%rbp),%al
add    $0x1,%al
mov    %al,-0x12(%rbp)
jmp    1196 <geraNumRelRede+0x66>
lea    -0x40(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x2,%edx
call   1030 <paraDec@plt>
lea    -0x50(%rbp),%rdi
call   1040 <atol@plt>
mov    %rax,-0x8(%rbp)
jmp    12c9 <geraNumRelRede+0x199>
movb   $0x0,-0x12(%rbp)
movsbl -0x12(%rbp),%eax
cmp    $0xf,%eax
jg     1238 <geraNumRelRede+0x108>
lea    -0x40(%rbp),%rdi
lea    -0x40(%rbp),%rdx
mov    -0x10(%rbp),%rax
movsbl -0x12(%rbp),%ecx
movslq %ecx,%rcx
lea    0xdde(%rip),%rsi
movsbl (%rax,%rcx,1),%ecx
call   1050 <sprintf@plt>
mov    -0x12(%rbp),%al
add    $0x1,%al
mov    %al,-0x12(%rbp)
jmp    11fb <geraNumRelRede+0xcb>
lea    -0x40(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x2,%edx
call   1030 <paraDec@plt>
lea    -0x50(%rbp),%rdi
call   1040 <atol@plt>
mov    %rax,-0x8(%rbp)
jmp    12c9 <geraNumRelRede+0x199>
movb   $0x0,-0x12(%rbp)
movsbl -0x12(%rbp),%eax
cmp    $0x17,%eax
jg     129d <geraNumRelRede+0x16d>
lea    -0x40(%rbp),%rdi
lea    -0x40(%rbp),%rdx
mov    -0x10(%rbp),%rax
movsbl -0x12(%rbp),%ecx
movslq %ecx,%rcx
lea    0xd79(%rip),%rsi
movsbl (%rax,%rcx,1),%ecx
call   1050 <sprintf@plt>
mov    -0x12(%rbp),%al
add    $0x1,%al
mov    %al,-0x12(%rbp)
jmp    1260 <geraNumRelRede+0x130>
lea    -0x40(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0x2,%edx
call   1030 <paraDec@plt>
lea    -0x50(%rbp),%rdi
call   1040 <atol@plt>
mov    %rax,-0x8(%rbp)
jmp    12c9 <geraNumRelRede+0x199>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geraNumRelRede>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rdi,%r12
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movw   $0x0,0x28(%rsp)
movq   $0x0,0x20(%rsp)
cmp    $0x41,%esi
je     11a2 <geraNumRelRede+0x72>
cmp    $0x42,%esi
je     11e1 <geraNumRelRede+0xb1>
cmp    $0x43,%esi
jne    139e <geraNumRelRede+0x26e>
xor    %ebp,%ebp
lea    0xe86(%rip),%r14
lea    0x30(%rsp),%rbx
nop
movsbl (%r12,%rbp,1),%ecx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <sprintf@plt>
add    $0x1,%rbp
cmp    $0x18,%rbp
jne    1180 <geraNumRelRede+0x50>
jmp    137d <geraNumRelRede+0x24d>
mov    $0x7,%eax
mov    %rax,0x18(%rsp)
mov    $0x6,%eax
mov    %rax,0x10(%rsp)
mov    $0x5,%eax
mov    %rax,0x8(%rsp)
mov    $0x4,%eax
mov    %rax,(%rsp)
mov    $0x3,%ebx
mov    $0x2,%ebp
mov    $0x1,%r13d
mov    %r12,%rax
jmp    12c8 <geraNumRelRede+0x198>
movsbl (%r12),%ecx
lea    0xe13(%rip),%r14
lea    0x30(%rsp),%r15
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <sprintf@plt>
movsbl 0x1(%r12),%ecx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <sprintf@plt>
movsbl 0x2(%r12),%ecx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <sprintf@plt>
movsbl 0x3(%r12),%ecx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <sprintf@plt>
movsbl 0x4(%r12),%ecx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <sprintf@plt>
movsbl 0x5(%r12),%ecx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <sprintf@plt>
movsbl 0x6(%r12),%ecx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <sprintf@plt>
movsbl 0x7(%r12),%ecx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <sprintf@plt>
lea    0x8(%r12),%rax
mov    $0xf,%ecx
mov    %rcx,0x18(%rsp)
mov    $0xe,%ecx
mov    %rcx,0x10(%rsp)
mov    $0xd,%ecx
mov    %rcx,0x8(%rsp)
mov    $0xc,%ecx
mov    %rcx,(%rsp)
mov    $0xb,%ebx
mov    $0xa,%ebp
mov    $0x9,%r13d
movsbl (%rax),%ecx
lea    0xd2e(%rip),%r14
lea    0x30(%rsp),%r15
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <sprintf@plt>
movsbl (%r12,%r13,1),%ecx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <sprintf@plt>
movsbl (%r12,%rbp,1),%ecx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <sprintf@plt>
movsbl (%r12,%rbx,1),%ecx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <sprintf@plt>
mov    (%rsp),%rax
movsbl (%r12,%rax,1),%ecx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <sprintf@plt>
mov    0x8(%rsp),%rax
movsbl (%r12,%rax,1),%ecx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <sprintf@plt>
mov    0x10(%rsp),%rax
movsbl (%r12,%rax,1),%ecx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <sprintf@plt>
mov    0x18(%rsp),%rax
movsbl (%r12,%rax,1),%ecx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <sprintf@plt>
lea    0x30(%rsp),%rdi
lea    0x20(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x2,%edx
call   1030 <paraDec@plt>
mov    %rbx,%rdi
call   1040 <atol@plt>
jmp    13a0 <geraNumRelRede+0x270>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s%c\00"
define i64 @geraNumRelRede(i8* %0, i8 signext %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca [32 x i8]
%8 = alloca [10 x i8]
store i8* %0, i8** %4
store i8 %1, i8* %5
%9 = bitcast [32 x i8]* %7 to i8*
%10 = bitcast [10 x i8]* %8 to i8*
%11 = load i8, i8* %5
%12 = sext i8 %11 to i32
switch i32 %12, label %85 [
i32 65, label %13
i32 66, label %37
i32 67, label %61
]
13: ; preds = %2
store i8 0, i8* %6
br label %14
14: ; preds = %28, %13
%15 = load i8, i8* %6
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 7
br i1 %17, label %18, label %31
18: ; preds = %14
%19 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%20 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%21 = load i8*, i8** %4
%22 = load i8, i8* %6
%23 = sext i8 %22 to i32
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %21, i64 %24
%26 = load i8, i8* %25
%27 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %20, i8 signext %26)
br label %28
28: ; preds = %18
%29 = load i8, i8* %6
%30 = add i8 %29, 1
store i8 %30, i8* %6
br label %14
31: ; preds = %14
%32 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%33 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%34 = call i32 @paraDec(i8* %32, i8* %33, i32 2)
%35 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%36 = call i64 @atol(i8* %35)
store i64 %36, i64* %3
br label %86
37: ; preds = %2
store i8 0, i8* %6
br label %38
38: ; preds = %52, %37
%39 = load i8, i8* %6
%40 = sext i8 %39 to i32
%41 = icmp sle i32 %40, 15
br i1 %41, label %42, label %55
42: ; preds = %38
%43 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%44 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%45 = load i8*, i8** %4
%46 = load i8, i8* %6
%47 = sext i8 %46 to i32
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %45, i64 %48
%50 = load i8, i8* %49
%51 = call i32 @sprintf(i8* %43, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %44, i8 signext %50)
br label %52
52: ; preds = %42
%53 = load i8, i8* %6
%54 = add i8 %53, 1
store i8 %54, i8* %6
br label %38
55: ; preds = %38
%56 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%57 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%58 = call i32 @paraDec(i8* %56, i8* %57, i32 2)
%59 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%60 = call i64 @atol(i8* %59)
store i64 %60, i64* %3
br label %86
61: ; preds = %2
store i8 0, i8* %6
br label %62
62: ; preds = %76, %61
%63 = load i8, i8* %6
%64 = sext i8 %63 to i32
%65 = icmp sle i32 %64, 23
br i1 %65, label %66, label %79
66: ; preds = %62
%67 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%68 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%69 = load i8*, i8** %4
%70 = load i8, i8* %6
%71 = sext i8 %70 to i32
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8, i8* %69, i64 %72
%74 = load i8, i8* %73
%75 = call i32 @sprintf(i8* %67, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %68, i8 signext %74)
br label %76
76: ; preds = %66
%77 = load i8, i8* %6
%78 = add i8 %77, 1
store i8 %78, i8* %6
br label %62
79: ; preds = %62
%80 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%81 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%82 = call i32 @paraDec(i8* %80, i8* %81, i32 2)
%83 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%84 = call i64 @atol(i8* %83)
store i64 %84, i64* %3
br label %86
85: ; preds = %2
store i64 0, i64* %3
br label %86
86: ; preds = %85, %79, %55, %31
%87 = load i64, i64* %3
ret i64 %87
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s%c\00"
define i64 @geraNumRelRede(i8* nocapture %0, i8 signext %1) {
%3 = alloca [32 x i8]
%4 = alloca [10 x i8]
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%7 = sext i8 %1 to i32
switch i32 %7, label %75 [
i32 65, label %40
i32 66, label %8
i32 67, label %33
]
8: ; preds = %2
%9 = load i8, i8* %0
%10 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i8 signext %9)
%11 = getelementptr inbounds i8, i8* %0, i64 1
%12 = load i8, i8* %11
%13 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i8 signext %12)
%14 = getelementptr inbounds i8, i8* %0, i64 2
%15 = load i8, i8* %14
%16 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i8 signext %15)
%17 = getelementptr inbounds i8, i8* %0, i64 3
%18 = load i8, i8* %17
%19 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i8 signext %18)
%20 = getelementptr inbounds i8, i8* %0, i64 4
%21 = load i8, i8* %20
%22 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i8 signext %21)
%23 = getelementptr inbounds i8, i8* %0, i64 5
%24 = load i8, i8* %23
%25 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i8 signext %24)
%26 = getelementptr inbounds i8, i8* %0, i64 6
%27 = load i8, i8* %26
%28 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i8 signext %27)
%29 = getelementptr inbounds i8, i8* %0, i64 7
%30 = load i8, i8* %29
%31 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i8 signext %30)
%32 = getelementptr inbounds i8, i8* %0, i64 8
br label %40
33: ; preds = %2, %33
%34 = phi i64 [ %38, %33 ], [ 0, %2 ]
%35 = getelementptr inbounds i8, i8* %0, i64 %34
%36 = load i8, i8* %35
%37 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i8 signext %36)
%38 = add nuw nsw i64 %34, 1
%39 = icmp eq i64 %38, 24
br i1 %39, label %72, label %33
40: ; preds = %2, %8
%41 = phi i8* [ %32, %8 ], [ %0, %2 ]
%42 = phi i64 [ 9, %8 ], [ 1, %2 ]
%43 = phi i64 [ 10, %8 ], [ 2, %2 ]
%44 = phi i64 [ 11, %8 ], [ 3, %2 ]
%45 = phi i64 [ 12, %8 ], [ 4, %2 ]
%46 = phi i64 [ 13, %8 ], [ 5, %2 ]
%47 = phi i64 [ 14, %8 ], [ 6, %2 ]
%48 = phi i64 [ 15, %8 ], [ 7, %2 ]
%49 = load i8, i8* %41
%50 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i8 signext %49)
%51 = getelementptr inbounds i8, i8* %0, i64 %42
%52 = load i8, i8* %51
%53 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i8 signext %52)
%54 = getelementptr inbounds i8, i8* %0, i64 %43
%55 = load i8, i8* %54
%56 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i8 signext %55)
%57 = getelementptr inbounds i8, i8* %0, i64 %44
%58 = load i8, i8* %57
%59 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i8 signext %58)
%60 = getelementptr inbounds i8, i8* %0, i64 %45
%61 = load i8, i8* %60
%62 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i8 signext %61)
%63 = getelementptr inbounds i8, i8* %0, i64 %46
%64 = load i8, i8* %63
%65 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i8 signext %64)
%66 = getelementptr inbounds i8, i8* %0, i64 %47
%67 = load i8, i8* %66
%68 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i8 signext %67)
%69 = getelementptr inbounds i8, i8* %0, i64 %48
%70 = load i8, i8* %69
%71 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5, i8 signext %70)
br label %72
72: ; preds = %33, %40
%73 = call i32 @paraDec(i8* %5, i8* %6, i32 2)
%74 = call i64 @atol(i8* %6)
br label %75
75: ; preds = %72, %2
%76 = phi i64 [ 0, %2 ], [ %74, %72 ]
ret i64 %76
}