#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 /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char const *);
int strlen(char const *);
char *make_md5_salt_para(const char *saltpara) {
  static char salt[21];
  if (saltpara && (strlen(saltpara) <= 16)) {
    sprintf(salt, "$1$%s$", saltpara);
    return salt;
  }
  printf("Invalid Salt, please use up to 16 random alphanumeric characters\n");
  exit(1);
  return NULL;
}


x86 assembly (clang, -O0):
<make_md5_salt_para>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     118d <make_md5_salt_para+0x4d>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x10,%eax
jg     118d <make_md5_salt_para+0x4d>
mov    -0x8(%rbp),%rdx
lea    0x2edc(%rip),%rdi
lea    0xe85(%rip),%rsi
call   1050 <sprintf@plt>
lea    0x2ec9(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<make_md5_salt_para>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     117a <make_md5_salt_para+0x3a>
mov    %rdi,%rbx
call   1040 <strlen@plt>
cmp    $0x10,%eax
jg     117a <make_md5_salt_para+0x3a>
lea    0x2ef3(%rip),%r14
lea    0xe9c(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1050 <sprintf@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe86(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@make_md5_salt_para.salt = internal global [21 x i8] zeroinitializer
@.str = [7 x i8] c"$1$%s$\00"
@.str.1 = [66 x i8] c"Invalid Salt, please use up to 16 random alphanumeric characters\0A\00"
define i8* @make_md5_salt_para(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @strlen(i8* %6)
%8 = icmp sle i32 %7, 16
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i8*, i8** %2
%11 = call i32 @sprintf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @make_md5_salt_para.salt, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %10)
ret i8* getelementptr inbounds ([21 x i8], [21 x i8]* @make_md5_salt_para.salt, i64 0, i64 0)
12: ; preds = %5, %1
%13 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@make_md5_salt_para.salt = internal global [21 x i8] zeroinitializer
@.str = [7 x i8] c"$1$%s$\00"
@str = [65 x i8] c"Invalid Salt, please use up to 16 random alphanumeric characters\00"
define i8* @make_md5_salt_para(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp slt i32 %4, 17
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @make_md5_salt_para.salt, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i8* getelementptr inbounds ([21 x i8], [21 x i8]* @make_md5_salt_para.salt, i64 0, i64 0)
8: ; preds = %3, %1
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
}