#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*/ SIGINT;
int /*<<< orphan*/ SIG_IGN;
scalar_t__ _login(char *);
int _login_usage();
int getopt(int, char **, char *);
int optind;
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int o;
  char *user = NULL;
  while ((o = getopt(argc, argv, "")) != -1)
    switch (o) {
    default:
      return _login_usage();
    }
  if (optind != argc && optind + 1 != argc)
    return _login_usage();
  signal(SIGINT, SIG_IGN);
  return _login(user) ? 0 : 2;
}


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)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe94(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     118c <main+0x4c>
mov    $0x0,%al
call   1030 <_login_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    11f6 <main+0xb6>
mov    0x2e4d(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
je     11c2 <main+0x82>
mov    0x2e3b(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
cmp    -0x8(%rbp),%eax
je     11c2 <main+0x82>
mov    $0x0,%al
call   1030 <_login_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    11f6 <main+0xb6>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
mov    0x2e06(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    -0x20(%rbp),%rdi
call   1050 <_login@plt>
mov    %rax,%rdx
mov    $0x2,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %edi,%ebx
lea    0xeb6(%rip),%rdx
call   1060 <getopt@plt>
cmp    $0xffffffff,%eax
jne    1168 <main+0x28>
mov    0x2e85(%rip),%rax
mov    (%rax),%eax
cmp    %ebx,%eax
je     1170 <main+0x30>
add    $0x1,%eax
cmp    %ebx,%eax
je     1170 <main+0x30>
xor    %eax,%eax
pop    %rbx
jmp    1030 <_login_usage@plt>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
mov    0x2e58(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
xor    %edi,%edi
call   1050 <_login@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
add    %ecx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@optind = global i32 0
@SIGINT = 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 i32
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %7
br label %8
8: ; preds = %2
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @getopt(i32 %9, i8** %10, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i32 %11, i32* %6
%12 = icmp ne i32 %11, -1
br i1 %12, label %13, label %17
13: ; preds = %8
%14 = load i32, i32* %6
switch i32 %14, label %15 [
]
15: ; preds = %13
%16 = call i32 (...) @_login_usage()
store i32 %16, i32* %3
br label %37
17: ; preds = %8
%18 = load i32, i32* @optind
%19 = load i32, i32* %4
%20 = icmp ne i32 %18, %19
br i1 %20, label %21, label %28
21: ; preds = %17
%22 = load i32, i32* @optind
%23 = add nsw i32 %22, 1
%24 = load i32, i32* %4
%25 = icmp ne i32 %23, %24
br i1 %25, label %26, label %28
26: ; preds = %21
%27 = call i32 (...) @_login_usage()
store i32 %27, i32* %3
br label %37
28: ; preds = %21, %17
%29 = load i32, i32* @SIGINT
%30 = load i32, i32* @SIG_IGN
%31 = call i32 @signal(i32 %29, i32 %30)
%32 = load i8*, i8** %7
%33 = call i64 @_login(i8* %32)
%34 = icmp ne i64 %33, 0
%35 = zext i1 %34 to i64
%36 = select i1 %34, i32 0, i32 2
store i32 %36, i32* %3
br label %37
37: ; preds = %28, %26, %15
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@optind = global i32 0
@SIGINT = global i32 0
@SIG_IGN = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, -1
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (...) @_login_usage()
br label %22
7: ; preds = %2
%8 = load i32, i32* @optind
%9 = icmp eq i32 %8, %0
%10 = add nsw i32 %8, 1
%11 = icmp eq i32 %10, %0
%12 = select i1 %9, i1 true, i1 %11
br i1 %12, label %15, label %13
13: ; preds = %7
%14 = tail call i32 (...) @_login_usage()
br label %22
15: ; preds = %7
%16 = load i32, i32* @SIGINT
%17 = load i32, i32* @SIG_IGN
%18 = tail call i32 @signal(i32 %16, i32 %17)
%19 = tail call i64 @_login(i8* null)
%20 = icmp eq i64 %19, 0
%21 = select i1 %20, i32 2, i32 0
br label %22
22: ; preds = %15, %13, %5
%23 = phi i32 [ %6, %5 ], [ %14, %13 ], [ %21, %15 ]
ret i32 %23
}