#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*/ sprintf(char *, char *, int, int, int, int);
char *NetName(unsigned long l) {
  int code[4];
  static char name[64];
  code[0] = l % 65536;
  code[2] = l / 65536;
  code[3] = code[2] / 256;
  code[2] %= 256;
  code[1] = code[0] / 256;
  code[0] %= 256;
  sprintf(name, "%d.%d.%d.%d", code[3], code[2], code[1], code[0]);
  return (name);
}


x86 assembly (clang, -O0):
<NetName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xffff,%rax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x20(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x20(%rbp),%r9d
lea    0x2ebf(%rip),%rdi
lea    0xe78(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2eac(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NetName>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rax
movzbl %ah,%ebp
mov    %rdi,%rcx
shr    $0x10,%rcx
lea    0xff(%rcx),%edx
test   %ecx,%ecx
cmovns %ecx,%edx
movzbl %al,%r9d
mov    %edx,%eax
and    $0xffffff00,%eax
sub    %eax,%ecx
sar    $0x8,%edx
lea    0x2efe(%rip),%rbx
lea    0xeb7(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%r8d
call   1030 <sprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@NetName.name = internal global [64 x i8] zeroinitializer
@.str = [12 x i8] c"%d.%d.%d.%d\00"
define i8* @NetName(i64 %0) {
%2 = alloca i64
%3 = alloca [4 x i32]
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = urem i64 %4, 65536
%6 = trunc i64 %5 to i32
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
store i32 %6, i32* %7
%8 = load i64, i64* %2
%9 = udiv i64 %8, 65536
%10 = trunc i64 %9 to i32
%11 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 2
store i32 %10, i32* %11
%12 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 2
%13 = load i32, i32* %12
%14 = sdiv i32 %13, 256
%15 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 3
store i32 %14, i32* %15
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 2
%17 = load i32, i32* %16
%18 = srem i32 %17, 256
store i32 %18, i32* %16
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%20 = load i32, i32* %19
%21 = sdiv i32 %20, 256
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 1
store i32 %21, i32* %22
%23 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%24 = load i32, i32* %23
%25 = srem i32 %24, 256
store i32 %25, i32* %23
%26 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 3
%27 = load i32, i32* %26
%28 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 2
%29 = load i32, i32* %28
%30 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 1
%31 = load i32, i32* %30
%32 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 0
%33 = load i32, i32* %32
%34 = call i32 @sprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @NetName.name, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %27, i32 %29, i32 %31, i32 %33)
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @NetName.name, i64 0, i64 0)
}

LLVM IR (-O2):
@NetName.name = internal global [64 x i8] zeroinitializer
@.str = [12 x i8] c"%d.%d.%d.%d\00"
define i8* @NetName(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = lshr i64 %0, 16
%4 = trunc i64 %3 to i32
%5 = sdiv i32 %4, 256
%6 = srem i32 %4, 256
%7 = lshr i32 %2, 8
%8 = and i32 %7, 255
%9 = and i32 %2, 255
%10 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @NetName.name, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6, i32 %8, i32 %9)
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @NetName.name, i64 0, i64 0)
}