#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*/ sha256(char *, char *);
int /*<<< orphan*/ strcat(char *, char const *);
scalar_t__ strcmp(char *, char *);
int check_password(const char *password) {
  int auth = 0;
  char buff[20] = {0};
  char hash[65] = {0};
  buff[0] = 'T';
  buff[1] = 'h';
  buff[2] = 'i';
  buff[3] = 's';
  buff[4] = 'i';
  buff[5] = 's';
  buff[6] = 'a';
  buff[7] = 's';
  buff[8] = 'a';
  buff[9] = 'l';
  buff[10] = 't';
  buff[11] = '\0';
  strcat(buff, password);
  sha256(buff, hash);
  if (strcmp(
          hash,
          "58945afce4b671b31cd3b047a1c9b1df0bc7a976c67623b2bbf6da6b6028741c") ==
      0)
    auth = 1;
  return auth == 1;
}


x86 assembly (clang, -O0):
<check_password>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1030 <memset@plt>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x41,%edx
call   1030 <memset@plt>
movb   $0x54,-0x20(%rbp)
movb   $0x68,-0x1f(%rbp)
movb   $0x69,-0x1e(%rbp)
movb   $0x73,-0x1d(%rbp)
movb   $0x69,-0x1c(%rbp)
movb   $0x73,-0x1b(%rbp)
movb   $0x61,-0x1a(%rbp)
movb   $0x73,-0x19(%rbp)
movb   $0x61,-0x18(%rbp)
movb   $0x6c,-0x17(%rbp)
movb   $0x74,-0x16(%rbp)
movb   $0x0,-0x15(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x20(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1040 <sha256@plt>
lea    -0x70(%rbp),%rdi
lea    0xe38(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11de <check_password+0x9e>
movl   $0x1,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_password>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rdi,%rsi
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movb   $0x0,0x60(%rsp)
movabs $0x7361736973696854,%rax
73 61 73
mov    %rax,(%rsp)
movl   $0x746c61,0x8(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <strcat@plt>
lea    0x20(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <sha256@plt>
lea    0xe66(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [65 x i8] c"58945afce4b671b31cd3b047a1c9b1df0bc7a976c67623b2bbf6da6b6028741c\00"
define i32 @check_password(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [20 x i8]
%5 = alloca [65 x i8]
store i8* %0, i8** %2
store i32 0, i32* %3
%6 = bitcast [20 x i8]* %4 to i8*
%7 = bitcast [65 x i8]* %5 to i8*
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
store i8 84, i8* %8
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 1
store i8 104, i8* %9
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 2
store i8 105, i8* %10
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 3
store i8 115, i8* %11
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 4
store i8 105, i8* %12
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 5
store i8 115, i8* %13
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 6
store i8 97, i8* %14
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 7
store i8 115, i8* %15
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 8
store i8 97, i8* %16
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 9
store i8 108, i8* %17
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 10
store i8 116, i8* %18
%19 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 11
store i8 0, i8* %19
%20 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%21 = load i8*, i8** %2
%22 = call i32 @strcat(i8* %20, i8* %21)
%23 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%24 = getelementptr inbounds [65 x i8], [65 x i8]* %5, i64 0, i64 0
%25 = call i32 @sha256(i8* %23, i8* %24)
%26 = getelementptr inbounds [65 x i8], [65 x i8]* %5, i64 0, i64 0
%27 = call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %1
store i32 1, i32* %3
br label %30
30: ; preds = %29, %1
%31 = load i32, i32* %3
%32 = icmp eq i32 %31, 1
%33 = zext i1 %32 to i32
ret i32 %33
}

LLVM IR (-O2):
@.str = [65 x i8] c"58945afce4b671b31cd3b047a1c9b1df0bc7a976c67623b2bbf6da6b6028741c\00"
define i32 @check_password(i8* %0) {
%2 = alloca [20 x i8]
%3 = alloca [65 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [65 x i8], [65 x i8]* %3, i64 0, i64 0
store i8 84, i8* %4
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 1
store i8 104, i8* %6
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 2
store i8 105, i8* %7
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 3
store i8 115, i8* %8
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 4
store i8 105, i8* %9
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 5
store i8 115, i8* %10
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 6
store i8 97, i8* %11
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 7
store i8 115, i8* %12
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 8
store i8 97, i8* %13
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 9
store i8 108, i8* %14
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 10
store i8 116, i8* %15
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 11
store i8 0, i8* %16
%17 = call i32 @strcat(i8* %4, i8* %0)
%18 = call i32 @sha256(i8* %4, i8* %5)
%19 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
%21 = zext i1 %20 to i32
ret i32 %21
}