#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 *, char *);
int /*<<< orphan*/ exit(int);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
main() {
  char passwd[9];
  char salt[9];
  char c_out1[256];
  char c_out2[256];
  char expected_out[14];
  strcpy(expected_out, "12yJ.Of/NQ.Pk");
  strcpy(passwd, "12345678");
  strcpy(salt, "12345678");
  strcpy(c_out1, crypt(passwd, salt));
  salt[2] = '\0';
  strcpy(c_out2, crypt(passwd, salt));
  if ((strcmp(c_out1, expected_out) != 0) &&
      (strcmp(c_out2, expected_out) == 0))
    exit(1);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x22e(%rbp),%rdi
lea    0xea0(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0xd(%rbp),%rdi
lea    0xe9e(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x16(%rbp),%rdi
lea    0xe8e(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x120(%rbp),%rax
mov    %rax,-0x240(%rbp)
lea    -0xd(%rbp),%rdi
lea    -0x16(%rbp),%rsi
call   1040 <crypt@plt>
mov    -0x240(%rbp),%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
movb   $0x0,-0x14(%rbp)
lea    -0x220(%rbp),%rax
mov    %rax,-0x238(%rbp)
lea    -0xd(%rbp),%rdi
lea    -0x16(%rbp),%rsi
call   1040 <crypt@plt>
mov    -0x238(%rbp),%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
lea    -0x120(%rbp),%rdi
lea    -0x22e(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1221 <main+0xe1>
lea    -0x220(%rbp),%rdi
lea    -0x22e(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1221 <main+0xe1>
mov    $0x1,%edi
call   1060 <exit@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x228,%rsp
lea    0xeab(%rip),%rsi
lea    0x9(%rsp),%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
lea    0xea5(%rip),%r12
lea    0x17(%rsp),%r15
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <crypt@plt>
lea    0x120(%rsp),%r12
mov    %r12,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
movb   $0x0,0x2(%rsp)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <crypt@plt>
lea    0x20(%rsp),%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11f0 <main+0xb0>
lea    0x20(%rsp),%rdi
lea    0x9(%rsp),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    11f0 <main+0xb0>
mov    $0x1,%edi
call   1060 <exit@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"12yJ.Of/NQ.Pk\00"
@.str.1 = [9 x i8] c"12345678\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [9 x i8]
%3 = alloca [9 x i8]
%4 = alloca [256 x i8]
%5 = alloca [256 x i8]
%6 = alloca [14 x i8]
store i32 0, i32* %1
%7 = getelementptr inbounds [14 x i8], [14 x i8]* %6, i64 0, i64 0
%8 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%10 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%11 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%14 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%15 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%16 = call i8* @crypt(i8* %14, i8* %15)
%17 = call i32 @strcpy(i8* %13, i8* %16)
%18 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 2
store i8 0, i8* %18
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%20 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%21 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%22 = call i8* @crypt(i8* %20, i8* %21)
%23 = call i32 @strcpy(i8* %19, i8* %22)
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%25 = getelementptr inbounds [14 x i8], [14 x i8]* %6, i64 0, i64 0
%26 = call i64 @strcmp(i8* %24, i8* %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %35
28: ; preds = %0
%29 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%30 = getelementptr inbounds [14 x i8], [14 x i8]* %6, i64 0, i64 0
%31 = call i64 @strcmp(i8* %29, i8* %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %28
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %28, %0
%36 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [14 x i8] c"12yJ.Of/NQ.Pk\00"
@.str.1 = [9 x i8] c"12345678\00"
define i32 @main() {
%1 = alloca [9 x i8]
%2 = alloca [9 x i8]
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
%5 = alloca [14 x i8]
%6 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [14 x i8], [14 x i8]* %5, i64 0, i64 0
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%14 = call i8* @crypt(i8* %6, i8* %7)
%15 = call i32 @strcpy(i8* %8, i8* %14)
%16 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 2
store i8 0, i8* %16
%17 = call i8* @crypt(i8* %6, i8* %7)
%18 = call i32 @strcpy(i8* %9, i8* %17)
%19 = call i64 @strcmp(i8* %8, i8* %10)
%20 = icmp eq i64 %19, 0
br i1 %20, label %26, label %21
21: ; preds = %0
%22 = call i64 @strcmp(i8* %9, i8* %10)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %21, %0
%27 = call i32 @exit(i32 0)
unreachable
}