#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*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
struct spwd *getspnam(char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int main(int argc, char **argv) {
  struct spwd *p;
  while (--argc > 0) {
    if ((p = getspnam(*++argv)) == NULL) {
      fprintf(stderr, "getspnam failed: %s\n", strerror(errno));
      continue;
    }
    printf("%s, %s\n", p->sp_namp, p->sp_pwdp);
  }
  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    11df <main+0x9f>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
call   1050 <getspnam@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11bf <main+0x7f>
mov    0x2e4b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0x1c(%rbp),%edi
mov    %rax,%rdx
lea    0xe4b(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1156 <main+0x16>
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe40(%rip),%rdi
call   1030 <printf@plt>
jmp    1156 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     11cb <main+0x8b>
mov    %rsi,%rbx
mov    %edi,%ebp
add    $0x1,%ebp
add    $0x8,%rbx
mov    0x2e75(%rip),%r13
lea    0xe96(%rip),%r14
lea    0xea4(%rip),%r15
jmp    11ad <main+0x6d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x2e59(%rip),%rax
mov    (%rax),%r12d
mov    0x0(%r13),%edi
call   1060 <strerror@plt>
mov    %r12d,%edi
mov    %r14,%rsi
mov    %rax,%rdx
call   1040 <fprintf@plt>
add    $0xffffffff,%ebp
add    $0x8,%rbx
cmp    $0x2,%ebp
jbe    11cb <main+0x8b>
mov    (%rbx),%rdi
call   1050 <getspnam@plt>
test   %rax,%rax
je     1180 <main+0x40>
mov    (%rax),%rsi
mov    0x8(%rax),%rdx
mov    %r15,%rdi
call   1030 <printf@plt>
jmp    11a1 <main+0x61>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.spwd = type { i8*, i8* }
@stderr = global i32 0
@.str = [21 x i8] c"getspnam failed: %s\0A\00"
@errno = global i32 0
@.str.1 = [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 = %22, %17, %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 %30
11: ; preds = %7
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i32 1
store i8** %13, i8*** %5
%14 = load i8*, i8** %13
%15 = call %struct.spwd* @getspnam(i8* %14)
store %struct.spwd* %15, %struct.spwd** %6
%16 = icmp eq %struct.spwd* %15, null
br i1 %16, label %17, label %22
17: ; preds = %11
%18 = load i32, i32* @stderr
%19 = load i32, i32* @errno
%20 = call i8* @strerror(i32 %19)
%21 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %20)
br label %7
22: ; preds = %11
%23 = load %struct.spwd*, %struct.spwd** %6
%24 = getelementptr inbounds %struct.spwd, %struct.spwd* %23, i32 0, i32 0
%25 = load i8*, i8** %24
%26 = load %struct.spwd*, %struct.spwd** %6
%27 = getelementptr inbounds %struct.spwd, %struct.spwd* %26, i32 0, i32 1
%28 = load i8*, i8** %27
%29 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %25, i8* %28)
br label %7
30: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
%struct.spwd = type { i8*, i8* }
@stderr = global i32 0
@.str = [21 x i8] c"getspnam failed: %s\0A\00"
@errno = global i32 0
@.str.1 = [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 %25
4: ; preds = %2, %17
%5 = phi i32 [ %7, %17 ], [ %0, %2 ]
%6 = phi i8** [ %8, %17 ], [ %1, %2 ]
%7 = add nsw i32 %5, -1
%8 = getelementptr inbounds i8*, i8** %6, i64 1
%9 = load i8*, i8** %8
%10 = tail call %struct.spwd* @getspnam(i8* %9)
%11 = icmp eq %struct.spwd* %10, null
br i1 %11, label %12, label %19
12: ; preds = %4
%13 = load i32, i32* @stderr
%14 = load i32, i32* @errno
%15 = tail call i8* @strerror(i32 %14)
%16 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %12, %19
%18 = icmp ugt i32 %5, 2
br i1 %18, label %4, label %25
19: ; preds = %4
%20 = getelementptr inbounds %struct.spwd, %struct.spwd* %10, i64 0, i32 0
%21 = load i8*, i8** %20
%22 = getelementptr inbounds %struct.spwd, %struct.spwd* %10, i64 0, i32 1
%23 = load i8*, i8** %22
%24 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %21, i8* %23)
br label %17
25: ; preds = %17, %2
ret i32 0
}