#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 */
scalar_t__ generatePassword(char *);
int /*<<< orphan*/ strcmp(char const *, char *);
int /*<<< orphan*/ strcpy(char *, char const *);
int createPassword(const char *input, char *password) {
  char gPass[16 + 1] = "";
  if (!strcmp(input, "")) {
    if (generatePassword(gPass)) {
      strcpy(password, gPass);
    } else {
      return 0;
    }
  } else {
    strcpy(password, input);
  }
  return 1;
}


x86 assembly (clang, -O0):
<createPassword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x11,%edx
call   1040 <memset@plt>
mov    -0x10(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11af <createPassword+0x6f>
lea    -0x30(%rbp),%rdi
call   1060 <generatePassword@plt>
cmp    $0x0,%rax
je     119e <createPassword+0x5e>
mov    -0x18(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    11aa <createPassword+0x6a>
movl   $0x0,-0x4(%rbp)
jmp    11c3 <createPassword+0x83>
jmp    11bc <createPassword+0x7c>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createPassword>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x10(%rsp)
cmpb   $0x0,(%rdi)
je     113e <createPassword+0x1e>
mov    %rdi,%rsi
jmp    114e <createPassword+0x2e>
mov    %rsp,%rdi
call   1040 <generatePassword@plt>
test   %rax,%rax
je     1161 <createPassword+0x41>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbx
ret
xor    %eax,%eax
jmp    115b <createPassword+0x3b>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @createPassword(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [17 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = bitcast [17 x i8]* %6 to i8*
%8 = load i8*, i8** %4
%9 = call i32 @strcmp(i8* %8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%10 = icmp ne i32 %9, 0
br i1 %10, label %21, label %11
11: ; preds = %2
%12 = getelementptr inbounds [17 x i8], [17 x i8]* %6, i64 0, i64 0
%13 = call i64 @generatePassword(i8* %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load i8*, i8** %5
%17 = getelementptr inbounds [17 x i8], [17 x i8]* %6, i64 0, i64 0
%18 = call i32 @strcpy(i8* %16, i8* %17)
br label %20
19: ; preds = %11
store i32 0, i32* %3
br label %26
20: ; preds = %15
br label %25
21: ; preds = %2
%22 = load i8*, i8** %5
%23 = load i8*, i8** %4
%24 = call i32 @strcpy(i8* %22, i8* %23)
br label %25
25: ; preds = %21, %20
store i32 1, i32* %3
br label %26
26: ; preds = %25, %19
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @createPassword(i8* %0, i8* %1) {
%3 = alloca [17 x i8]
%4 = getelementptr inbounds [17 x i8], [17 x i8]* %3, i64 0, i64 0
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = call i64 @generatePassword(i8* %4)
%9 = icmp eq i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = call i32 @strcpy(i8* %1, i8* %4)
br label %14
12: ; preds = %2
%13 = tail call i32 @strcpy(i8* %1, i8* %0)
br label %14
14: ; preds = %10, %12, %7
%15 = phi i32 [ 0, %7 ], [ 1, %12 ], [ 1, %10 ]
ret i32 %15
}