#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_dir;
  int /*<<< orphan*/ pw_uid;
  int /*<<< orphan*/ *pw_name;
};

/* Variables and functions */
int /*<<< orphan*/ SIGCHLD;
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ doit(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ endpwent();
int /*<<< orphan*/ exit(int);
struct passwd *getpwent();
scalar_t__ getuid();
int /*<<< orphan*/ setpwent();
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int main(int argc, char *argv[]) {
  struct passwd *pw;
  signal(SIGCHLD, SIG_IGN);
  if (getuid())
    exit(1);
  for (;;) {
    setpwent();
    while ((pw = getpwent())) {
      if (!pw->pw_uid)
        continue;
      if (!pw->pw_dir)
        continue;
      if (!pw->pw_name)
        continue;
      if (!*pw->pw_name)
        continue;
      if (!*pw->pw_dir)
        continue;
      if (*pw->pw_dir != '/')
        continue;
      doit(pw->pw_name, pw->pw_dir, pw->pw_uid);
    }
    endpwent();
    sleep(5);
  }
}


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    0x2e4b(%rip),%rax
mov    (%rax),%edi
mov    0x2e3a(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    $0x0,%al
call   1030 <getuid@plt>
cmp    $0x0,%rax
je     11c8 <main+0x48>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    11cd <main+0x4d>
mov    $0x0,%al
call   1050 <setpwent@plt>
mov    $0x0,%al
call   1060 <getpwent@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1286 <main+0x106>
mov    -0x18(%rbp),%rax
cmpl   $0x0,0x8(%rax)
jne    11fc <main+0x7c>
jmp    11d4 <main+0x54>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jne    120f <main+0x8f>
jmp    11d4 <main+0x54>
mov    -0x18(%rbp),%rax
cmpq   $0x0,0x10(%rax)
jne    1223 <main+0xa3>
jmp    11d4 <main+0x54>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rax
cmpl   $0x0,(%rax)
jne    1239 <main+0xb9>
jmp    11d4 <main+0x54>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
cmpb   $0x0,(%rax)
jne    124e <main+0xce>
jmp    11d4 <main+0x54>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     1266 <main+0xe6>
jmp    11d4 <main+0x54>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%edx
call   1080 <doit@plt>
jmp    11d4 <main+0x54>
mov    $0x0,%al
call   1070 <endpwent@plt>
mov    $0x5,%edi
call   10a0 <sleep@plt>
jmp    11cd <main+0x4d>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
mov    0x2e4f(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
xor    %eax,%eax
call   1030 <getuid@plt>
test   %rax,%rax
je     11c1 <main+0x41>
mov    $0x1,%edi
call   1090 <exit@plt>
xchg   %ax,%ax
xor    %eax,%eax
call   1070 <endpwent@plt>
mov    $0x5,%edi
call   10a0 <sleep@plt>
xor    %eax,%eax
call   1050 <setpwent@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <getpwent@plt>
test   %rax,%rax
je     11b0 <main+0x30>
mov    0x8(%rax),%edx
test   %edx,%edx
je     11d0 <main+0x50>
mov    (%rax),%rsi
test   %rsi,%rsi
je     11d0 <main+0x50>
mov    0x10(%rax),%rdi
test   %rdi,%rdi
je     11d0 <main+0x50>
cmpl   $0x0,(%rdi)
je     11d0 <main+0x50>
cmpb   $0x2f,(%rsi)
jne    11d0 <main+0x50>
call   1080 <doit@plt>
jmp    11d0 <main+0x50>

LLVM IR (-O0):
%struct.passwd = type { i8*, i32, i32* }
@SIGCHLD = global i32 0
@SIG_IGN = 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
%7 = load i32, i32* @SIGCHLD
%8 = load i32, i32* @SIG_IGN
%9 = call i32 @signal(i32 %7, i32 %8)
%10 = call i64 (...) @getuid()
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
br label %15
15: ; preds = %71, %14
%16 = call i32 (...) @setpwent()
br label %17
17: ; preds = %60, %59, %51, %44, %37, %31, %25, %15
%18 = call %struct.passwd* (...) @getpwent()
store %struct.passwd* %18, %struct.passwd** %6
%19 = icmp ne %struct.passwd* %18, null
br i1 %19, label %20, label %71
20: ; preds = %17
%21 = load %struct.passwd*, %struct.passwd** %6
%22 = getelementptr inbounds %struct.passwd, %struct.passwd* %21, i32 0, i32 1
%23 = load i32, i32* %22
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %20
br label %17
26: ; preds = %20
%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 = icmp ne i8* %29, null
br i1 %30, label %32, label %31
31: ; preds = %26
br label %17
32: ; preds = %26
%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 = icmp ne i32* %35, null
br i1 %36, label %38, label %37
37: ; preds = %32
br label %17
38: ; preds = %32
%39 = load %struct.passwd*, %struct.passwd** %6
%40 = getelementptr inbounds %struct.passwd, %struct.passwd* %39, i32 0, i32 2
%41 = load i32*, i32** %40
%42 = load i32, i32* %41
%43 = icmp ne i32 %42, 0
br i1 %43, label %45, label %44
44: ; preds = %38
br label %17
45: ; preds = %38
%46 = load %struct.passwd*, %struct.passwd** %6
%47 = getelementptr inbounds %struct.passwd, %struct.passwd* %46, i32 0, i32 0
%48 = load i8*, i8** %47
%49 = load i8, i8* %48
%50 = icmp ne i8 %49, 0
br i1 %50, label %52, label %51
51: ; preds = %45
br label %17
52: ; preds = %45
%53 = load %struct.passwd*, %struct.passwd** %6
%54 = getelementptr inbounds %struct.passwd, %struct.passwd* %53, i32 0, i32 0
%55 = load i8*, i8** %54
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = icmp ne i32 %57, 47
br i1 %58, label %59, label %60
59: ; preds = %52
br label %17
60: ; preds = %52
%61 = load %struct.passwd*, %struct.passwd** %6
%62 = getelementptr inbounds %struct.passwd, %struct.passwd* %61, i32 0, i32 2
%63 = load i32*, i32** %62
%64 = load %struct.passwd*, %struct.passwd** %6
%65 = getelementptr inbounds %struct.passwd, %struct.passwd* %64, i32 0, i32 0
%66 = load i8*, i8** %65
%67 = load %struct.passwd*, %struct.passwd** %6
%68 = getelementptr inbounds %struct.passwd, %struct.passwd* %67, i32 0, i32 1
%69 = load i32, i32* %68
%70 = call i32 @doit(i32* %63, i8* %66, i32 %69)
br label %17
71: ; preds = %17
%72 = call i32 (...) @endpwent()
%73 = call i32 @sleep(i32 5)
br label %15
}

LLVM IR (-O2):
%struct.passwd = type { i8*, i32, i32* }
@SIGCHLD = global i32 0
@SIG_IGN = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @SIGCHLD
%4 = load i32, i32* @SIG_IGN
%5 = tail call i32 @signal(i32 %3, i32 %4)
%6 = tail call i64 (...) @getuid()
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2, %38
%11 = tail call i32 (...) @setpwent()
%12 = tail call %struct.passwd* (...) @getpwent()
%13 = icmp eq %struct.passwd* %12, null
br i1 %13, label %38, label %14
14: ; preds = %10, %35
%15 = phi %struct.passwd* [ %36, %35 ], [ %12, %10 ]
%16 = getelementptr inbounds %struct.passwd, %struct.passwd* %15, i64 0, i32 1
%17 = load i32, i32* %16
%18 = icmp eq i32 %17, 0
br i1 %18, label %35, label %19
19: ; preds = %14
%20 = getelementptr inbounds %struct.passwd, %struct.passwd* %15, i64 0, i32 0
%21 = load i8*, i8** %20
%22 = icmp eq i8* %21, null
br i1 %22, label %35, label %23
23: ; preds = %19
%24 = getelementptr inbounds %struct.passwd, %struct.passwd* %15, i64 0, i32 2
%25 = load i32*, i32** %24
%26 = icmp eq i32* %25, null
br i1 %26, label %35, label %27
27: ; preds = %23
%28 = load i32, i32* %25
%29 = icmp eq i32 %28, 0
br i1 %29, label %35, label %30
30: ; preds = %27
%31 = load i8, i8* %21
%32 = icmp eq i8 %31, 47
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = tail call i32 @doit(i32* %25, i8* %21, i32 %17)
br label %35
35: ; preds = %33, %14, %19, %23, %27, %30
%36 = tail call %struct.passwd* (...) @getpwent()
%37 = icmp eq %struct.passwd* %36, null
br i1 %37, label %38, label %14
38: ; preds = %35, %10
%39 = tail call i32 (...) @endpwent()
%40 = tail call i32 @sleep(i32 5)
br label %10
}