#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*/ checker(unsigned char *, unsigned char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
unsigned char *md5_key(unsigned char *, int /*<<< orphan*/, unsigned char *,
                       int /*<<< orphan*/);
unsigned char *md5_lock(unsigned char *, int /*<<< orphan*/, unsigned char *,
                        int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
unsigned char *sha_key(unsigned char *, int /*<<< orphan*/, unsigned char *,
                       int /*<<< orphan*/);
unsigned char *sha_lock(unsigned char *, int /*<<< orphan*/, unsigned char *,
                        int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(unsigned char *, char *, char *);
int /*<<< orphan*/ strlen(unsigned char *);
int main() {
  unsigned char cankey[256];
  unsigned char canlock[256];
  unsigned char *lkey, *llock;
  unsigned char secret[] = "fluffy";
  unsigned char message[] = "<lkr905851929.22670@meow.invalid>";
  unsigned char junk[32], junk2[32];
  printf("Secret %s\n", secret);
  printf("Message %s\n", message);
  llock = sha_lock(secret, strlen(secret), message, strlen(message));
  lkey = sha_key(secret, strlen(secret), message, strlen(message));
  printf("%s%s %s\n", "SHA Expect Lock/Key:\n",
         "L sha1:ScU1gyAi9bd/aFEOyzg4m99lwXs=",
         "K sha1:C1Me/4n0l/V778Ih3J2UnhAoHrA=");
  checker(lkey, llock);
  printf("---\n");
  llock = md5_lock(secret, strlen(secret), message, strlen(message));
  lkey = md5_key(secret, strlen(secret), message, strlen(message));
  printf("%s%s %s\n", "MD5 Expect Lock/Key:\n",
         "L md5:equ7DQVveXcZpqwCiMflmQ==", "K md5:ByhbX+72NZC1xZdiPBNTOQ==");
  checker(lkey, llock);
  printf("---\n");
  printf("Testing against usefor cancel lock draft 01 samples...\n");
  sprintf(canlock, "%s", "sha1:bNXHc6ohSmeHaRHHW56BIWZJt+4=");
  sprintf(cankey, "%s", "sha1:aaaBBBcccDDDeeeFFF");
  checker(cankey, canlock);
  printf("---above should have been ok---\n");
  sprintf(canlock, "%s", "SHA1:H7/zsCUemvbvSDyARDaMs6AQu5s=");
  sprintf(cankey, "%s", "sha1:chW8hNeDx3iNUsGBU6/ezDk88P4=");
  checker(cankey, canlock);
  sprintf(canlock, "%s", "SHA1:H7/zsCUemvbvSDyARDaMs6AQu5s=");
  sprintf(cankey, "%s", "sha1:4srkWaRIzvK51ArAP:Hc");
  checker(cankey, canlock);
  printf("---above should have been okay, no---\n");
  sprintf(canlock, "%s", "sha1:JyEBL4w9/abCBuzCxMIE/E73GM4=");
  sprintf(cankey, "%s", "sha1:K4rkWRjRcXmIzvK51ArAP:Jy");
  checker(cankey, canlock);
  sprintf(canlock, "%s", "sha1:2Bmg+zWaY1noRiCdy8k3IapwSDU=");
  sprintf(cankey, "%s", "sha1:K4rkWRjRcXmIzvK51ArAP:Jy");
  checker(cankey, canlock);
  printf("---above should have been okay, no---\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2f0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe48(%rip),%eax
mov    %eax,-0x227(%rbp)
mov    0xe3f(%rip),%ax
mov    %ax,-0x223(%rbp)
mov    0xe34(%rip),%al
mov    %al,-0x221(%rbp)
lea    -0x250(%rbp),%rdi
lea    0x107a(%rip),%rsi
mov    $0x22,%edx
call   1050 <memcpy@plt>
lea    -0x227(%rbp),%rsi
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x250(%rbp),%rsi
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x227(%rbp),%rax
mov    %rax,-0x2f0(%rbp)
lea    -0x227(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x2e4(%rbp)
lea    -0x250(%rbp),%rax
mov    %rax,-0x2e0(%rbp)
lea    -0x250(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x2f0(%rbp),%rdi
mov    -0x2e4(%rbp),%esi
mov    -0x2e0(%rbp),%rdx
mov    %eax,%ecx
call   1090 <sha_lock@plt>
mov    %rax,-0x220(%rbp)
lea    -0x227(%rbp),%rax
mov    %rax,-0x2d8(%rbp)
lea    -0x227(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x2cc(%rbp)
lea    -0x250(%rbp),%rax
mov    %rax,-0x2c8(%rbp)
lea    -0x250(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x2d8(%rbp),%rdi
mov    -0x2cc(%rbp),%esi
mov    -0x2c8(%rbp),%rdx
mov    %eax,%ecx
call   10c0 <sha_key@plt>
mov    %rax,-0x218(%rbp)
lea    0xd45(%rip),%rdi
lea    0xd47(%rip),%rsi
lea    0xd56(%rip),%rdx
lea    0xd73(%rip),%rcx
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x218(%rbp),%rdi
mov    -0x220(%rbp),%rsi
call   1070 <checker@plt>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x227(%rbp),%rax
mov    %rax,-0x2c0(%rbp)
lea    -0x227(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x2b4(%rbp)
lea    -0x250(%rbp),%rax
mov    %rax,-0x2b0(%rbp)
lea    -0x250(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x2c0(%rbp),%rdi
mov    -0x2b4(%rbp),%esi
mov    -0x2b0(%rbp),%rdx
mov    %eax,%ecx
call   1080 <md5_lock@plt>
mov    %rax,-0x220(%rbp)
lea    -0x227(%rbp),%rax
mov    %rax,-0x2a8(%rbp)
lea    -0x227(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x29c(%rbp)
lea    -0x250(%rbp),%rax
mov    %rax,-0x298(%rbp)
lea    -0x250(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x2a8(%rbp),%rdi
mov    -0x29c(%rbp),%esi
mov    -0x298(%rbp),%rdx
mov    %eax,%ecx
call   1060 <md5_key@plt>
mov    %rax,-0x218(%rbp)
lea    0xc49(%rip),%rdi
lea    0xca9(%rip),%rsi
lea    0xcb8(%rip),%rdx
lea    0xcd0(%rip),%rcx
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x218(%rbp),%rdi
mov    -0x220(%rbp),%rsi
call   1070 <checker@plt>
lea    0xd5f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xcc0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x210(%rbp),%rdi
lea    0xce3(%rip),%rsi
lea    0xcdf(%rip),%rdx
call   10a0 <sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    0xcc9(%rip),%rsi
lea    0xce7(%rip),%rdx
call   10a0 <sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1070 <checker@plt>
lea    0xce0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x210(%rbp),%rdi
lea    0xc8e(%rip),%rsi
lea    0xce5(%rip),%rdx
call   10a0 <sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    0xc74(%rip),%rsi
lea    0xced(%rip),%rdx
call   10a0 <sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1070 <checker@plt>
lea    -0x210(%rbp),%rdi
lea    0xc47(%rip),%rsi
lea    0xc9e(%rip),%rdx
call   10a0 <sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    0xc2d(%rip),%rsi
lea    0xcc8(%rip),%rdx
call   10a0 <sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1070 <checker@plt>
lea    0xcc3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x210(%rbp),%rdi
lea    0xbf2(%rip),%rsi
lea    0xcce(%rip),%rdx
call   10a0 <sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    0xbd8(%rip),%rsi
lea    0xcd6(%rip),%rdx
call   10a0 <sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1070 <checker@plt>
lea    -0x210(%rbp),%rdi
lea    0xbab(%rip),%rsi
lea    0xcc7(%rip),%rdx
call   10a0 <sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    0xb91(%rip),%rsi
lea    0xc8f(%rip),%rdx
call   10a0 <sprintf@plt>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1070 <checker@plt>
lea    0xc27(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x248,%rsp
movl   $0x796666,0xb(%rsp)
movl   $0x66756c66,0x8(%rsp)
66
movaps 0x10a8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0x108c(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movw   $0x3e,0x30(%rsp)
lea    0xe30(%rip),%rdi
lea    0x8(%rsp),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe25(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1090 <sha_lock@plt>
mov    %rax,%r12
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
call   10b0 <sha_key@plt>
mov    %rax,%rbp
lea    0xdd3(%rip),%r15
lea    0xdd5(%rip),%rsi
lea    0xde4(%rip),%rdx
lea    0xe01(%rip),%rcx
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
call   1070 <checker@plt>
lea    0xfaa(%rip),%r12
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1080 <md5_lock@plt>
mov    %rax,%r13
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1060 <md5_key@plt>
mov    %rax,%rbx
lea    0xdb2(%rip),%rsi
lea    0xdc1(%rip),%rdx
lea    0xdd9(%rip),%rcx
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1070 <checker@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
movups 0xdc8(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movups 0xdcc(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movw   $0x3d,0x60(%rsp)
movabs $0x46464665656544,%rax
mov    %rax,0x150(%rsp)
movups 0xdb9(%rip),%xmm0
movaps %xmm0,0x140(%rsp)
lea    0x140(%rsp),%rbx
lea    0x40(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <checker@plt>
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
movups 0xd9e(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movups 0xda2(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movw   $0x3d,0x60(%rsp)
movups 0xda1(%rip),%xmm0
movaps %xmm0,0x140(%rsp)
movups 0xda2(%rip),%xmm0
movaps %xmm0,0x150(%rsp)
movw   $0x3d,0x160(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <checker@plt>
movups 0xd4c(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movups 0xd50(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movw   $0x3d,0x60(%rsp)
movups 0xd71(%rip),%xmm0
movaps %xmm0,0x140(%rsp)
movups 0xd6c(%rip),%xmm0
movups %xmm0,0x14a(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <checker@plt>
lea    0xe1b(%rip),%r15
mov    %r15,%rdi
call   1030 <puts@plt>
movups 0xd53(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movups 0xd57(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movw   $0x3d,0x60(%rsp)
movups 0xd56(%rip),%xmm0
movaps %xmm0,0x140(%rsp)
movups 0xd55(%rip),%xmm0
movups %xmm0,0x14e(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <checker@plt>
movups 0xd4b(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movups 0xd4f(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movw   $0x3d,0x60(%rsp)
movups 0xd0e(%rip),%xmm0
movaps %xmm0,0x140(%rsp)
movups 0xd0d(%rip),%xmm0
movups %xmm0,0x14e(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <checker@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@__const.main.secret = [7 x i8] c"fluffy\00"
@__const.main.message = [34 x i8] c"<lkr905851929.22670@meow.invalid>\00"
@.str = [11 x i8] c"Secret %s\0A\00"
@.str.1 = [12 x i8] c"Message %s\0A\00"
@.str.2 = [9 x i8] c"%s%s %s\0A\00"
@.str.3 = [22 x i8] c"SHA Expect Lock/Key:\0A\00"
@.str.4 = [36 x i8] c"L sha1:ScU1gyAi9bd/aFEOyzg4m99lwXs=\00"
@.str.5 = [36 x i8] c"K sha1:C1Me/4n0l/V778Ih3J2UnhAoHrA=\00"
@.str.6 = [5 x i8] c"---\0A\00"
@.str.7 = [22 x i8] c"MD5 Expect Lock/Key:\0A\00"
@.str.8 = [31 x i8] c"L md5:equ7DQVveXcZpqwCiMflmQ==\00"
@.str.9 = [31 x i8] c"K md5:ByhbX+72NZC1xZdiPBNTOQ==\00"
@.str.10 = [56 x i8] c"Testing against usefor cancel lock draft 01 samples...\0A\00"
@.str.11 = [3 x i8] c"%s\00"
@.str.12 = [34 x i8] c"sha1:bNXHc6ohSmeHaRHHW56BIWZJt+4=\00"
@.str.13 = [24 x i8] c"sha1:aaaBBBcccDDDeeeFFF\00"
@.str.14 = [33 x i8] c"---above should have been ok---\0A\00"
@.str.15 = [34 x i8] c"SHA1:H7/zsCUemvbvSDyARDaMs6AQu5s=\00"
@.str.16 = [34 x i8] c"sha1:chW8hNeDx3iNUsGBU6/ezDk88P4=\00"
@.str.17 = [26 x i8] c"sha1:4srkWaRIzvK51ArAP:Hc\00"
@.str.18 = [39 x i8] c"---above should have been okay, no---\0A\00"
@.str.19 = [34 x i8] c"sha1:JyEBL4w9/abCBuzCxMIE/E73GM4=\00"
@.str.20 = [30 x i8] c"sha1:K4rkWRjRcXmIzvK51ArAP:Jy\00"
@.str.21 = [34 x i8] c"sha1:2Bmg+zWaY1noRiCdy8k3IapwSDU=\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca [256 x i8]
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [7 x i8]
%7 = alloca [34 x i8]
%8 = alloca [32 x i8]
%9 = alloca [32 x i8]
store i32 0, i32* %1
%10 = bitcast [7 x i8]* %6 to i8*
%11 = bitcast [34 x i8]* %7 to i8*
%12 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%17 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%18 = call i32 @strlen(i8* %17)
%19 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 0
%20 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 0
%21 = call i32 @strlen(i8* %20)
%22 = call i8* @sha_lock(i8* %16, i32 %18, i8* %19, i32 %21)
store i8* %22, i8** %5
%23 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%24 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%25 = call i32 @strlen(i8* %24)
%26 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 0
%27 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 0
%28 = call i32 @strlen(i8* %27)
%29 = call i8* @sha_key(i8* %23, i32 %25, i8* %26, i32 %28)
store i8* %29, i8** %4
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
%31 = load i8*, i8** %4
%32 = load i8*, i8** %5
%33 = call i32 @checker(i8* %31, i8* %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%35 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%36 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%37 = call i32 @strlen(i8* %36)
%38 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 0
%39 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 0
%40 = call i32 @strlen(i8* %39)
%41 = call i8* @md5_lock(i8* %35, i32 %37, i8* %38, i32 %40)
store i8* %41, i8** %5
%42 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%43 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%44 = call i32 @strlen(i8* %43)
%45 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 0
%46 = getelementptr inbounds [34 x i8], [34 x i8]* %7, i64 0, i64 0
%47 = call i32 @strlen(i8* %46)
%48 = call i8* @md5_key(i8* %42, i32 %44, i8* %45, i32 %47)
store i8* %48, i8** %4
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0))
%50 = load i8*, i8** %4
%51 = load i8*, i8** %5
%52 = call i32 @checker(i8* %50, i8* %51)
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.10, i64 0, i64 0))
%55 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%56 = call i32 @sprintf(i8* %55, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0))
%57 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%58 = call i32 @sprintf(i8* %57, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0))
%59 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%60 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%61 = call i32 @checker(i8* %59, i8* %60)
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.14, i64 0, i64 0))
%63 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%64 = call i32 @sprintf(i8* %63, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.15, i64 0, i64 0))
%65 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%66 = call i32 @sprintf(i8* %65, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.16, i64 0, i64 0))
%67 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%68 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%69 = call i32 @checker(i8* %67, i8* %68)
%70 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%71 = call i32 @sprintf(i8* %70, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.15, i64 0, i64 0))
%72 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%73 = call i32 @sprintf(i8* %72, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.17, i64 0, i64 0))
%74 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%75 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%76 = call i32 @checker(i8* %74, i8* %75)
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.18, i64 0, i64 0))
%78 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%79 = call i32 @sprintf(i8* %78, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.19, i64 0, i64 0))
%80 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%81 = call i32 @sprintf(i8* %80, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.20, i64 0, i64 0))
%82 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%83 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%84 = call i32 @checker(i8* %82, i8* %83)
%85 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%86 = call i32 @sprintf(i8* %85, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.21, i64 0, i64 0))
%87 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%88 = call i32 @sprintf(i8* %87, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.20, i64 0, i64 0))
%89 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%90 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%91 = call i32 @checker(i8* %89, i8* %90)
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.18, i64 0, i64 0))
%93 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@__const.main.secret = [7 x i8] c"fluffy\00"
@__const.main.message = [34 x i8] c"<lkr905851929.22670@meow.invalid>\00"
@.str = [11 x i8] c"Secret %s\0A\00"
@.str.1 = [12 x i8] c"Message %s\0A\00"
@.str.2 = [9 x i8] c"%s%s %s\0A\00"
@.str.3 = [22 x i8] c"SHA Expect Lock/Key:\0A\00"
@.str.4 = [36 x i8] c"L sha1:ScU1gyAi9bd/aFEOyzg4m99lwXs=\00"
@.str.5 = [36 x i8] c"K sha1:C1Me/4n0l/V778Ih3J2UnhAoHrA=\00"
@.str.7 = [22 x i8] c"MD5 Expect Lock/Key:\0A\00"
@.str.8 = [31 x i8] c"L md5:equ7DQVveXcZpqwCiMflmQ==\00"
@.str.9 = [31 x i8] c"K md5:ByhbX+72NZC1xZdiPBNTOQ==\00"
@.str.12 = [34 x i8] c"sha1:bNXHc6ohSmeHaRHHW56BIWZJt+4=\00"
@.str.13 = [24 x i8] c"sha1:aaaBBBcccDDDeeeFFF\00"
@.str.15 = [34 x i8] c"SHA1:H7/zsCUemvbvSDyARDaMs6AQu5s=\00"
@.str.16 = [34 x i8] c"sha1:chW8hNeDx3iNUsGBU6/ezDk88P4=\00"
@.str.17 = [26 x i8] c"sha1:4srkWaRIzvK51ArAP:Hc\00"
@.str.19 = [34 x i8] c"sha1:JyEBL4w9/abCBuzCxMIE/E73GM4=\00"
@.str.20 = [30 x i8] c"sha1:K4rkWRjRcXmIzvK51ArAP:Jy\00"
@.str.21 = [34 x i8] c"sha1:2Bmg+zWaY1noRiCdy8k3IapwSDU=\00"
@str.22 = [4 x i8] c"---\00"
@str.23 = [55 x i8] c"Testing against usefor cancel lock draft 01 samples...\00"
@str.24 = [32 x i8] c"---above should have been ok---\00"
@str.26 = [38 x i8] c"---above should have been okay, no---\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = alloca [256 x i8]
%3 = alloca [7 x i8]
%4 = alloca [34 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [34 x i8], [34 x i8]* %4, i64 0, i64 0
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %7)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%11 = call i32 @strlen(i8* %7)
%12 = call i32 @strlen(i8* %8)
%13 = call i8* @sha_lock(i8* %7, i32 %11, i8* %8, i32 %12)
%14 = call i32 @strlen(i8* %7)
%15 = call i32 @strlen(i8* %8)
%16 = call i8* @sha_key(i8* %7, i32 %14, i8* %8, i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
%18 = call i32 @checker(i8* %16, i8* %13)
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.22, i64 0, i64 0))
%20 = call i32 @strlen(i8* %7)
%21 = call i32 @strlen(i8* %8)
%22 = call i8* @md5_lock(i8* %7, i32 %20, i8* %8, i32 %21)
%23 = call i32 @strlen(i8* %7)
%24 = call i32 @strlen(i8* %8)
%25 = call i8* @md5_key(i8* %7, i32 %23, i8* %8, i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0))
%27 = call i32 @checker(i8* %25, i8* %22)
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.22, i64 0, i64 0))
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.23, i64 0, i64 0))
%30 = call i32 @checker(i8* %5, i8* %6)
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.24, i64 0, i64 0))
%32 = call i32 @checker(i8* %5, i8* %6)
%33 = call i32 @checker(i8* %5, i8* %6)
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.26, i64 0, i64 0))
%35 = call i32 @checker(i8* %5, i8* %6)
%36 = call i32 @checker(i8* %5, i8* %6)
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.26, i64 0, i64 0))
%38 = call i32 @exit(i32 0)
unreachable
}