#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 */
scalar_t__ FascistCheck(char *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main(int ARGC, char *ARGV[]) {
  char gecos[256];
  char *path = "/usr/local/lib/pw_dict";
  char passwd[256];
  char *retval;
  if (ARGC < 4) {
    printf("Usage: checkpass <pass> <login> <fullname>\n");
    return 0;
  }
  strncpy(passwd, ARGV[1], 255);
  sprintf(gecos, "%s:%s", ARGV[2], ARGV[3]);
  retval = (char *)FascistCheck(passwd, path, gecos);
  if (retval != NULL) {
    printf("Invalid Password: %s\n", retval);
    return 1;
  }
  printf("ok\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea0(%rip),%rax
mov    %rax,-0x118(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    118b <main+0x4b>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    122c <main+0xec>
lea    -0x220(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0xff,%edx
call   1030 <strncpy@plt>
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rcx
lea    0xe81(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x220(%rbp),%rdi
mov    -0x118(%rbp),%rsi
lea    -0x110(%rbp),%rdx
call   1040 <FascistCheck@plt>
mov    %rax,-0x228(%rbp)
cmpq   $0x0,-0x228(%rbp)
je     1217 <main+0xd7>
mov    -0x228(%rbp),%rsi
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    122c <main+0xec>
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x208,%rsp
cmp    $0x3,%edi
jg     1168 <main+0x18>
lea    0xed0(%rip),%rdi
jmp    11d4 <main+0x84>
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0xff,%edx
call   1030 <strncpy@plt>
mov    0x10(%rbx),%rdx
mov    0x18(%rbx),%rcx
lea    0xe89(%rip),%rsi
lea    0x100(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <sprintf@plt>
lea    0xe5b(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1050 <FascistCheck@plt>
test   %rax,%rax
je     11cd <main+0x7d>
lea    0xe61(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%eax
jmp    11db <main+0x8b>
lea    0xe5f(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"/usr/local/lib/pw_dict\00"
@.str.1 = [44 x i8] c"Usage: checkpass <pass> <login> <fullname>\0A\00"
@.str.2 = [6 x i8] c"%s:%s\00"
@.str.3 = [22 x i8] c"Invalid Password: %s\0A\00"
@.str.4 = [4 x i8] c"ok\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i8]
%7 = alloca i8*
%8 = alloca [256 x i8]
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8** %7
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 4
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %40
14: ; preds = %2
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @strncpy(i8* %15, i8* %18, i32 255)
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 3
%26 = load i8*, i8** %25
%27 = call i32 @sprintf(i8* %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %23, i8* %26)
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%29 = load i8*, i8** %7
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%31 = call i64 @FascistCheck(i8* %28, i8* %29, i8* %30)
%32 = inttoptr i64 %31 to i8*
store i8* %32, i8** %9
%33 = load i8*, i8** %9
%34 = icmp ne i8* %33, null
br i1 %34, label %35, label %38
35: ; preds = %14
%36 = load i8*, i8** %9
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %36)
store i32 1, i32* %3
br label %40
38: ; preds = %14
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %3
br label %40
40: ; preds = %38, %35, %12
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@.str = [23 x i8] c"/usr/local/lib/pw_dict\00"
@.str.2 = [6 x i8] c"%s:%s\00"
@.str.3 = [22 x i8] c"Invalid Password: %s\0A\00"
@str = [3 x i8] c"ok\00"
@str.5 = [43 x i8] c"Usage: checkpass <pass> <login> <fullname>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %0, 4
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.5, i64 0, i64 0))
br label %26
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @strncpy(i8* %6, i8* %12, i32 255)
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = getelementptr inbounds i8*, i8** %1, i64 3
%17 = load i8*, i8** %16
%18 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %15, i8* %17)
%19 = call i64 @FascistCheck(i8* %6, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %5)
%20 = icmp eq i64 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %10
%22 = inttoptr i64 %19 to i8*
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %22)
br label %26
24: ; preds = %10
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
br label %26
26: ; preds = %24, %21, %8
%27 = phi i32 [ 0, %8 ], [ 1, %21 ], [ 0, %24 ]
ret i32 %27
}