#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 */

/* Variables and functions */
int /*<<< orphan*/ _IOLBF;
char *calloc(int /*<<< orphan*/, int);
int /*<<< orphan*/ exit(int);
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getopt(int, char **, char *);
int /*<<< orphan*/ isprint(int);
int /*<<< orphan*/ optarg;
int optind;
int optopt;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(int /*<<< orphan*/);
char *strwordtok(char *, char **);
int /*<<< orphan*/ usage(char *);
scalar_t__ validate_user_gr(char *, char *);
scalar_t__ validate_user_pw(char *, char *);
int main(int argc, char *argv[]) {
  char *user, *p, *t;
  char buf[8192];
  char *grents[10];
  int check_pw = 0, ch, i = 0, j = 0;
  setvbuf(stdout, NULL, _IOLBF, 0);
  while ((ch = getopt(argc, argv, "pg:")) != -1) {
    switch (ch) {
    case 'p':
      check_pw = 1;
      break;
    case 'g':
      grents[i] = calloc(strlen(optarg) + 1, sizeof(char));
      strcpy(grents[i], optarg);
      if (i < 10) {
        i++;
      } else {
        fprintf(stderr, "Exceeded maximum number of allowed groups (%i)\n", i);
        exit(1);
      }
      break;
    case '?':
      if (isprint(optopt)) {
        fprintf(stderr, "Unknown option '-%c'.\n", optopt);
      } else {
        fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
      }
    default:
      usage(argv[0]);
      exit(1);
    }
  }
  if (optind < argc) {
    fprintf(stderr, "Unknown option '%s'\n", argv[optind]);
    usage(argv[0]);
    exit(1);
  }
  while (fgets(buf, 8192, stdin)) {
    j = 0;
    if ((p = strchr(buf, '\n')) != NULL) {
      *p = '\0';
    } else {
      fprintf(stderr, "%s: ERROR: Too large: %s\n", argv[0], buf);
      while (fgets(buf, 8192, stdin)) {
        fprintf(stderr, "%s: ERROR: Too large..: %s\n", argv[0], buf);
        if (strchr(buf, '\n') != NULL)
          break;
      }
      goto error;
    }
    if ((p = strwordtok(buf, &t)) == NULL) {
      goto error;
    } else {
      user = p;
      while ((p = strwordtok(NULL, &t)) != NULL) {
        if (check_pw == 1)
          j += validate_user_pw(user, p);
        j += validate_user_gr(user, p);
      }
    }
    for (i = 0; grents[i] != NULL; i++) {
      if (check_pw == 1) {
        j += validate_user_pw(user, grents[i]);
      }
      j += validate_user_gr(user, grents[i]);
    }
    if (j > 0) {
      printf("OK\n");
    } else {
    error:
      printf("ERR\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x2084(%rbp)
movl   $0x0,-0x208c(%rbp)
movl   $0x0,-0x2090(%rbp)
mov    0x2d82(%rip),%rax
mov    (%rax),%edi
mov    0x2d81(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   10d0 <setvbuf@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdae(%rip),%rdx
call   10f0 <getopt@plt>
mov    %eax,-0x2088(%rbp)
cmp    $0xffffffff,%eax
je     13cc <main+0x1dc>
mov    -0x2088(%rbp),%eax
mov    %eax,-0x2094(%rbp)
sub    $0x3f,%eax
je     1350 <main+0x160>
jmp    1280 <main+0x90>
mov    -0x2094(%rbp),%eax
sub    $0x67,%eax
je     12b7 <main+0xc7>
jmp    1294 <main+0xa4>
mov    -0x2094(%rbp),%eax
sub    $0x70,%eax
jne    13b1 <main+0x1c1>
jmp    12a8 <main+0xb8>
movl   $0x1,-0x2084(%rbp)
jmp    13c7 <main+0x1d7>
mov    0x2d3a(%rip),%rax
mov    (%rax),%edi
call   1060 <strlen@plt>
mov    %eax,%edi
add    $0x1,%edi
mov    $0x1,%esi
call   10a0 <calloc@plt>
mov    %rax,%rcx
movslq -0x208c(%rbp),%rax
mov    %rcx,-0x2080(%rbp,%rax,8)
ff
movslq -0x208c(%rbp),%rax
mov    -0x2080(%rbp,%rax,8),%rdi
ff
mov    0x2cfc(%rip),%rax
mov    (%rax),%esi
call   1030 <strcpy@plt>
cmpl   $0xa,-0x208c(%rbp)
jge    1324 <main+0x134>
mov    -0x208c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x208c(%rbp)
jmp    134b <main+0x15b>
mov    0x2c95(%rip),%rax
mov    (%rax),%edi
mov    -0x208c(%rbp),%edx
lea    0xcca(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
jmp    13c7 <main+0x1d7>
mov    0x2c81(%rip),%rax
mov    (%rax),%edi
call   10e0 <isprint@plt>
cmp    $0x0,%eax
je     138c <main+0x19c>
mov    0x2c52(%rip),%rax
mov    (%rax),%edi
mov    0x2c61(%rip),%rax
mov    (%rax),%edx
lea    0xcb4(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    13ac <main+0x1bc>
mov    0x2c2d(%rip),%rax
mov    (%rax),%edi
mov    0x2c3c(%rip),%rax
mov    (%rax),%edx
lea    0xca6(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    13b1 <main+0x1c1>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10c0 <usage@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
jmp    1244 <main+0x54>
mov    0x2bfd(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    141d <main+0x22d>
mov    0x2bdb(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x2bde(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xc6d(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10c0 <usage@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
jmp    1422 <main+0x232>
lea    -0x2030(%rbp),%rdi
mov    0x2bb0(%rip),%rax
mov    (%rax),%edx
mov    $0x2000,%esi
call   1090 <fgets@plt>
cmp    $0x0,%rax
je     167b <main+0x48b>
movl   $0x0,-0x2090(%rbp)
lea    -0x2030(%rbp),%rdi
mov    $0xa,%esi
call   1070 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     147b <main+0x28b>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
jmp    1513 <main+0x323>
mov    0x2b3e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    -0x2030(%rbp),%rcx
lea    0xbe9(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
lea    -0x2030(%rbp),%rdi
mov    0x2b32(%rip),%rax
mov    (%rax),%edx
mov    $0x2000,%esi
call   1090 <fgets@plt>
cmp    $0x0,%rax
je     150e <main+0x31e>
mov    0x2af5(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    -0x2030(%rbp),%rcx
lea    0xbba(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
lea    -0x2030(%rbp),%rdi
mov    $0xa,%esi
call   1070 <strchr@plt>
cmp    $0x0,%rax
je     1509 <main+0x319>
jmp    150e <main+0x31e>
jmp    14a0 <main+0x2b0>
jmp    166a <main+0x47a>
lea    -0x2030(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <strwordtok@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1536 <main+0x346>
jmp    166a <main+0x47a>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    -0x28(%rbp),%rsi
call   1040 <strwordtok@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     15ab <main+0x3bb>
cmpl   $0x1,-0x2084(%rbp)
jne    1586 <main+0x396>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <validate_user_pw@plt>
mov    %rax,%rcx
movslq -0x2090(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x2090(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1110 <validate_user_gr@plt>
mov    %rax,%rcx
movslq -0x2090(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x2090(%rbp)
jmp    153e <main+0x34e>
jmp    15b0 <main+0x3c0>
movl   $0x0,-0x208c(%rbp)
movslq -0x208c(%rbp),%rax
cmpq   $0x0,-0x2080(%rbp,%rax,8)
je     1647 <main+0x457>
cmpl   $0x1,-0x2084(%rbp)
jne    1608 <main+0x418>
mov    -0x18(%rbp),%rdi
movslq -0x208c(%rbp),%rax
mov    -0x2080(%rbp,%rax,8),%rsi
ff
call   1050 <validate_user_pw@plt>
mov    %rax,%rcx
movslq -0x2090(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x2090(%rbp)
mov    -0x18(%rbp),%rdi
movslq -0x208c(%rbp),%rax
mov    -0x2080(%rbp,%rax,8),%rsi
ff
call   1110 <validate_user_gr@plt>
mov    %rax,%rcx
movslq -0x2090(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x2090(%rbp)
mov    -0x208c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x208c(%rbp)
jmp    15ba <main+0x3ca>
cmpl   $0x0,-0x2090(%rbp)
jle    1665 <main+0x475>
lea    0xa5d(%rip),%rdi
call   1080 <printf@plt>
jmp    1676 <main+0x486>
jmp    166a <main+0x47a>
lea    0xa4b(%rip),%rdi
call   1080 <printf@plt>
jmp    1422 <main+0x232>
xor    %eax,%eax
add    $0x20a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2078,%rsp
mov    %rsi,0x8(%rsp)
mov    %edi,%r12d
mov    0x2da0(%rip),%rax
mov    (%rax),%edi
mov    0x2d9f(%rip),%rax
mov    (%rax),%edx
xor    %r14d,%r14d
xor    %esi,%esi
xor    %ecx,%ecx
call   10d0 <setvbuf@plt>
lea    0xdd2(%rip),%r15
mov    0x2dc3(%rip),%rbx
xor    %ebp,%ebp
movslq %ebp,%rbp
nopw   0x0(%rax,%rax,1)
mov    %r12d,%edi
mov    0x8(%rsp),%rsi
mov    %r15,%rdx
call   10f0 <getopt@plt>
cmp    $0x67,%eax
jne    1290 <main+0xa0>
mov    (%rbx),%edi
call   1070 <strlen@plt>
lea    0x1(%rax),%edi
mov    $0x1,%esi
call   10a0 <calloc@plt>
mov    %rax,0x20(%rsp,%rbp,8)
mov    (%rbx),%esi
mov    %rax,%rdi
call   1030 <strcpy@plt>
cmp    $0x9,%ebp
jg     151c <main+0x32c>
add    $0x1,%rbp
jmp    1240 <main+0x50>
nopw   0x0(%rax,%rax,1)
cmp    $0xffffffff,%eax
je     12a3 <main+0xb3>
cmp    $0x70,%eax
jne    14ca <main+0x2da>
mov    $0x1,%r14b
jmp    1237 <main+0x47>
mov    0x2d26(%rip),%rax
movslq (%rax),%rax
cmp    %r12d,%eax
jl     153f <main+0x34f>
mov    0x2d23(%rip),%r15
mov    (%r15),%edx
lea    0x70(%rsp),%rdi
mov    $0x2000,%esi
call   1090 <fgets@plt>
test   %rax,%rax
mov    0x8(%rsp),%r12
je     14b6 <main+0x2c6>
mov    0x20(%rsp),%rax
mov    %rax,0x10(%rsp)
lea    0x70(%rsp),%rbp
mov    0x2ccd(%rip),%rbx
jmp    1325 <main+0x135>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xdb1(%rip),%rdi
call   1040 <puts@plt>
mov    (%r15),%edx
mov    %rbp,%rdi
mov    $0x2000,%esi
call   1090 <fgets@plt>
test   %rax,%rax
je     14b6 <main+0x2c6>
mov    %rbp,%rdi
mov    $0xa,%esi
call   1080 <strchr@plt>
test   %rax,%rax
je     1420 <main+0x230>
movb   $0x0,(%rax)
mov    %rbp,%rdi
lea    0x18(%rsp),%rsi
call   1050 <strwordtok@plt>
test   %rax,%rax
je     1300 <main+0x110>
mov    %rax,%r13
xor    %r15d,%r15d
xor    %edi,%edi
lea    0x18(%rsp),%rbp
mov    %rbp,%rsi
call   1050 <strwordtok@plt>
test   %rax,%rax
je     13c0 <main+0x1d0>
mov    %rax,%r12
xor    %ebx,%ebx
jmp    13a6 <main+0x1b6>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %r12,%rsi
call   1110 <validate_user_gr@plt>
mov    %rax,%r15
add    %ebx,%r15d
xor    %edi,%edi
mov    %rbp,%rsi
call   1050 <strwordtok@plt>
mov    %rax,%r12
mov    %r15d,%ebx
test   %rax,%rax
je     13c0 <main+0x1d0>
test   $0x1,%r14b
je     1380 <main+0x190>
mov    %r13,%rdi
mov    %r12,%rsi
call   1060 <validate_user_pw@plt>
add    %eax,%ebx
jmp    1380 <main+0x190>
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp),%rbx
test   %rbx,%rbx
je     1487 <main+0x297>
lea    0x28(%rsp),%rbp
mov    0x8(%rsp),%r12
jmp    1402 <main+0x212>
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %rbx,%rsi
call   1110 <validate_user_gr@plt>
add    %r15d,%eax
mov    0x0(%rbp),%rbx
add    $0x8,%rbp
mov    %eax,%r15d
test   %rbx,%rbx
je     148f <main+0x29f>
test   $0x1,%r14b
je     13e0 <main+0x1f0>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1060 <validate_user_pw@plt>
add    %eax,%r15d
jmp    13e0 <main+0x1f0>
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%edi
mov    (%r12),%rdx
lea    0xc55(%rip),%rsi
mov    %rbp,%rcx
xor    %eax,%eax
call   10b0 <fprintf@plt>
nopw   0x0(%rax,%rax,1)
mov    (%r15),%edx
mov    %rbp,%rdi
mov    $0x2000,%esi
call   1090 <fgets@plt>
test   %rax,%rax
je     1300 <main+0x110>
mov    (%rbx),%edi
mov    (%r12),%rdx
lea    0xc36(%rip),%rsi
mov    %rbp,%rcx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    %rbp,%rdi
mov    $0xa,%esi
call   1080 <strchr@plt>
test   %rax,%rax
je     1440 <main+0x250>
jmp    1300 <main+0x110>
mov    %r15d,%eax
mov    0x8(%rsp),%r12
lea    0xc26(%rip),%rdi
test   %eax,%eax
mov    0x2b41(%rip),%r15
lea    0x70(%rsp),%rbp
mov    0x2b15(%rip),%rbx
jg     1307 <main+0x117>
jmp    1300 <main+0x110>
xor    %eax,%eax
add    $0x2078,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x3f,%eax
jne    1505 <main+0x315>
mov    0x2b02(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10e0 <isprint@plt>
test   %eax,%eax
mov    0x2ad8(%rip),%rax
mov    (%rax),%edi
lea    0xb5a(%rip),%rax
lea    0xb3c(%rip),%rsi
cmove  %rax,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x8(%rsp),%rax
mov    (%rax),%rdi
call   10c0 <usage@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    0x2a9d(%rip),%rax
mov    (%rax),%edi
lea    0xad8(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    0x2a7a(%rip),%rcx
mov    (%rcx),%edi
mov    0x8(%rsp),%rbx
mov    (%rbx,%rax,8),%rdx
lea    0xb15(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    (%rbx),%rdi
jmp    150d <main+0x31d>

LLVM IR (-O0):
@stdout = global i32 0
@_IOLBF = global i32 0
@.str = [4 x i8] c"pg:\00"
@optarg = global i32 0
@stderr = global i32 0
@.str.1 = [48 x i8] c"Exceeded maximum number of allowed groups (%i)\0A\00"
@optopt = global i32 0
@.str.2 = [23 x i8] c"Unknown option '-%c'.\0A\00"
@.str.3 = [34 x i8] c"Unknown option character `\\x%x'.\0A\00"
@optind = global i32 0
@.str.4 = [21 x i8] c"Unknown option '%s'\0A\00"
@stdin = global i32 0
@.str.5 = [26 x i8] c"%s: ERROR: Too large: %s\0A\00"
@.str.6 = [28 x i8] c"%s: ERROR: Too large..: %s\0A\00"
@.str.7 = [4 x i8] c"OK\0A\00"
@.str.8 = [5 x i8] c"ERR\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [8192 x i8]
%10 = alloca [10 x i8*]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %11
store i32 0, i32* %13
store i32 0, i32* %14
%15 = load i32, i32* @stdout
%16 = load i32, i32* @_IOLBF
%17 = call i32 @setvbuf(i32 %15, i32* null, i32 %16, i32 0)
br label %18
18: ; preds = %70, %2
%19 = load i32, i32* %4
%20 = load i8**, i8*** %5
%21 = call i32 @getopt(i32 %19, i8** %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 %21, i32* %12
%22 = icmp ne i32 %21, -1
br i1 %22, label %23, label %71
23: ; preds = %18
%24 = load i32, i32* %12
switch i32 %24, label %64 [
i32 112, label %25
i32 103, label %26
i32 63, label %51
]
25: ; preds = %23
store i32 1, i32* %11
br label %70
26: ; preds = %23
%27 = load i32, i32* @optarg
%28 = call i32 @strlen(i32 %27)
%29 = add nsw i32 %28, 1
%30 = call i8* @calloc(i32 %29, i32 1)
%31 = load i32, i32* %13
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [10 x i8*], [10 x i8*]* %10, i64 0, i64 %32
store i8* %30, i8** %33
%34 = load i32, i32* %13
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [10 x i8*], [10 x i8*]* %10, i64 0, i64 %35
%37 = load i8*, i8** %36
%38 = load i32, i32* @optarg
%39 = call i32 @strcpy(i8* %37, i32 %38)
%40 = load i32, i32* %13
%41 = icmp slt i32 %40, 10
br i1 %41, label %42, label %45
42: ; preds = %26
%43 = load i32, i32* %13
%44 = add nsw i32 %43, 1
store i32 %44, i32* %13
br label %50
45: ; preds = %26
%46 = load i32, i32* @stderr
%47 = load i32, i32* %13
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 %47)
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %42
br label %70
51: ; preds = %23
%52 = load i32, i32* @optopt
%53 = call i32 @isprint(i32 %52)
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %59
55: ; preds = %51
%56 = load i32, i32* @stderr
%57 = load i32, i32* @optopt
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %57)
br label %63
59: ; preds = %51
%60 = load i32, i32* @stderr
%61 = load i32, i32* @optopt
%62 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %61)
br label %63
63: ; preds = %59, %55
br label %64
64: ; preds = %23, %63
%65 = load i8**, i8*** %5
%66 = getelementptr inbounds i8*, i8** %65, i64 0
%67 = load i8*, i8** %66
%68 = call i32 @usage(i8* %67)
%69 = call i32 @exit(i32 1)
unreachable
70: ; preds = %50, %25
br label %18
71: ; preds = %18
%72 = load i32, i32* @optind
%73 = load i32, i32* %4
%74 = icmp slt i32 %72, %73
br i1 %74, label %75, label %88
75: ; preds = %71
%76 = load i32, i32* @stderr
%77 = load i8**, i8*** %5
%78 = load i32, i32* @optind
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8*, i8** %77, i64 %79
%81 = load i8*, i8** %80
%82 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %81)
%83 = load i8**, i8*** %5
%84 = getelementptr inbounds i8*, i8** %83, i64 0
%85 = load i8*, i8** %84
%86 = call i32 @usage(i8* %85)
%87 = call i32 @exit(i32 1)
unreachable
88: ; preds = %71
br label %89
89: ; preds = %198, %88
%90 = getelementptr inbounds [8192 x i8], [8192 x i8]* %9, i64 0, i64 0
%91 = load i32, i32* @stdin
%92 = call i64 @fgets(i8* %90, i32 8192, i32 %91)
%93 = icmp ne i64 %92, 0
br i1 %93, label %94, label %199
94: ; preds = %89
store i32 0, i32* %14
%95 = getelementptr inbounds [8192 x i8], [8192 x i8]* %9, i64 0, i64 0
%96 = call i8* @strchr(i8* %95, i8 signext 10)
store i8* %96, i8** %7
%97 = icmp ne i8* %96, null
br i1 %97, label %98, label %100
98: ; preds = %94
%99 = load i8*, i8** %7
store i8 0, i8* %99
br label %125
100: ; preds = %94
%101 = load i32, i32* @stderr
%102 = load i8**, i8*** %5
%103 = getelementptr inbounds i8*, i8** %102, i64 0
%104 = load i8*, i8** %103
%105 = getelementptr inbounds [8192 x i8], [8192 x i8]* %9, i64 0, i64 0
%106 = call i32 (i32, i8*, ...) @fprintf(i32 %101, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %104, i8* %105)
br label %107
107: ; preds = %123, %100
%108 = getelementptr inbounds [8192 x i8], [8192 x i8]* %9, i64 0, i64 0
%109 = load i32, i32* @stdin
%110 = call i64 @fgets(i8* %108, i32 8192, i32 %109)
%111 = icmp ne i64 %110, 0
br i1 %111, label %112, label %124
112: ; preds = %107
%113 = load i32, i32* @stderr
%114 = load i8**, i8*** %5
%115 = getelementptr inbounds i8*, i8** %114, i64 0
%116 = load i8*, i8** %115
%117 = getelementptr inbounds [8192 x i8], [8192 x i8]* %9, i64 0, i64 0
%118 = call i32 (i32, i8*, ...) @fprintf(i32 %113, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i8* %116, i8* %117)
%119 = getelementptr inbounds [8192 x i8], [8192 x i8]* %9, i64 0, i64 0
%120 = call i8* @strchr(i8* %119, i8 signext 10)
%121 = icmp ne i8* %120, null
br i1 %121, label %122, label %123
122: ; preds = %112
br label %124
123: ; preds = %112
br label %107
124: ; preds = %122, %107
br label %196
125: ; preds = %98
%126 = getelementptr inbounds [8192 x i8], [8192 x i8]* %9, i64 0, i64 0
%127 = call i8* @strwordtok(i8* %126, i8** %8)
store i8* %127, i8** %7
%128 = icmp eq i8* %127, null
br i1 %128, label %129, label %130
129: ; preds = %125
br label %196
130: ; preds = %125
%131 = load i8*, i8** %7
store i8* %131, i8** %6
br label %132
132: ; preds = %146, %130
%133 = call i8* @strwordtok(i8* null, i8** %8)
store i8* %133, i8** %7
%134 = icmp ne i8* %133, null
br i1 %134, label %135, label %154
135: ; preds = %132
%136 = load i32, i32* %11
%137 = icmp eq i32 %136, 1
br i1 %137, label %138, label %146
138: ; preds = %135
%139 = load i8*, i8** %6
%140 = load i8*, i8** %7
%141 = call i64 @validate_user_pw(i8* %139, i8* %140)
%142 = load i32, i32* %14
%143 = sext i32 %142 to i64
%144 = add nsw i64 %143, %141
%145 = trunc i64 %144 to i32
store i32 %145, i32* %14
br label %146
146: ; preds = %138, %135
%147 = load i8*, i8** %6
%148 = load i8*, i8** %7
%149 = call i64 @validate_user_gr(i8* %147, i8* %148)
%150 = load i32, i32* %14
%151 = sext i32 %150 to i64
%152 = add nsw i64 %151, %149
%153 = trunc i64 %152 to i32
store i32 %153, i32* %14
br label %132
154: ; preds = %132
br label %155
155: ; preds = %154
store i32 0, i32* %13
br label %156
156: ; preds = %187, %155
%157 = load i32, i32* %13
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds [10 x i8*], [10 x i8*]* %10, i64 0, i64 %158
%160 = load i8*, i8** %159
%161 = icmp ne i8* %160, null
br i1 %161, label %162, label %190
162: ; preds = %156
%163 = load i32, i32* %11
%164 = icmp eq i32 %163, 1
br i1 %164, label %165, label %176
165: ; preds = %162
%166 = load i8*, i8** %6
%167 = load i32, i32* %13
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds [10 x i8*], [10 x i8*]* %10, i64 0, i64 %168
%170 = load i8*, i8** %169
%171 = call i64 @validate_user_pw(i8* %166, i8* %170)
%172 = load i32, i32* %14
%173 = sext i32 %172 to i64
%174 = add nsw i64 %173, %171
%175 = trunc i64 %174 to i32
store i32 %175, i32* %14
br label %176
176: ; preds = %165, %162
%177 = load i8*, i8** %6
%178 = load i32, i32* %13
%179 = sext i32 %178 to i64
%180 = getelementptr inbounds [10 x i8*], [10 x i8*]* %10, i64 0, i64 %179
%181 = load i8*, i8** %180
%182 = call i64 @validate_user_gr(i8* %177, i8* %181)
%183 = load i32, i32* %14
%184 = sext i32 %183 to i64
%185 = add nsw i64 %184, %182
%186 = trunc i64 %185 to i32
store i32 %186, i32* %14
br label %187
187: ; preds = %176
%188 = load i32, i32* %13
%189 = add nsw i32 %188, 1
store i32 %189, i32* %13
br label %156
190: ; preds = %156
%191 = load i32, i32* %14
%192 = icmp sgt i32 %191, 0
br i1 %192, label %193, label %195
193: ; preds = %190
%194 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %198
195: ; preds = %190
br label %196
196: ; preds = %195, %129, %124
%197 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %198
198: ; preds = %196, %193
br label %89
199: ; preds = %89
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@_IOLBF = global i32 0
@.str = [4 x i8] c"pg:\00"
@optarg = global i32 0
@stderr = global i32 0
@.str.1 = [48 x i8] c"Exceeded maximum number of allowed groups (%i)\0A\00"
@optopt = global i32 0
@.str.2 = [23 x i8] c"Unknown option '-%c'.\0A\00"
@.str.3 = [34 x i8] c"Unknown option character `\\x%x'.\0A\00"
@optind = global i32 0
@.str.4 = [21 x i8] c"Unknown option '%s'\0A\00"
@stdin = global i32 0
@.str.5 = [26 x i8] c"%s: ERROR: Too large: %s\0A\00"
@.str.6 = [28 x i8] c"%s: ERROR: Too large..: %s\0A\00"
@str = [4 x i8] c"ERR\00"
@str.9 = [3 x i8] c"OK\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = alloca [8192 x i8]
%5 = alloca [10 x i8*]
%6 = bitcast i8** %3 to i8*
%7 = getelementptr inbounds [8192 x i8], [8192 x i8]* %4, i64 0, i64 0
%8 = bitcast [10 x i8*]* %5 to i8*
%9 = load i32, i32* @stdout
%10 = load i32, i32* @_IOLBF
%11 = tail call i32 @setvbuf(i32 %9, i32* null, i32 %10, i32 0)
br label %12
12: ; preds = %15, %2
%13 = phi i1 [ false, %2 ], [ true, %15 ]
%14 = phi i32 [ 0, %2 ], [ %16, %15 ]
br label %15
15: ; preds = %12, %28
%16 = phi i32 [ %29, %28 ], [ %14, %12 ]
%17 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
switch i32 %17, label %41 [
i32 -1, label %45
i32 112, label %12
i32 103, label %18
i32 63, label %34
]
18: ; preds = %15
%19 = load i32, i32* @optarg
%20 = tail call i32 @strlen(i32 %19)
%21 = add nsw i32 %20, 1
%22 = tail call i8* @calloc(i32 %21, i32 1)
%23 = sext i32 %16 to i64
%24 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 %23
store i8* %22, i8** %24
%25 = load i32, i32* @optarg
%26 = tail call i32 @strcpy(i8* %22, i32 %25)
%27 = icmp slt i32 %16, 10
br i1 %27, label %28, label %30
28: ; preds = %18
%29 = add nsw i32 %16, 1
br label %15
30: ; preds = %18
%31 = load i32, i32* @stderr
%32 = tail call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%33 = tail call i32 @exit(i32 1)
unreachable
34: ; preds = %15
%35 = load i32, i32* @optopt
%36 = tail call i32 @isprint(i32 %35)
%37 = icmp eq i32 %36, 0
%38 = load i32, i32* @stderr
%39 = select i1 %37, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0)
%40 = tail call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* %39, i32 %35)
br label %41
41: ; preds = %15, %34
%42 = load i8*, i8** %1
%43 = tail call i32 @usage(i8* %42)
%44 = tail call i32 @exit(i32 1)
unreachable
45: ; preds = %15
%46 = load i32, i32* @optind
%47 = icmp slt i32 %46, %0
br i1 %47, label %56, label %48
48: ; preds = %45
%49 = load i32, i32* @stdin
%50 = call i64 @fgets(i8* %7, i32 8192, i32 %49)
%51 = icmp eq i64 %50, 0
br i1 %51, label %131, label %52
52: ; preds = %48
%53 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 0
%54 = load i8*, i8** %53
%55 = icmp eq i8* %54, null
br label %65
56: ; preds = %45
%57 = load i32, i32* @stderr
%58 = sext i32 %46 to i64
%59 = getelementptr inbounds i8*, i8** %1, i64 %58
%60 = load i8*, i8** %59
%61 = tail call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %60)
%62 = load i8*, i8** %1
%63 = tail call i32 @usage(i8* %62)
%64 = tail call i32 @exit(i32 1)
unreachable
65: ; preds = %52, %125
%66 = call i8* @strchr(i8* %7, i8 signext 10)
%67 = icmp eq i8* %66, null
br i1 %67, label %74, label %68
68: ; preds = %65
store i8 0, i8* %66
%69 = call i8* @strwordtok(i8* %7, i8** %3)
%70 = icmp eq i8* %69, null
br i1 %70, label %124, label %71
71: ; preds = %68
%72 = call i8* @strwordtok(i8* null, i8** %3)
%73 = icmp eq i8* %72, null
br i1 %73, label %88, label %90
74: ; preds = %65
%75 = load i32, i32* @stderr
%76 = load i8*, i8** %1
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %75, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %76, i8* %7)
br label %78
78: ; preds = %82, %74
%79 = load i32, i32* @stdin
%80 = call i64 @fgets(i8* %7, i32 8192, i32 %79)
%81 = icmp eq i64 %80, 0
br i1 %81, label %124, label %82
82: ; preds = %78
%83 = load i32, i32* @stderr
%84 = load i8*, i8** %1
%85 = call i32 (i32, i8*, ...) @fprintf(i32 %83, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i8* %84, i8* %7)
%86 = call i8* @strchr(i8* %7, i8 signext 10)
%87 = icmp eq i8* %86, null
br i1 %87, label %78, label %124
88: ; preds = %97, %71
%89 = phi i32 [ 0, %71 ], [ %101, %97 ]
br i1 %55, label %121, label %104
90: ; preds = %71, %97
%91 = phi i8* [ %102, %97 ], [ %72, %71 ]
%92 = phi i32 [ %101, %97 ], [ 0, %71 ]
br i1 %13, label %93, label %97
93: ; preds = %90
%94 = call i64 @validate_user_pw(i8* %69, i8* %91)
%95 = trunc i64 %94 to i32
%96 = add i32 %92, %95
br label %97
97: ; preds = %93, %90
%98 = phi i32 [ %96, %93 ], [ %92, %90 ]
%99 = call i64 @validate_user_gr(i8* %69, i8* %91)
%100 = trunc i64 %99 to i32
%101 = add i32 %98, %100
%102 = call i8* @strwordtok(i8* null, i8** %3)
%103 = icmp eq i8* %102, null
br i1 %103, label %88, label %90
104: ; preds = %88, %112
%105 = phi i64 [ %117, %112 ], [ 0, %88 ]
%106 = phi i8* [ %119, %112 ], [ %54, %88 ]
%107 = phi i32 [ %116, %112 ], [ %89, %88 ]
br i1 %13, label %108, label %112
108: ; preds = %104
%109 = call i64 @validate_user_pw(i8* %69, i8* %106)
%110 = trunc i64 %109 to i32
%111 = add i32 %107, %110
br label %112
112: ; preds = %108, %104
%113 = phi i32 [ %111, %108 ], [ %107, %104 ]
%114 = call i64 @validate_user_gr(i8* %69, i8* %106)
%115 = trunc i64 %114 to i32
%116 = add i32 %113, %115
%117 = add nuw i64 %105, 1
%118 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 %117
%119 = load i8*, i8** %118
%120 = icmp eq i8* %119, null
br i1 %120, label %121, label %104
121: ; preds = %112, %88
%122 = phi i32 [ %89, %88 ], [ %116, %112 ]
%123 = icmp sgt i32 %122, 0
br i1 %123, label %125, label %124
124: ; preds = %78, %82, %121, %68
br label %125
125: ; preds = %121, %124
%126 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0), %124 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @str.9, i64 0, i64 0), %121 ]
%127 = call i32 @puts(i8* dereferenceable(1) %126)
%128 = load i32, i32* @stdin
%129 = call i64 @fgets(i8* %7, i32 8192, i32 %128)
%130 = icmp eq i64 %129, 0
br i1 %130, label %131, label %65
131: ; preds = %125, %48
ret i32 0
}