#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 */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ endpwent();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
struct passwd *getpwent();
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  struct passwd *pwd;
  while ((pwd = getpwent()) != NULL) {
    printf("-------------------------------\n");
    printf("User login: %s\n", pwd->pw_name);
    printf("Encrypted password: %s\n", pwd->pw_passwd);
    printf("User id: %d\n", pwd->pw_uid);
    printf("Group id: %d\n", pwd->pw_gid);
    printf("User information: %s\n", pwd->pw_gecos);
    printf("Home directory: %s\n", pwd->pw_dir);
    printf("Login Shell: %s\n", pwd->pw_shell);
    printf("-------------------------------\n");
  }
  endpwent();
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getpwent@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1223 <main+0xe3>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    0x14(%rax),%esi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rsi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    0x20(%rax),%rsi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    0x28(%rax),%rsi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1156 <main+0x16>
mov    $0x0,%al
call   1050 <endpwent@plt>
mov    0x2daf(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <getpwent@plt>
test   %rax,%rax
je     1237 <main+0xe7>
mov    %rax,%r12
lea    0xf09(%rip),%rbx
lea    0xeb9(%rip),%r13
lea    0xec0(%rip),%rbp
lea    0xecf(%rip),%r14
lea    0xedc(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    (%r12),%rsi
lea    0xe4d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%r12),%rsi
lea    0xe4a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%r12),%esi
lea    0xe4f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%r12),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%r12),%rsi
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%r12),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x28(%r12),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getpwent@plt>
mov    %rax,%r12
test   %rax,%rax
jne    11a0 <main+0x50>
xor    %eax,%eax
call   1060 <endpwent@plt>
mov    0x2d9b(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
%struct.passwd = type { i8*, i8*, i32, i32, i8*, i8*, i8* }
@.str = [33 x i8] c"-------------------------------\0A\00"
@.str.1 = [16 x i8] c"User login: %s\0A\00"
@.str.2 = [24 x i8] c"Encrypted password: %s\0A\00"
@.str.3 = [13 x i8] c"User id: %d\0A\00"
@.str.4 = [14 x i8] c"Group id: %d\0A\00"
@.str.5 = [22 x i8] c"User information: %s\0A\00"
@.str.6 = [20 x i8] c"Home directory: %s\0A\00"
@.str.7 = [17 x i8] c"Login Shell: %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.passwd*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %7
7: ; preds = %10, %2
%8 = call %struct.passwd* (...) @getpwent()
store %struct.passwd* %8, %struct.passwd** %6
%9 = icmp ne %struct.passwd* %8, null
br i1 %9, label %10, label %41
10: ; preds = %7
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%12 = load %struct.passwd*, %struct.passwd** %6
%13 = getelementptr inbounds %struct.passwd, %struct.passwd* %12, i32 0, i32 0
%14 = load i8*, i8** %13
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = load %struct.passwd*, %struct.passwd** %6
%17 = getelementptr inbounds %struct.passwd, %struct.passwd* %16, i32 0, i32 1
%18 = load i8*, i8** %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = load %struct.passwd*, %struct.passwd** %6
%21 = getelementptr inbounds %struct.passwd, %struct.passwd* %20, i32 0, i32 2
%22 = load i32, i32* %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%24 = load %struct.passwd*, %struct.passwd** %6
%25 = getelementptr inbounds %struct.passwd, %struct.passwd* %24, i32 0, i32 3
%26 = load i32, i32* %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %26)
%28 = load %struct.passwd*, %struct.passwd** %6
%29 = getelementptr inbounds %struct.passwd, %struct.passwd* %28, i32 0, i32 4
%30 = load i8*, i8** %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %30)
%32 = load %struct.passwd*, %struct.passwd** %6
%33 = getelementptr inbounds %struct.passwd, %struct.passwd* %32, i32 0, i32 5
%34 = load i8*, i8** %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* %34)
%36 = load %struct.passwd*, %struct.passwd** %6
%37 = getelementptr inbounds %struct.passwd, %struct.passwd* %36, i32 0, i32 6
%38 = load i8*, i8** %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %38)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %7
41: ; preds = %7
%42 = call i32 (...) @endpwent()
%43 = load i32, i32* @EXIT_SUCCESS
%44 = call i32 @exit(i32 %43)
unreachable
}

LLVM IR (-O2):
%struct.passwd = type { i8*, i8*, i32, i32, i8*, i8*, i8* }
@.str.1 = [16 x i8] c"User login: %s\0A\00"
@.str.2 = [24 x i8] c"Encrypted password: %s\0A\00"
@.str.3 = [13 x i8] c"User id: %d\0A\00"
@.str.4 = [14 x i8] c"Group id: %d\0A\00"
@.str.5 = [22 x i8] c"User information: %s\0A\00"
@.str.6 = [20 x i8] c"Home directory: %s\0A\00"
@.str.7 = [17 x i8] c"Login Shell: %s\0A\00"
@EXIT_SUCCESS = global i32 0
@str.8 = [32 x i8] c"-------------------------------\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call %struct.passwd* (...) @getpwent()
%4 = icmp eq %struct.passwd* %3, null
br i1 %4, label %32, label %5
5: ; preds = %2, %5
%6 = phi %struct.passwd* [ %30, %5 ], [ %3, %2 ]
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.8, i64 0, i64 0))
%8 = getelementptr inbounds %struct.passwd, %struct.passwd* %6, i64 0, i32 0
%9 = load i8*, i8** %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds %struct.passwd, %struct.passwd* %6, i64 0, i32 1
%12 = load i8*, i8** %11
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds %struct.passwd, %struct.passwd* %6, i64 0, i32 2
%15 = load i32, i32* %14
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds %struct.passwd, %struct.passwd* %6, i64 0, i32 3
%18 = load i32, i32* %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds %struct.passwd, %struct.passwd* %6, i64 0, i32 4
%21 = load i8*, i8** %20
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %21)
%23 = getelementptr inbounds %struct.passwd, %struct.passwd* %6, i64 0, i32 5
%24 = load i8*, i8** %23
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0), i8* %24)
%26 = getelementptr inbounds %struct.passwd, %struct.passwd* %6, i64 0, i32 6
%27 = load i8*, i8** %26
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0), i8* %27)
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.8, i64 0, i64 0))
%30 = tail call %struct.passwd* (...) @getpwent()
%31 = icmp eq %struct.passwd* %30, null
br i1 %31, label %32, label %5
32: ; preds = %5, %2
%33 = tail call i32 (...) @endpwent()
%34 = load i32, i32* @EXIT_SUCCESS
%35 = tail call i32 @exit(i32 %34)
unreachable
}