#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 spwd {
  char *sp_namp;
  char *sp_pwdp;
};

/* Variables and functions */
int /*<<< orphan*/ endspent();
struct spwd *getspent();
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ setspent();
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  struct spwd *p;
  while (--argc > 0) {
    setspent();
    argv++;
    while ((p = getspent()) != NULL) {
      if (strcmp(p->sp_namp, *argv) == 0) {
        printf("%s, %s\n", p->sp_namp, p->sp_pwdp);
        break;
      }
    }
    endspent();
  }
  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    11ee <main+0x9e>
mov    $0x0,%al
call   1030 <setspent@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1070 <getspent@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11e2 <main+0x92>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11dd <main+0x8d>
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe2d(%rip),%rdi
call   1050 <printf@plt>
jmp    11e2 <main+0x92>
jmp    118b <main+0x3b>
mov    $0x0,%al
call   1040 <endspent@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
cmp    $0x2,%edi
jl     11c1 <main+0x71>
mov    %rsi,%rbx
mov    %edi,%r15d
lea    0xe96(%rip),%r14
jmp    117d <main+0x2d>
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <endspent@plt>
cmp    $0x2,%r12d
jle    11c1 <main+0x71>
mov    %r15d,%r12d
lea    -0x1(%r12),%r15d
xor    %eax,%eax
call   1030 <setspent@plt>
add    $0x8,%rbx
xor    %eax,%eax
call   1070 <getspent@plt>
test   %rax,%rax
je     1170 <main+0x20>
mov    %rax,%rbp
mov    (%rax),%rdi
mov    (%rbx),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1190 <main+0x40>
mov    0x0(%rbp),%rsi
mov    0x8(%rbp),%rdx
mov    %r14,%rdi
call   1050 <printf@plt>
jmp    1170 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.spwd = type { i8*, i8* }
@.str = [8 x i8] c"%s, %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.spwd*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %7
7: ; preds = %35, %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 %37
11: ; preds = %7
%12 = call i32 (...) @setspent()
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i32 1
store i8** %14, i8*** %5
br label %15
15: ; preds = %34, %11
%16 = call %struct.spwd* (...) @getspent()
store %struct.spwd* %16, %struct.spwd** %6
%17 = icmp ne %struct.spwd* %16, null
br i1 %17, label %18, label %35
18: ; preds = %15
%19 = load %struct.spwd*, %struct.spwd** %6
%20 = getelementptr inbounds %struct.spwd, %struct.spwd* %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 %34
26: ; preds = %18
%27 = load %struct.spwd*, %struct.spwd** %6
%28 = getelementptr inbounds %struct.spwd, %struct.spwd* %27, i32 0, i32 0
%29 = load i8*, i8** %28
%30 = load %struct.spwd*, %struct.spwd** %6
%31 = getelementptr inbounds %struct.spwd, %struct.spwd* %30, i32 0, i32 1
%32 = load i8*, i8** %31
%33 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %29, i8* %32)
br label %35
34: ; preds = %18
br label %15
35: ; preds = %26, %15
%36 = call i32 (...) @endspent()
br label %7
37: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
%struct.spwd = type { i8*, i8* }
@.str = [8 x i8] c"%s, %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %28
4: ; preds = %2, %25
%5 = phi i32 [ %7, %25 ], [ %0, %2 ]
%6 = phi i8** [ %9, %25 ], [ %1, %2 ]
%7 = add nsw i32 %5, -1
%8 = tail call i32 (...) @setspent()
%9 = getelementptr inbounds i8*, i8** %6, i64 1
br label %10
10: ; preds = %13, %4
%11 = tail call %struct.spwd* (...) @getspent()
%12 = icmp eq %struct.spwd* %11, null
br i1 %12, label %25, label %13
13: ; preds = %10
%14 = getelementptr inbounds %struct.spwd, %struct.spwd* %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.spwd, %struct.spwd* %11, i64 0, i32 0
%21 = load i8*, i8** %20
%22 = getelementptr inbounds %struct.spwd, %struct.spwd* %11, i64 0, i32 1
%23 = load i8*, i8** %22
%24 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %21, i8* %23)
br label %25
25: ; preds = %10, %19
%26 = tail call i32 (...) @endspent()
%27 = icmp sgt i32 %5, 2
br i1 %27, label %4, label %28
28: ; preds = %25, %2
ret i32 0
}