#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;
  int pw_uid;
  int pw_gid;
  char *pw_gecos;
  char *pw_dir;
  char *pw_shell;
};

/* Variables and functions */
struct passwd *getpwent();
int /*<<< orphan*/ printf(char *, char *, char *, int, int, char *, char *,
                          char *);
int main() {
  struct passwd *p;
  while (p = getpwent())
    printf("%s:%s:%d:%d:%s:%s:%s\n", p->pw_name, p->pw_passwd, p->pw_uid,
           p->pw_gid, p->pw_gecos, p->pw_dir, p->pw_shell);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getpwent@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1194 <main+0x74>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%r8d
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%r9
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%r10
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rax
lea    0xe7f(%rip),%rdi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <printf@plt>
jmp    112f <main+0xf>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1040 <getpwent@plt>
test   %rax,%rax
je     116e <main+0x4e>
lea    0xec8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    (%rax),%rsi
mov    0x8(%rax),%rdx
mov    0x10(%rax),%ecx
mov    0x14(%rax),%r8d
mov    0x18(%rax),%r9
movups 0x20(%rax),%xmm0
movups %xmm0,(%rsp)
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getpwent@plt>
test   %rax,%rax
jne    1140 <main+0x20>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

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