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

/* Variables and functions */
int /*<<< orphan*/ endpwent();
struct passwd *getpwent();
int /*<<< orphan*/ printf(char *, char *, int, int, char *, char *, char *);
int /*<<< orphan*/ setpwent();
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  struct passwd *p;
  while (--argc > 0) {
    setpwent();
    argv++;
    while ((p = getpwent()) != NULL) {
      if (strcmp(p->pw_name, *argv) == 0) {
        printf("%s, %d, %d, %s, %s, %s\n", p->pw_name, p->pw_uid, p->pw_gid,
               p->pw_gecos, p->pw_dir, p->pw_shell);
        break;
      }
    }
    endpwent();
  }
  return 0;
}


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    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    1210 <main+0xc0>
mov    $0x0,%al
call   1050 <setpwent@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <getpwent@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1204 <main+0xb4>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11ff <main+0xaf>
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%edx
mov    -0x18(%rbp),%rax
mov    0xc(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%r8
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%r9
mov    -0x18(%rbp),%rax
mov    0x20(%rax),%rax
lea    0xe0f(%rip),%rdi
mov    %rax,(%rsp)
call   1030 <printf@plt>
jmp    1204 <main+0xb4>
jmp    118b <main+0x3b>
mov    $0x0,%al
call   1070 <endpwent@plt>
jmp    1166 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%edi
jl     11d3 <main+0x83>
mov    %rsi,%rbx
mov    %edi,%r15d
lea    0xe92(%rip),%r14
jmp    117d <main+0x2d>
xor    %eax,%eax
call   1070 <endpwent@plt>
cmp    $0x2,%r12d
jle    11d3 <main+0x83>
mov    %r15d,%r12d
lea    -0x1(%r12),%r15d
xor    %eax,%eax
call   1050 <setpwent@plt>
add    $0x8,%rbx
xor    %eax,%eax
call   1060 <getpwent@plt>
test   %rax,%rax
je     1170 <main+0x20>
mov    %rax,%rbp
mov    (%rax),%rdi
mov    (%rbx),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1190 <main+0x40>
mov    0x0(%rbp),%rsi
mov    0x8(%rbp),%edx
mov    0xc(%rbp),%ecx
mov    0x10(%rbp),%r8
mov    0x18(%rbp),%r9
mov    0x20(%rbp),%rax
mov    %rax,(%rsp)
mov    %r14,%rdi
call   1030 <printf@plt>
jmp    1170 <main+0x20>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.passwd = type { i8*, i32, i32, i8*, i8*, i8* }
@.str = [24 x i8] c"%s, %d, %d, %s, %s, %s\0A\00"
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 = %47, %2
%8 = load i32, i32* %4
%9 = add nsw i32 %8, -1
store i32 %9, i32* %4
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %49
11: ; preds = %7
%12 = call i32 (...) @setpwent()
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i32 1
store i8** %14, i8*** %5
br label %15
15: ; preds = %46, %11
%16 = call %struct.passwd* (...) @getpwent()
store %struct.passwd* %16, %struct.passwd** %6
%17 = icmp ne %struct.passwd* %16, null
br i1 %17, label %18, label %47
18: ; preds = %15
%19 = load %struct.passwd*, %struct.passwd** %6
%20 = getelementptr inbounds %struct.passwd, %struct.passwd* %19, i32 0, i32 0
%21 = load i8*, i8** %20
%22 = load i8**, i8*** %5
%23 = load i8*, i8** %22
%24 = call i64 @strcmp(i8* %21, i8* %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %46
26: ; preds = %18
%27 = load %struct.passwd*, %struct.passwd** %6
%28 = getelementptr inbounds %struct.passwd, %struct.passwd* %27, i32 0, i32 0
%29 = load i8*, i8** %28
%30 = load %struct.passwd*, %struct.passwd** %6
%31 = getelementptr inbounds %struct.passwd, %struct.passwd* %30, i32 0, i32 1
%32 = load i32, i32* %31
%33 = load %struct.passwd*, %struct.passwd** %6
%34 = getelementptr inbounds %struct.passwd, %struct.passwd* %33, i32 0, i32 2
%35 = load i32, i32* %34
%36 = load %struct.passwd*, %struct.passwd** %6
%37 = getelementptr inbounds %struct.passwd, %struct.passwd* %36, i32 0, i32 3
%38 = load i8*, i8** %37
%39 = load %struct.passwd*, %struct.passwd** %6
%40 = getelementptr inbounds %struct.passwd, %struct.passwd* %39, i32 0, i32 4
%41 = load i8*, i8** %40
%42 = load %struct.passwd*, %struct.passwd** %6
%43 = getelementptr inbounds %struct.passwd, %struct.passwd* %42, i32 0, i32 5
%44 = load i8*, i8** %43
%45 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %29, i32 %32, i32 %35, i8* %38, i8* %41, i8* %44)
br label %47
46: ; preds = %18
br label %15
47: ; preds = %26, %15
%48 = call i32 (...) @endpwent()
br label %7
49: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
%struct.passwd = type { i8*, i32, i32, i8*, i8*, i8* }
@.str = [24 x i8] c"%s, %d, %d, %s, %s, %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %36
4: ; preds = %2, %33
%5 = phi i32 [ %7, %33 ], [ %0, %2 ]
%6 = phi i8** [ %9, %33 ], [ %1, %2 ]
%7 = add nsw i32 %5, -1
%8 = tail call i32 (...) @setpwent()
%9 = getelementptr inbounds i8*, i8** %6, i64 1
br label %10
10: ; preds = %13, %4
%11 = tail call %struct.passwd* (...) @getpwent()
%12 = icmp eq %struct.passwd* %11, null
br i1 %12, label %33, label %13
13: ; preds = %10
%14 = getelementptr inbounds %struct.passwd, %struct.passwd* %11, i64 0, i32 0
%15 = load i8*, i8** %14
%16 = load i8*, i8** %9
%17 = tail call i64 @strcmp(i8* %15, i8* %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %10
19: ; preds = %13
%20 = getelementptr inbounds %struct.passwd, %struct.passwd* %11, i64 0, i32 0
%21 = load i8*, i8** %20
%22 = getelementptr inbounds %struct.passwd, %struct.passwd* %11, i64 0, i32 1
%23 = load i32, i32* %22
%24 = getelementptr inbounds %struct.passwd, %struct.passwd* %11, i64 0, i32 2
%25 = load i32, i32* %24
%26 = getelementptr inbounds %struct.passwd, %struct.passwd* %11, i64 0, i32 3
%27 = load i8*, i8** %26
%28 = getelementptr inbounds %struct.passwd, %struct.passwd* %11, i64 0, i32 4
%29 = load i8*, i8** %28
%30 = getelementptr inbounds %struct.passwd, %struct.passwd* %11, i64 0, i32 5
%31 = load i8*, i8** %30
%32 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %21, i32 %23, i32 %25, i8* %27, i8* %29, i8* %31)
br label %33
33: ; preds = %10, %19
%34 = tail call i32 (...) @endpwent()
%35 = icmp sgt i32 %5, 2
br i1 %35, label %4, label %36
36: ; preds = %33, %2
ret i32 0
}