#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 dummy;
};

/* Variables and functions */
int BUFSIZ;
int /*<<< orphan*/ get_internet_address(char *, int, int *,
                                        struct sockaddr_in *);
int /*<<< orphan*/ printf(char *, char *, int);
void say_who_called(struct sockaddr_in *addrp) {
  char host[BUFSIZ];
  int port;
  get_internet_address(host, BUFSIZ, &port, addrp);
  printf("from: %s:%d", host, port);
}


x86 assembly (clang, -O0):
<say_who_called>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x28(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x18(%rbp)
mov    0x2e81(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%rcx
lea    -0x1c(%rbp),%rdx
call   1040 <get_internet_address@plt>
mov    -0x28(%rbp),%rsi
mov    -0x1c(%rbp),%edx
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<say_who_called>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
push   %rax
mov    %rdi,%rcx
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rbx
mov    %rsi,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    -0xc(%rbp),%rdx
mov    %rbx,%rdi
call   1040 <get_internet_address@plt>
mov    -0xc(%rbp),%edx
lea    0xea4(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    -0x8(%rbp),%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
@BUFSIZ = global i32 0
@.str = [12 x i8] c"from: %s:%d\00"
define void @say_who_called(%struct.sockaddr_in* %0) {
%2 = alloca %struct.sockaddr_in*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store %struct.sockaddr_in* %0, %struct.sockaddr_in** %2
%6 = load i32, i32* @BUFSIZ
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %3
%9 = alloca i8, i64 %7
store i64 %7, i64* %4
%10 = load i32, i32* @BUFSIZ
%11 = load %struct.sockaddr_in*, %struct.sockaddr_in** %2
%12 = call i32 @get_internet_address(i8* %9, i32 %10, i32* %5, %struct.sockaddr_in* %11)
%13 = load i32, i32* %5
%14 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %9, i32 %13)
%15 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
@BUFSIZ = global i32 0
@.str = [12 x i8] c"from: %s:%d\00"
define void @say_who_called(%struct.sockaddr_in* %0) {
%2 = alloca i32
%3 = load i32, i32* @BUFSIZ
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = bitcast i32* %2 to i8*
%7 = call i32 @get_internet_address(i8* %5, i32 %3, i32* %2, %struct.sockaddr_in* %0)
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %8)
ret void
}