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


x86 assembly (clang, -O0):
<make_md5_salt_para>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0x2efd(%rip),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1195 <make_md5_salt_para+0x55>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x10,%eax
jg     1195 <make_md5_salt_para+0x55>
mov    -0x8(%rbp),%rdx
lea    0x2ed1(%rip),%rdi
lea    0xe7a(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret
lea    0xe6b(%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*
%3 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @make_md5_salt_para.salt, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @strlen(i8* %7)
%9 = icmp sle i32 %8, 16
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i8*, i8** %2
%12 = 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* %11)
%13 = load i8*, i8** %3
ret i8* %13
14: ; preds = %6, %1
%15 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0))
%16 = 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
}