#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 servent {
  int /*<<< orphan*/ s_proto;
  int /*<<< orphan*/ s_port;
  int /*<<< orphan*/ s_name;
  int /*<<< orphan*/ s_aliases;
};

/* Variables and functions */
int /*<<< orphan*/ ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ printfmtstrings(int /*<<< orphan*/, char *, char *, char *,
                                   int /*<<< orphan*/, int /*<<< orphan*/,
                                   int /*<<< orphan*/);
void servicesprint(struct servent *se) {
  printfmtstrings(se->s_aliases, "  ", " ", "%-16s  %5d/%s", se->s_name,
                  ntohs(se->s_port), se->s_proto);
}


x86 assembly (clang, -O0):
<servicesprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
call   1040 <ntohs@plt>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%r8d
mov    %eax,%r9d
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
lea    0xe9d(%rip),%rsi
lea    0xe97(%rip),%rdx
lea    0xe92(%rip),%rcx
mov    %eax,(%rsp)
call   1030 <printfmtstrings@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<servicesprint>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    0xc(%rdi),%ebp
mov    0x4(%rdi),%edi
mov    0x8(%rbx),%r14d
call   1040 <ntohs@plt>
mov    (%rbx),%ecx
mov    %ecx,(%rsp)
lea    0xeba(%rip),%rsi
lea    0xeb4(%rip),%rdx
lea    0xeaf(%rip),%rcx
mov    %ebp,%edi
mov    %r14d,%r8d
mov    %eax,%r9d
call   1030 <printfmtstrings@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.servent = type { i32, i32, i32, i32 }
@.str = [3 x i8] c" \00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [14 x i8] c"%-16s %5d/%s\00"
define void @servicesprint(%struct.servent* %0) {
%2 = alloca %struct.servent*
store %struct.servent* %0, %struct.servent** %2
%3 = load %struct.servent*, %struct.servent** %2
%4 = getelementptr inbounds %struct.servent, %struct.servent* %3, i32 0, i32 3
%5 = load i32, i32* %4
%6 = load %struct.servent*, %struct.servent** %2
%7 = getelementptr inbounds %struct.servent, %struct.servent* %6, i32 0, i32 2
%8 = load i32, i32* %7
%9 = load %struct.servent*, %struct.servent** %2
%10 = getelementptr inbounds %struct.servent, %struct.servent* %9, i32 0, i32 1
%11 = load i32, i32* %10
%12 = call i32 @ntohs(i32 %11)
%13 = load %struct.servent*, %struct.servent** %2
%14 = getelementptr inbounds %struct.servent, %struct.servent* %13, i32 0, i32 0
%15 = load i32, i32* %14
%16 = call i32 @printfmtstrings(i32 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 %12, i32 %15)
ret void
}

LLVM IR (-O2):
%struct.servent = type { i32, i32, i32, i32 }
@.str = [3 x i8] c" \00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [14 x i8] c"%-16s %5d/%s\00"
define void @servicesprint(%struct.servent* nocapture %0) {
%2 = getelementptr inbounds %struct.servent, %struct.servent* %0, i64 0, i32 3
%3 = load i32, i32* %2
%4 = getelementptr inbounds %struct.servent, %struct.servent* %0, i64 0, i32 2
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.servent, %struct.servent* %0, i64 0, i32 1
%7 = load i32, i32* %6
%8 = tail call i32 @ntohs(i32 %7)
%9 = getelementptr inbounds %struct.servent, %struct.servent* %0, i64 0, i32 0
%10 = load i32, i32* %9
%11 = tail call i32 @printfmtstrings(i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %8, i32 %10)
ret void
}