#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 */
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_addr;
};

/* Variables and functions */
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ inet_ntoa(int /*<<< orphan*/);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
char *conv_addr(struct sockaddr_in addstatuss) {
  static char str[25];
  char port[7];
  strcpy(str, inet_ntoa(addstatuss.sin_addr));
  bzero(port, 7);
  sprintf(port, ":%d", ntohs(addstatuss.sin_port));
  strcat(str, port);
  return (str);
}


x86 assembly (clang, -O0):
<conv_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %eax,%esi
lea    0x2ee3(%rip),%rdi
call   1030 <strcpy@plt>
lea    -0xf(%rbp),%rdi
mov    $0x7,%esi
call   1060 <bzero@plt>
lea    -0xf(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <ntohs@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%edx
lea    0xe53(%rip),%rsi
call   1080 <sprintf@plt>
lea    -0xf(%rbp),%rsi
lea    0x2ea3(%rip),%rdi
call   1070 <strcat@plt>
lea    0x2e97(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<conv_addr>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
shr    $0x20,%rdi
call   1040 <inet_ntoa@plt>
lea    0x2ee4(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    0x9(%rsp),%r15
mov    %r15,%rdi
mov    $0x7,%esi
call   1060 <bzero@plt>
mov    %ebx,%edi
call   1050 <ntohs@plt>
lea    0xe5a(%rip),%rsi
mov    %r15,%rdi
mov    %eax,%edx
call   1080 <sprintf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <strcat@plt>
mov    %r14,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32 }
@conv_addr.str = internal global [25 x i8] zeroinitializer
@.str = [4 x i8] c":%d\00"
define i8* @conv_addr(i64 %0) {
%2 = alloca %struct.sockaddr_in
%3 = alloca [7 x i8]
%4 = bitcast %struct.sockaddr_in* %2 to i64*
store i64 %0, i64* %4
%5 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 1
%6 = load i32, i32* %5
%7 = call i32 @inet_ntoa(i32 %6)
%8 = call i32 @strcpy(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @conv_addr.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%10 = call i32 @bzero(i8* %9, i32 7)
%11 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 0
%13 = load i32, i32* %12
%14 = call i32 @ntohs(i32 %13)
%15 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%17 = call i32 @strcat(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @conv_addr.str, i64 0, i64 0), i8* %16)
ret i8* getelementptr inbounds ([25 x i8], [25 x i8]* @conv_addr.str, i64 0, i64 0)
}

LLVM IR (-O2):
@conv_addr.str = internal global [25 x i8] zeroinitializer
@.str = [4 x i8] c":%d\00"
define i8* @conv_addr(i64 %0) {
%2 = alloca [7 x i8]
%3 = trunc i64 %0 to i32
%4 = lshr i64 %0, 32
%5 = trunc i64 %4 to i32
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%7 = tail call i32 @inet_ntoa(i32 %5)
%8 = tail call i32 @strcpy(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @conv_addr.str, i64 0, i64 0), i32 %7)
%9 = call i32 @bzero(i8* %6, i32 7)
%10 = tail call i32 @ntohs(i32 %3)
%11 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 @strcat(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @conv_addr.str, i64 0, i64 0), i8* %6)
ret i8* getelementptr inbounds ([25 x i8], [25 x i8]* @conv_addr.str, i64 0, i64 0)
}