#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 */
unsigned int crc32(int /*<<< orphan*/, void const *, int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strlen(char *);
unsigned int generateSeed(char *password) {
  unsigned int crc = 0;
  char pwd[100];
  if (NULL == password) {
    printf("Please insert password %d-%d characters: ", 8, 100);
    fgets(pwd, 100, stdin);
    ;
    ;
    crc = crc32(0, (const void *)&pwd, strlen(pwd));
    ;
    ;
  } else {
    ;
    ;
    crc = crc32(0, (const void *)password, strlen(password));
    ;
    ;
  }
  return crc;
}


x86 assembly (clang, -O0):
<generateSeed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
jne    11b5 <generateSeed+0x75>
lea    0xe97(%rip),%rdi
mov    $0x8,%esi
mov    $0x64,%edx
call   1050 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    0x2e65(%rip),%rax
mov    (%rax),%edx
mov    $0x64,%esi
call   1060 <fgets@plt>
lea    -0x70(%rbp),%rax
mov    %rax,-0x78(%rbp)
lea    -0x70(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x78(%rbp),%rsi
mov    %eax,%edx
xor    %edi,%edi
call   1030 <crc32@plt>
mov    %eax,-0xc(%rbp)
jmp    11d6 <generateSeed+0x96>
mov    -0x8(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x80(%rbp),%rsi
mov    %eax,%edx
xor    %edi,%edi
call   1030 <crc32@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generateSeed>:
push   %rbx
sub    $0x70,%rsp
test   %rdi,%rdi
je     1163 <generateSeed+0x23>
mov    %rdi,%rbx
call   1040 <strlen@plt>
xor    %edi,%edi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x70,%rsp
pop    %rbx
jmp    1030 <crc32@plt>
lea    0xe96(%rip),%rdi
mov    $0x8,%esi
mov    $0x64,%edx
call   1050 <printf@plt>
mov    0x2e68(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1060 <fgets@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
xor    %edi,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <crc32@plt>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Please insert password %d-%d characters: \00"
@stdin = global i32 0
define i32 @generateSeed(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [100 x i8]
store i8* %0, i8** %2
store i32 0, i32* %3
%5 = load i8*, i8** %2
%6 = icmp eq i8* null, %5
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 8, i32 100)
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %9, i32 100, i32 %10)
%12 = bitcast [100 x i8]* %4 to i8*
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
%15 = call i32 @crc32(i32 0, i8* %12, i32 %14)
store i32 %15, i32* %3
br label %21
16: ; preds = %1
%17 = load i8*, i8** %2
%18 = load i8*, i8** %2
%19 = call i32 @strlen(i8* %18)
%20 = call i32 @crc32(i32 0, i8* %17, i32 %19)
store i32 %20, i32* %3
br label %21
21: ; preds = %16, %7
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@.str = [42 x i8] c"Please insert password %d-%d characters: \00"
@stdin = global i32 0
define i32 @generateSeed(i8* %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = icmp eq i8* %0, null
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 8, i32 100)
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %3, i32 100, i32 %7)
%9 = call i32 @strlen(i8* %3)
%10 = call i32 @crc32(i32 0, i8* %3, i32 %9)
br label %14
11: ; preds = %1
%12 = tail call i32 @strlen(i8* %0)
%13 = tail call i32 @crc32(i32 0, i8* %0, i32 %12)
br label %14
14: ; preds = %11, %5
%15 = phi i32 [ %10, %5 ], [ %13, %11 ]
ret i32 %15
}