#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*/ free(char *);
char *get_password(char const *);
scalar_t__ strcmp(char *, char *);
char *get_password_if_match(const char *first_prompt,
                            const char *second_prompt) {
  char *password1, *password2;
  password1 = get_password(first_prompt);
  password2 = get_password(second_prompt);
  if (strcmp(password1, password2) == 0) {
    free(password2);
    return password1;
  }
  free(password1);
  free(password2);
  return NULL;
}


x86 assembly (clang, -O0):
<get_password_if_match>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <get_password@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <get_password@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1187 <get_password_if_match+0x57>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11a1 <get_password_if_match+0x71>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_password_if_match>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1050 <get_password@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1050 <get_password@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1164 <get_password_if_match+0x34>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @get_password_if_match(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = call i8* @get_password(i8* %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %5
%11 = call i8* @get_password(i8* %10)
store i8* %11, i8** %7
%12 = load i8*, i8** %6
%13 = load i8*, i8** %7
%14 = call i64 @strcmp(i8* %12, i8* %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %2
%17 = load i8*, i8** %7
%18 = call i32 @free(i8* %17)
%19 = load i8*, i8** %6
store i8* %19, i8** %3
br label %25
20: ; preds = %2
%21 = load i8*, i8** %6
%22 = call i32 @free(i8* %21)
%23 = load i8*, i8** %7
%24 = call i32 @free(i8* %23)
store i8* null, i8** %3
br label %25
25: ; preds = %20, %16
%26 = load i8*, i8** %3
ret i8* %26
}

LLVM IR (-O2):
define i8* @get_password_if_match(i8* %0, i8* %1) {
%3 = tail call i8* @get_password(i8* %0)
%4 = tail call i8* @get_password(i8* %1)
%5 = tail call i64 @strcmp(i8* %3, i8* %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call i32 @free(i8* %3)
br label %9
9: ; preds = %2, %7
%10 = phi i8* [ null, %7 ], [ %3, %2 ]
%11 = tail call i32 @free(i8* %4)
ret i8* %10
}