#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 EXIT_FAILURE;
int EXIT_SUCCESS;
char *crypt(char *, char const *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  const char salt[] = "$1$saltstring";
  char *cp;
  cp = crypt("Hello world!", salt);
  if (strcmp("$1$saltstri$YMyguxXMBpd2TEZ.vS/3q1", cp)) {
    fprintf(stderr, "Failed md5 crypt test!\n");
    return EXIT_FAILURE;
  }
  fprintf(stderr, "Passed md5 crypt test!\n");
  return EXIT_SUCCESS;
}


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)
mov    0xeb3(%rip),%rax
mov    %rax,-0x1e(%rbp)
mov    0xeb1(%rip),%eax
mov    %eax,-0x16(%rbp)
mov    0xeab(%rip),%ax
mov    %ax,-0x12(%rbp)
lea    -0x1e(%rbp),%rsi
lea    0xe9e(%rip),%rdi
call   1030 <crypt@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe97(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11b9 <main+0x89>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
lea    0xe9b(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e29(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11da <main+0xaa>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
lea    0xe8d(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2dfb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x676e6972747374,%rax
mov    %rax,0x6(%rsp)
movabs $0x73746c6173243124,%rax
6c 74 73
mov    %rax,(%rsp)
lea    0xeb5(%rip),%rdi
mov    %rsp,%rsi
call   1030 <crypt@plt>
lea    0xeb3(%rip),%rdi
mov    %rax,%rsi
call   1040 <strcmp@plt>
mov    0x2e69(%rip),%rcx
mov    (%rcx),%edi
test   %rax,%rax
lea    0xed3(%rip),%rax
lea    0xeb4(%rip),%rsi
cmove  %rax,%rsi
mov    0x2e43(%rip),%rbx
cmove  0x2e33(%rip),%rbx
call   1050 <fprintf@plt>
mov    (%rbx),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.salt = [14 x i8] c"$1$saltstring\00"
@.str = [13 x i8] c"Hello world!\00"
@.str.1 = [35 x i8] c"$1$saltstri$YMyguxXMBpd2TEZ.vS/3q1\00"
@stderr = global i32 0
@.str.2 = [24 x i8] c"Failed md5 crypt test!\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [24 x i8] c"Passed md5 crypt test!\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [14 x i8]
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [14 x i8]* %6 to i8*
%9 = getelementptr inbounds [14 x i8], [14 x i8]* %6, i64 0, i64 0
%10 = call i8* @crypt(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %9)
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = call i64 @strcmp(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* @EXIT_FAILURE
store i32 %17, i32* %3
br label %22
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%21 = load i32, i32* @EXIT_SUCCESS
store i32 %21, i32* %3
br label %22
22: ; preds = %18, %14
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@__const.main.salt = [14 x i8] c"$1$saltstring\00"
@.str = [13 x i8] c"Hello world!\00"
@.str.1 = [35 x i8] c"$1$saltstri$YMyguxXMBpd2TEZ.vS/3q1\00"
@stderr = global i32 0
@.str.2 = [24 x i8] c"Failed md5 crypt test!\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [24 x i8] c"Passed md5 crypt test!\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [14 x i8]
%4 = getelementptr inbounds [14 x i8], [14 x i8]* %3, i64 0, i64 0
%5 = call i8* @crypt(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i64 @strcmp(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = icmp eq i64 %6, 0
%8 = load i32, i32* @stderr
%9 = select i1 %7, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0)
%10 = call i32 @fprintf(i32 %8, i8* %9)
%11 = load i32, i32* @EXIT_SUCCESS
%12 = load i32, i32* @EXIT_FAILURE
%13 = select i1 %7, i32 %11, i32 %12
ret i32 %13
}