#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 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
struct passwd *np_getpwnam(char *);
int /*<<< orphan*/ print_passwd(struct passwd *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc < 2) {
    fprintf(stderr, "Usage: pwdtest usernames\n");
    exit(EXIT_FAILURE);
  }
  char **usernames = &argv[1];
  for (char **username_p = usernames; *username_p != NULL; ++username_p) {
    struct passwd *pwd = np_getpwnam(*username_p);
    if (pwd != NULL) {
      print_passwd(pwd);
    } else {
      fprintf(stderr, "User %s not found\n", *username_p);
    }
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1185 <main+0x45>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
je     1204 <main+0xc4>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
call   1030 <np_getpwnam@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11d0 <main+0x90>
mov    -0x28(%rbp),%rdi
call   1060 <print_passwd@plt>
jmp    11ee <main+0xae>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
lea    0xe33(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    11f3 <main+0xb3>
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
jmp    1199 <main+0x59>
mov    0x2dc5(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x2,%edi
jge    116f <main+0x2f>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
lea    0xea6(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
test   %rdi,%rdi
jne    1189 <main+0x49>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x10,%rbx
mov    0x2e4c(%rip),%r15
lea    0xe7f(%rip),%r14
jmp    11bd <main+0x7d>
nopl   (%rax)
mov    (%r15),%edi
mov    -0x8(%rbx),%rdx
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
je     117b <main+0x3b>
call   1030 <np_getpwnam@plt>
test   %rax,%rax
je     11a0 <main+0x60>
mov    %rax,%rdi
call   1060 <print_passwd@plt>
jmp    11b1 <main+0x71>

LLVM IR (-O0):
%struct.passwd = type { i32 }
@stderr = global i32 0
@.str = [26 x i8] c"Usage: pwdtest usernames\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [19 x i8] c"User %s not found\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 i8**
%7 = alloca i8**
%8 = alloca %struct.passwd*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 2
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @EXIT_FAILURE
%15 = call i32 @exit(i32 %14)
unreachable
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
store i8** %18, i8*** %6
%19 = load i8**, i8*** %6
store i8** %19, i8*** %7
br label %20
20: ; preds = %39, %16
%21 = load i8**, i8*** %7
%22 = load i8*, i8** %21
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %42
24: ; preds = %20
%25 = load i8**, i8*** %7
%26 = load i8*, i8** %25
%27 = call %struct.passwd* @np_getpwnam(i8* %26)
store %struct.passwd* %27, %struct.passwd** %8
%28 = load %struct.passwd*, %struct.passwd** %8
%29 = icmp ne %struct.passwd* %28, null
br i1 %29, label %30, label %33
30: ; preds = %24
%31 = load %struct.passwd*, %struct.passwd** %8
%32 = call i32 @print_passwd(%struct.passwd* %31)
br label %38
33: ; preds = %24
%34 = load i32, i32* @stderr
%35 = load i8**, i8*** %7
%36 = load i8*, i8** %35
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %36)
br label %38
38: ; preds = %33, %30
br label %39
39: ; preds = %38
%40 = load i8**, i8*** %7
%41 = getelementptr inbounds i8*, i8** %40, i32 1
store i8** %41, i8*** %7
br label %20
42: ; preds = %20
%43 = load i32, i32* @EXIT_SUCCESS
%44 = call i32 @exit(i32 %43)
unreachable
}

LLVM IR (-O2):
%struct.passwd = type { i32 }
@stderr = global i32 0
@.str = [26 x i8] c"Usage: pwdtest usernames\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [19 x i8] c"User %s not found\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
br i1 %7, label %13, label %16
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %27, %4
%14 = load i32, i32* @EXIT_SUCCESS
%15 = tail call i32 @exit(i32 %14)
unreachable
16: ; preds = %4, %27
%17 = phi i8* [ %29, %27 ], [ %6, %4 ]
%18 = phi i8** [ %28, %27 ], [ %5, %4 ]
%19 = tail call %struct.passwd* @np_getpwnam(i8* %17)
%20 = icmp eq %struct.passwd* %19, null
br i1 %20, label %23, label %21
21: ; preds = %16
%22 = tail call i32 @print_passwd(%struct.passwd* %19)
br label %27
23: ; preds = %16
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %18
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %25)
br label %27
27: ; preds = %23, %21
%28 = getelementptr inbounds i8*, i8** %18, i64 1
%29 = load i8*, i8** %28
%30 = icmp eq i8* %29, null
br i1 %30, label %13, label %16
}