#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 passwd {
  char *pw_name;
  char *pw_passwd;
  char *pw_gecos;
  char *pw_dir;
  char *pw_shell;
  scalar_t__ pw_gid;
  scalar_t__ pw_uid;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *, unsigned long, unsigned long,
                          char *, char *, char *);
print_passwd(struct passwd *pwd) {
  printf("%s:%s:%ld:%ld:%s:%s:%s\n", pwd->pw_name ? pwd->pw_name : "",
         pwd->pw_passwd ? pwd->pw_passwd : "", (unsigned long)pwd->pw_uid,
         (unsigned long)pwd->pw_gid, pwd->pw_gecos ? pwd->pw_gecos : "",
         pwd->pw_dir ? pwd->pw_dir : "", pwd->pw_shell ? pwd->pw_shell : "");
}


x86 assembly (clang, -O0):
<print_passwd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     113d <print_passwd+0x2d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    114d <print_passwd+0x3d>
lea    0xed3(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    114d <print_passwd+0x3d>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     1175 <print_passwd+0x65>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    1185 <print_passwd+0x75>
lea    0xe9b(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    1185 <print_passwd+0x75>
mov    -0x28(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x10(%rax)
je     11c5 <print_passwd+0xb5>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x48(%rbp)
jmp    11d5 <print_passwd+0xc5>
lea    0xe4b(%rip),%rax
mov    %rax,-0x48(%rbp)
jmp    11d5 <print_passwd+0xc5>
mov    -0x48(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x18(%rax)
je     11fd <print_passwd+0xed>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x58(%rbp)
jmp    120d <print_passwd+0xfd>
lea    0xe13(%rip),%rax
mov    %rax,-0x58(%rbp)
jmp    120d <print_passwd+0xfd>
mov    -0x58(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x20(%rax)
je     1235 <print_passwd+0x125>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x68(%rbp)
jmp    1245 <print_passwd+0x135>
lea    0xddb(%rip),%rax
mov    %rax,-0x68(%rbp)
jmp    1245 <print_passwd+0x135>
mov    -0x60(%rbp),%r10
mov    -0x50(%rbp),%r9
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%rdx
mov    -0x20(%rbp),%rsi
mov    -0x68(%rbp),%rax
lea    0xd98(%rip),%rdi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_passwd>:
push   %rax
mov    (%rdi),%rsi
mov    0x8(%rdi),%rdx
test   %rsi,%rsi
lea    0xef5(%rip),%r10
cmove  %r10,%rsi
test   %rdx,%rdx
cmove  %r10,%rdx
mov    0x30(%rdi),%rcx
mov    0x28(%rdi),%r8
mov    0x10(%rdi),%r9
test   %r9,%r9
cmove  %r10,%r9
mov    0x18(%rdi),%r11
test   %r11,%r11
cmove  %r10,%r11
mov    0x20(%rdi),%rax
test   %rax,%rax
cmove  %r10,%rax
lea    0xea3(%rip),%rdi
push   %rax
push   %r11
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rcx
ret

LLVM IR (-O0):
%struct.passwd = type { i8*, i8*, i8*, i8*, i8*, i64, i64 }
@.str = [24 x i8] c"%s:%s:%ld:%ld:%s:%s:%s\0A\00"
@.str.1 = [1 x i8] zeroinitializer
define i32 @print_passwd(%struct.passwd* %0) {
%2 = alloca i32
%3 = alloca %struct.passwd*
store %struct.passwd* %0, %struct.passwd** %3
%4 = load %struct.passwd*, %struct.passwd** %3
%5 = getelementptr inbounds %struct.passwd, %struct.passwd* %4, i32 0, i32 0
%6 = load i8*, i8** %5
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load %struct.passwd*, %struct.passwd** %3
%10 = getelementptr inbounds %struct.passwd, %struct.passwd* %9, i32 0, i32 0
%11 = load i8*, i8** %10
br label %13
12: ; preds = %1
br label %13
13: ; preds = %12, %8
%14 = phi i8* [ %11, %8 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %12 ]
%15 = load %struct.passwd*, %struct.passwd** %3
%16 = getelementptr inbounds %struct.passwd, %struct.passwd* %15, i32 0, i32 1
%17 = load i8*, i8** %16
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %23
19: ; preds = %13
%20 = load %struct.passwd*, %struct.passwd** %3
%21 = getelementptr inbounds %struct.passwd, %struct.passwd* %20, i32 0, i32 1
%22 = load i8*, i8** %21
br label %24
23: ; preds = %13
br label %24
24: ; preds = %23, %19
%25 = phi i8* [ %22, %19 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %23 ]
%26 = load %struct.passwd*, %struct.passwd** %3
%27 = getelementptr inbounds %struct.passwd, %struct.passwd* %26, i32 0, i32 6
%28 = load i64, i64* %27
%29 = load %struct.passwd*, %struct.passwd** %3
%30 = getelementptr inbounds %struct.passwd, %struct.passwd* %29, i32 0, i32 5
%31 = load i64, i64* %30
%32 = load %struct.passwd*, %struct.passwd** %3
%33 = getelementptr inbounds %struct.passwd, %struct.passwd* %32, i32 0, i32 2
%34 = load i8*, i8** %33
%35 = icmp ne i8* %34, null
br i1 %35, label %36, label %40
36: ; preds = %24
%37 = load %struct.passwd*, %struct.passwd** %3
%38 = getelementptr inbounds %struct.passwd, %struct.passwd* %37, i32 0, i32 2
%39 = load i8*, i8** %38
br label %41
40: ; preds = %24
br label %41
41: ; preds = %40, %36
%42 = phi i8* [ %39, %36 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %40 ]
%43 = load %struct.passwd*, %struct.passwd** %3
%44 = getelementptr inbounds %struct.passwd, %struct.passwd* %43, i32 0, i32 3
%45 = load i8*, i8** %44
%46 = icmp ne i8* %45, null
br i1 %46, label %47, label %51
47: ; preds = %41
%48 = load %struct.passwd*, %struct.passwd** %3
%49 = getelementptr inbounds %struct.passwd, %struct.passwd* %48, i32 0, i32 3
%50 = load i8*, i8** %49
br label %52
51: ; preds = %41
br label %52
52: ; preds = %51, %47
%53 = phi i8* [ %50, %47 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %51 ]
%54 = load %struct.passwd*, %struct.passwd** %3
%55 = getelementptr inbounds %struct.passwd, %struct.passwd* %54, i32 0, i32 4
%56 = load i8*, i8** %55
%57 = icmp ne i8* %56, null
br i1 %57, label %58, label %62
58: ; preds = %52
%59 = load %struct.passwd*, %struct.passwd** %3
%60 = getelementptr inbounds %struct.passwd, %struct.passwd* %59, i32 0, i32 4
%61 = load i8*, i8** %60
br label %63
62: ; preds = %52
br label %63
63: ; preds = %62, %58
%64 = phi i8* [ %61, %58 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %62 ]
%65 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %25, i64 %28, i64 %31, i8* %42, i8* %53, i8* %64)
%66 = load i32, i32* %2
ret i32 %66
}

LLVM IR (-O2):
%struct.passwd = type { i8*, i8*, i8*, i8*, i8*, i64, i64 }
@.str = [24 x i8] c"%s:%s:%ld:%ld:%s:%s:%s\0A\00"
@.str.1 = [1 x i8] zeroinitializer
define i32 @print_passwd(%struct.passwd* nocapture %0) {
%2 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 0
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
%5 = select i1 %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %3
%6 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 1
%7 = load i8*, i8** %6
%8 = icmp eq i8* %7, null
%9 = select i1 %8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %7
%10 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 6
%11 = load i64, i64* %10
%12 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 5
%13 = load i64, i64* %12
%14 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 2
%15 = load i8*, i8** %14
%16 = icmp eq i8* %15, null
%17 = select i1 %16, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %15
%18 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 3
%19 = load i8*, i8** %18
%20 = icmp eq i8* %19, null
%21 = select i1 %20, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %19
%22 = getelementptr inbounds %struct.passwd, %struct.passwd* %0, i64 0, i32 4
%23 = load i8*, i8** %22
%24 = icmp eq i8* %23, null
%25 = select i1 %24, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %23
%26 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %9, i64 %11, i64 %13, i8* %17, i8* %21, i8* %25)
ret i32 undef
}