#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) {
  char buff[65] = {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] = 's';
  buff[7] = 'a';
  buff[8] = 'l';
  buff[9] = 't';
  buff[10] = '\0';
  strcat(buff, password);
  sha256(buff, hash);
  return strcmp(hash, "58945afce4b671b31cd3b047a1c9b1df0bc7a976c67623b2bbf6da6b"
                      "6028741c") == 0;
}


x86 assembly (clang, -O0):
<check_password>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x41,%edx
call   1030 <memset@plt>
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x41,%edx
call   1030 <memset@plt>
movb   $0x54,-0x50(%rbp)
movb   $0x68,-0x4f(%rbp)
movb   $0x69,-0x4e(%rbp)
movb   $0x73,-0x4d(%rbp)
movb   $0x69,-0x4c(%rbp)
movb   $0x73,-0x4b(%rbp)
movb   $0x73,-0x4a(%rbp)
movb   $0x61,-0x49(%rbp)
movb   $0x6c,-0x48(%rbp)
movb   $0x74,-0x47(%rbp)
movb   $0x0,-0x46(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x50(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   1040 <sha256@plt>
lea    -0xa0(%rbp),%rdi
lea    0xe37(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_password>:
push   %r14
push   %rbx
sub    $0x98,%rsp
mov    %rdi,%rsi
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movb   $0x0,0x40(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movb   $0x0,0x90(%rsp)
movabs $0x6173736973696854,%rax
73 73 61
mov    %rax,(%rsp)
movw   $0x746c,0x8(%rsp)
movb   $0x0,0xa(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <strcat@plt>
lea    0x50(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <sha256@plt>
lea    0xe4d(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x98,%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 [65 x i8]
%4 = alloca [65 x i8]
store i8* %0, i8** %2
%5 = bitcast [65 x i8]* %3 to i8*
%6 = bitcast [65 x i8]* %4 to i8*
%7 = getelementptr inbounds [65 x i8], [65 x i8]* %3, i64 0, i64 0
store i8 84, i8* %7
%8 = getelementptr inbounds [65 x i8], [65 x i8]* %3, i64 0, i64 1
store i8 104, i8* %8
%9 = getelementptr inbounds [65 x i8], [65 x i8]* %3, i64 0, i64 2
store i8 105, i8* %9
%10 = getelementptr inbounds [65 x i8], [65 x i8]* %3, i64 0, i64 3
store i8 115, i8* %10
%11 = getelementptr inbounds [65 x i8], [65 x i8]* %3, i64 0, i64 4
store i8 105, i8* %11
%12 = getelementptr inbounds [65 x i8], [65 x i8]* %3, i64 0, i64 5
store i8 115, i8* %12
%13 = getelementptr inbounds [65 x i8], [65 x i8]* %3, i64 0, i64 6
store i8 115, i8* %13
%14 = getelementptr inbounds [65 x i8], [65 x i8]* %3, i64 0, i64 7
store i8 97, i8* %14
%15 = getelementptr inbounds [65 x i8], [65 x i8]* %3, i64 0, i64 8
store i8 108, i8* %15
%16 = getelementptr inbounds [65 x i8], [65 x i8]* %3, i64 0, i64 9
store i8 116, i8* %16
%17 = getelementptr inbounds [65 x i8], [65 x i8]* %3, i64 0, i64 10
store i8 0, i8* %17
%18 = getelementptr inbounds [65 x i8], [65 x i8]* %3, i64 0, i64 0
%19 = load i8*, i8** %2
%20 = call i32 @strcat(i8* %18, i8* %19)
%21 = getelementptr inbounds [65 x i8], [65 x i8]* %3, i64 0, i64 0
%22 = getelementptr inbounds [65 x i8], [65 x i8]* %4, i64 0, i64 0
%23 = call i32 @sha256(i8* %21, i8* %22)
%24 = getelementptr inbounds [65 x i8], [65 x i8]* %4, i64 0, i64 0
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
%27 = zext i1 %26 to i32
ret i32 %27
}

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