#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 */
typedef int /*<<< orphan*/ salt;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
int strlen(char const *);
char *make_sha512_salt_para(const char *saltpara) {
  static char salt[21];
  if (saltpara && (strlen(saltpara) <= 16)) {
    snprintf(salt, sizeof(salt), "$6$%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_sha512_salt_para>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1192 <make_sha512_salt_para+0x52>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x10,%eax
jg     1192 <make_sha512_salt_para+0x52>
mov    -0x8(%rbp),%rcx
lea    0x2edc(%rip),%rdi
mov    $0x15,%esi
lea    0xe80(%rip),%rdx
call   1050 <snprintf@plt>
lea    0x2ec4(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret
lea    0xe6e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<make_sha512_salt_para>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     117f <make_sha512_salt_para+0x3f>
mov    %rdi,%rbx
call   1040 <strlen@plt>
cmp    $0x10,%eax
jg     117f <make_sha512_salt_para+0x3f>
lea    0x2ef3(%rip),%r14
lea    0xe9c(%rip),%rdx
mov    %r14,%rdi
mov    $0x15,%esi
mov    %rbx,%rcx
call   1050 <snprintf@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@make_sha512_salt_para.salt = internal global [21 x i8] zeroinitializer
@.str = [7 x i8] c"$6$%s$\00"
@.str.1 = [66 x i8] c"Invalid Salt, please use up to 16 random alphanumeric characters\0A\00"
define i8* @make_sha512_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 @snprintf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @make_sha512_salt_para.salt, i64 0, i64 0), i32 21, 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_sha512_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_sha512_salt_para.salt = internal global [21 x i8] zeroinitializer
@.str = [7 x i8] c"$6$%s$\00"
@str = [65 x i8] c"Invalid Salt, please use up to 16 random alphanumeric characters\00"
define i8* @make_sha512_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 @snprintf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @make_sha512_salt_para.salt, i64 0, i64 0), i32 21, i8* 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_sha512_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
}