int main(int argc, char **argv) {
  char *enc;
  char *password;
  if (argc < 2) {
    printf("error : wrong arguments\n");
    return 1;
  }
  password = argv[1];
  enc = generate_password(6, password);
  printf("SHA-512 - %ld Encrypted \n %s\n", strlen(enc), enc);
  enc = generate_password(5, password);
  printf("SHA-256 - %ld Encrypted \n %s\n", strlen(enc), enc);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    116a <main+0x3a>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11e5 <main+0xb5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
mov    $0x6,%edi
mov    $0x0,%al
call   1050 <generate_password@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rsi
mov    -0x18(%rbp),%rdx
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rsi
mov    $0x5,%edi
mov    $0x0,%al
call   1050 <generate_password@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rsi
mov    -0x18(%rbp),%rdx
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x1,%edi
jg     115d <main+0x1d>
lea    0xeec(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%r14d
jmp    11c0 <main+0x80>
mov    0x8(%rsi),%rbx
xor    %r14d,%r14d
mov    $0x6,%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <generate_password@plt>
movslq %eax,%rbp
mov    %rbp,%rdi
call   1040 <strlen@plt>
lea    0xe7b(%rip),%rdi
mov    %rax,%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x5,%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <generate_password@plt>
movslq %eax,%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0xe6b(%rip),%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"error : wrong arguments\0A\00"
@.str.1 = [30 x i8] c"SHA-512 - %ld Encrypted \0A %s\0A\00"
@.str.2 = [30 x i8] c"SHA-256 - %ld Encrypted \0A %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %32
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
store i8* %15, i8** %7
%16 = load i8*, i8** %7
%17 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @generate_password to i32 (i32, i8*, ...)*)(i32 6, i8* %16)
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i8*
store i8* %19, i8** %6
%20 = load i8*, i8** %6
%21 = call i64 @strlen(i8* %20)
%22 = load i8*, i8** %6
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i64 %21, i8* %22)
%24 = load i8*, i8** %7
%25 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @generate_password to i32 (i32, i8*, ...)*)(i32 5, i8* %24)
%26 = sext i32 %25 to i64
%27 = inttoptr i64 %26 to i8*
store i8* %27, i8** %6
%28 = load i8*, i8** %6
%29 = call i64 @strlen(i8* %28)
%30 = load i8*, i8** %6
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i64 %29, i8* %30)
store i32 0, i32* %3
br label %32
32: ; preds = %12, %10
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@.str.1 = [30 x i8] c"SHA-512 - %ld Encrypted \0A %s\0A\00"
@.str.2 = [30 x i8] c"SHA-256 - %ld Encrypted \0A %s\0A\00"
@str = [24 x i8] c"error : wrong arguments\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
br label %19
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @generate_password to i32 (i32, i8*, ...)*)(i32 6, i8* %8)
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i8*
%12 = tail call i64 @strlen(i8* dereferenceable(1) %11)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i64 %12, i8* %11)
%14 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @generate_password to i32 (i32, i8*, ...)*)(i32 5, i8* %8)
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i8*
%17 = tail call i64 @strlen(i8* dereferenceable(1) %16)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i64 %17, i8* %16)
br label %19
19: ; preds = %6, %4
%20 = phi i32 [ 1, %4 ], [ 0, %6 ]
ret i32 %20
}