#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 */
typedef int /*<<< orphan*/ in_addr_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, ...);
char *ip2str(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void print_addr(FILE *f, in_addr_t ip, int port) {
  if (port == -1)
    fprintf(f, "%s:*", ip2str(ip));
  else
    fprintf(f, "%s:%d", ip2str(ip), port);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<print_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0xffffffff,-0x10(%rbp)
jne    1176 <print_addr+0x46>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <ip2str@plt>
mov    -0x18(%rbp),%rdi
mov    %rax,%rdx
lea    0xe96(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    119e <print_addr+0x6e>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <ip2str@plt>
mov    -0x20(%rbp),%rdi
mov    %rax,%rdx
mov    -0x10(%rbp),%ecx
lea    0xe6e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_addr>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <ip2str@plt>
cmp    $0xffffffff,%ebp
je     115c <print_addr+0x2c>
lea    0xeba(%rip),%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
mov    %ebp,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    1170 <print_addr+0x40>
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <fflush@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%s:*\00"
@.str.1 = [6 x i8] c"%s:%d\00"
@stdout = global i32 0
define void @print_addr(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %14
9: ; preds = %3
%10 = load i32*, i32** %4
%11 = load i32, i32* %5
%12 = call i8* @ip2str(i32 %11)
%13 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %20
14: ; preds = %3
%15 = load i32*, i32** %4
%16 = load i32, i32* %5
%17 = call i8* @ip2str(i32 %16)
%18 = load i32, i32* %6
%19 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %17, i32 %18)
br label %20
20: ; preds = %14, %9
%21 = load i32, i32* @stdout
%22 = call i32 @fflush(i32 %21)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s:*\00"
@.str.1 = [6 x i8] c"%s:%d\00"
@stdout = global i32 0
define void @print_addr(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, -1
%5 = tail call i8* @ip2str(i32 %1)
br i1 %4, label %6, label %8
6: ; preds = %3
%7 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %10
8: ; preds = %3
%9 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %5, i32 %2)
br label %10
10: ; preds = %8, %6
%11 = load i32, i32* @stdout
%12 = tail call i32 @fflush(i32 %11)
ret void
}