#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 */
char *crypt(char const *, char const *);
scalar_t__ strcmp(char const *, char const *);
int pwok(const char *good, const char *guess, int do_crypt) {
  char *cs;
  if (do_crypt == 0)
    return strcmp(good, guess) == 0;
  cs = crypt(guess, good);
  if (cs)
    return strcmp(good, cs) == 0;
  return 0;
}


x86 assembly (clang, -O0):
<pwok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    115e <pwok+0x3e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11a2 <pwok+0x82>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <crypt@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     119b <pwok+0x7b>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11a2 <pwok+0x82>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pwok>:
push   %rbx
mov    %rdi,%rbx
test   %edx,%edx
je     1140 <pwok+0x20>
mov    %rsi,%rdi
mov    %rbx,%rsi
call   1030 <crypt@plt>
test   %rax,%rax
je     1150 <pwok+0x30>
mov    %rbx,%rdi
mov    %rax,%rsi
jmp    1143 <pwok+0x23>
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
sete   %al
jmp    1152 <pwok+0x32>
xor    %eax,%eax
movzbl %al,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @pwok(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%9 = load i32, i32* %7
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %3
%12 = load i8*, i8** %5
%13 = load i8*, i8** %6
%14 = call i64 @strcmp(i8* %12, i8* %13)
%15 = icmp eq i64 %14, 0
%16 = zext i1 %15 to i32
store i32 %16, i32* %4
br label %30
17: ; preds = %3
%18 = load i8*, i8** %6
%19 = load i8*, i8** %5
%20 = call i8* @crypt(i8* %18, i8* %19)
store i8* %20, i8** %8
%21 = load i8*, i8** %8
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %29
23: ; preds = %17
%24 = load i8*, i8** %5
%25 = load i8*, i8** %8
%26 = call i64 @strcmp(i8* %24, i8* %25)
%27 = icmp eq i64 %26, 0
%28 = zext i1 %27 to i32
store i32 %28, i32* %4
br label %30
29: ; preds = %17
store i32 0, i32* %4
br label %30
30: ; preds = %29, %23, %11
%31 = load i32, i32* %4
ret i32 %31
}

LLVM IR (-O2):
define i32 @pwok(i8* %0, i8* %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = tail call i64 @strcmp(i8* %0, i8* %1)
%7 = icmp eq i64 %6, 0
br label %14
8: ; preds = %3
%9 = tail call i8* @crypt(i8* %1, i8* %0)
%10 = icmp eq i8* %9, null
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = tail call i64 @strcmp(i8* %0, i8* %9)
%13 = icmp eq i64 %12, 0
br label %14
14: ; preds = %8, %11, %5
%15 = phi i1 [ %7, %5 ], [ %13, %11 ], [ false, %8 ]
%16 = zext i1 %15 to i32
ret i32 %16
}