#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*/ IP2Int(char *, unsigned long *);
int /*<<< orphan*/ Int2IP(unsigned long, char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int Calculate_NetBroacastAdd(char *net_str, char *mask_str, char *br_str) {
  unsigned long net;
  unsigned long mask;
  unsigned long broadcast_add;
  unsigned int bits;
  IP2Int(net_str, &net);
  IP2Int(mask_str, &mask);
  broadcast_add = (net & mask) + ~mask;
  Int2IP(broadcast_add, br_str);
  printf(" Ip %s in NET with BroacastAdd is %s \n", net_str, br_str);
  return 1;
}


x86 assembly (clang, -O0):
<Calculate_NetBroacastAdd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <IP2Int@plt>
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <IP2Int@plt>
mov    -0x20(%rbp),%rax
and    -0x28(%rbp),%rax
mov    -0x28(%rbp),%rcx
xor    $0xffffffffffffffff,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <Int2IP@plt>
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe6f(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Calculate_NetBroacastAdd>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0x8(%rsp),%rsi
call   1030 <IP2Int@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <IP2Int@plt>
mov    (%rsp),%rdi
mov    0x8(%rsp),%rax
and    %rdi,%rax
not    %rdi
add    %rax,%rdi
mov    %r14,%rsi
call   1050 <Int2IP@plt>
lea    0xe88(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [39 x i8] c" Ip %s in NET with BroacastAdd is %s \0A\00"
define i32 @Calculate_NetBroacastAdd(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%11 = load i8*, i8** %4
%12 = call i32 @IP2Int(i8* %11, i64* %7)
%13 = load i8*, i8** %5
%14 = call i32 @IP2Int(i8* %13, i64* %8)
%15 = load i64, i64* %7
%16 = load i64, i64* %8
%17 = and i64 %15, %16
%18 = load i64, i64* %8
%19 = xor i64 %18, -1
%20 = add i64 %17, %19
store i64 %20, i64* %9
%21 = load i64, i64* %9
%22 = load i8*, i8** %6
%23 = call i32 @Int2IP(i64 %21, i8* %22)
%24 = load i8*, i8** %4
%25 = load i8*, i8** %6
%26 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %24, i8* %25)
ret i32 1
}

LLVM IR (-O2):
@.str = [39 x i8] c" Ip %s in NET with BroacastAdd is %s \0A\00"
define i32 @Calculate_NetBroacastAdd(i8* %0, i8* %1, i8* %2) {
%4 = alloca i64
%5 = alloca i64
%6 = bitcast i64* %4 to i8*
%7 = bitcast i64* %5 to i8*
%8 = call i32 @IP2Int(i8* %0, i64* %4)
%9 = call i32 @IP2Int(i8* %1, i64* %5)
%10 = load i64, i64* %4
%11 = load i64, i64* %5
%12 = and i64 %11, %10
%13 = xor i64 %11, -1
%14 = add i64 %12, %13
%15 = call i32 @Int2IP(i64 %14, i8* %2)
%16 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %2)
ret i32 1
}