#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 rpcent {
  char *r_name;
  int r_number;
  char **r_aliases;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, ...);
void output_rpcent(const char *call, struct rpcent *rptr) {
  char **pptr;
  if (rptr == NULL)
    printf("Call: %s returned NULL\n", call);
  else {
    printf("Call: %s, returned: r_name: %s, r_number: %d\n", call, rptr->r_name,
           rptr->r_number);
    for (pptr = rptr->r_aliases; *pptr != NULL; pptr++)
      printf("  alias: %s\n", *pptr);
  }
}


x86 assembly (clang, -O0):
<output_rpcent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1142 <output_rpcent+0x32>
mov    -0x8(%rbp),%rsi
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a7 <output_rpcent+0x97>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%ecx
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     11a2 <output_rpcent+0x92>
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
jmp    116e <output_rpcent+0x5e>
jmp    11a7 <output_rpcent+0x97>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_rpcent>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%rsi
test   %rbx,%rbx
je     116e <output_rpcent+0x5e>
mov    (%rbx),%rdx
mov    0x8(%rbx),%ecx
lea    0xeec(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rbx),%rbx
mov    (%rbx),%rsi
test   %rsi,%rsi
je     1166 <output_rpcent+0x56>
add    $0x8,%rbx
lea    0xefc(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1150 <output_rpcent+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe8b(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.rpcent = type { i8*, i32, i8** }
@.str = [24 x i8] c"Call: %s returned NULL\0A\00"
@.str.1 = [46 x i8] c"Call: %s, returned: r_name: %s, r_number: %d\0A\00"
@.str.2 = [13 x i8] c" alias: %s\0A\00"
define void @output_rpcent(i8* %0, %struct.rpcent* %1) {
%3 = alloca i8*
%4 = alloca %struct.rpcent*
%5 = alloca i8**
store i8* %0, i8** %3
store %struct.rpcent* %1, %struct.rpcent** %4
%6 = load %struct.rpcent*, %struct.rpcent** %4
%7 = icmp eq %struct.rpcent* %6, null
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %35
11: ; preds = %2
%12 = load i8*, i8** %3
%13 = load %struct.rpcent*, %struct.rpcent** %4
%14 = getelementptr inbounds %struct.rpcent, %struct.rpcent* %13, i32 0, i32 0
%15 = load i8*, i8** %14
%16 = load %struct.rpcent*, %struct.rpcent** %4
%17 = getelementptr inbounds %struct.rpcent, %struct.rpcent* %16, i32 0, i32 1
%18 = load i32, i32* %17
%19 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i8* %12, i8* %15, i32 %18)
%20 = load %struct.rpcent*, %struct.rpcent** %4
%21 = getelementptr inbounds %struct.rpcent, %struct.rpcent* %20, i32 0, i32 2
%22 = load i8**, i8*** %21
store i8** %22, i8*** %5
br label %23
23: ; preds = %31, %11
%24 = load i8**, i8*** %5
%25 = load i8*, i8** %24
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %34
27: ; preds = %23
%28 = load i8**, i8*** %5
%29 = load i8*, i8** %28
%30 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %27
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i32 1
store i8** %33, i8*** %5
br label %23
34: ; preds = %23
br label %35
35: ; preds = %34, %8
ret void
}

LLVM IR (-O2):
%struct.rpcent = type { i8*, i32, i8** }
@.str = [24 x i8] c"Call: %s returned NULL\0A\00"
@.str.1 = [46 x i8] c"Call: %s, returned: r_name: %s, r_number: %d\0A\00"
@.str.2 = [13 x i8] c" alias: %s\0A\00"
define void @output_rpcent(i8* %0, %struct.rpcent* %1) {
%3 = icmp eq %struct.rpcent* %1, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %23
6: ; preds = %2
%7 = getelementptr inbounds %struct.rpcent, %struct.rpcent* %1, i64 0, i32 0
%8 = load i8*, i8** %7
%9 = getelementptr inbounds %struct.rpcent, %struct.rpcent* %1, i64 0, i32 1
%10 = load i32, i32* %9
%11 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %8, i32 %10)
%12 = getelementptr inbounds %struct.rpcent, %struct.rpcent* %1, i64 0, i32 2
%13 = load i8**, i8*** %12
%14 = load i8*, i8** %13
%15 = icmp eq i8* %14, null
br i1 %15, label %23, label %16
16: ; preds = %6, %16
%17 = phi i8* [ %21, %16 ], [ %14, %6 ]
%18 = phi i8** [ %20, %16 ], [ %13, %6 ]
%19 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %17)
%20 = getelementptr inbounds i8*, i8** %18, i64 1
%21 = load i8*, i8** %20
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %16
23: ; preds = %16, %6, %4
ret void
}