#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__ crypt(char *, char const *);
int /*<<< orphan*/ exit(int);
char *recv_secret();
int /*<<< orphan*/ store_encrypted_secret(char *);
int main(int argc, char **argv) {
  char *secret;
  char *encrypted_secret;
  unsigned int len;
  const char *salt = "/.";
  if ((secret = recv_secret()) == NULL) {
    exit(1);
  }
  if ((encrypted_secret = (char *)crypt(secret, salt)) == NULL) {
    exit(1);
  }
  if (!store_encrypted_secret(encrypted_secret)) {
    exit(1);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   1040 <recv_secret@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1180 <main+0x40>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1030 <crypt@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    11a5 <main+0x65>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x20(%rbp),%rdi
call   1050 <store_encrypted_secret@plt>
cmp    $0x0,%eax
jne    11c1 <main+0x81>
mov    $0x1,%edi
call   1060 <exit@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <recv_secret@plt>
test   %rax,%rax
je     116d <main+0x2d>
lea    0xeac(%rip),%rsi
mov    %rax,%rdi
call   1030 <crypt@plt>
test   %rax,%rax
je     116d <main+0x2d>
mov    %rax,%rdi
call   1050 <store_encrypted_secret@plt>
test   %eax,%eax
jne    1177 <main+0x37>
mov    $0x1,%edi
call   1060 <exit@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"/.\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 i32
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %9
%10 = call i8* (...) @recv_secret()
store i8* %10, i8** %6
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = load i8*, i8** %6
%16 = load i8*, i8** %9
%17 = call i64 @crypt(i8* %15, i8* %16)
%18 = inttoptr i64 %17 to i8*
store i8* %18, i8** %7
%19 = icmp eq i8* %18, null
br i1 %19, label %20, label %22
20: ; preds = %14
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %14
%23 = load i8*, i8** %7
%24 = call i32 @store_encrypted_secret(i8* %23)
%25 = icmp ne i32 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %22
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %22
%29 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [3 x i8] c"/.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* (...) @recv_secret()
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %2
%8 = tail call i64 @crypt(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %7
%13 = inttoptr i64 %8 to i8*
%14 = tail call i32 @store_encrypted_secret(i8* %13)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = tail call i32 @exit(i32 1)
unreachable
18: ; preds = %12
%19 = tail call i32 @exit(i32 0)
unreachable
}