#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_DIGEST_LENGTH;
size_t hash_until(unsigned char *, unsigned char *, size_t);
int /*<<< orphan*/ print_bytes(unsigned char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
size_t verify_pair(unsigned char *private, unsigned char *public, size_t iter) {
  printf("Verifying: (public)\n\t");
  print_bytes(public, SHA256_DIGEST_LENGTH);
  printf("With: (private)\n\t");
  print_bytes(private, SHA256_DIGEST_LENGTH);
  if (!iter)
    iter = 1;
  return hash_until(private, public, iter);
}


x86 assembly (clang, -O0):
<verify_pair>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    0x2e85(%rip),%rax
mov    (%rax),%esi
call   1050 <print_bytes@plt>
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e67(%rip),%rax
mov    (%rax),%esi
call   1050 <print_bytes@plt>
cmpq   $0x0,-0x18(%rbp)
jne    1193 <verify_pair+0x63>
movq   $0x1,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <hash_until@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_pair>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e8c(%rip),%r12
mov    (%r12),%esi
mov    %r14,%rdi
call   1050 <print_bytes@plt>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
mov    (%r12),%esi
mov    %rbx,%rdi
call   1050 <print_bytes@plt>
test   %r15,%r15
mov    $0x1,%edx
cmovne %r15,%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <hash_until@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Verifying: (public)\0A\09\00"
@SHA256_DIGEST_LENGTH = global i32 0
@.str.1 = [18 x i8] c"With: (private)\0A\09\00"
define i64 @verify_pair(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %5
%9 = load i32, i32* @SHA256_DIGEST_LENGTH
%10 = call i32 @print_bytes(i8* %8, i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%12 = load i8*, i8** %4
%13 = load i32, i32* @SHA256_DIGEST_LENGTH
%14 = call i32 @print_bytes(i8* %12, i32 %13)
%15 = load i64, i64* %6
%16 = icmp ne i64 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %3
store i64 1, i64* %6
br label %18
18: ; preds = %17, %3
%19 = load i8*, i8** %4
%20 = load i8*, i8** %5
%21 = load i64, i64* %6
%22 = call i64 @hash_until(i8* %19, i8* %20, i64 %21)
ret i64 %22
}

LLVM IR (-O2):
@.str = [22 x i8] c"Verifying: (public)\0A\09\00"
@SHA256_DIGEST_LENGTH = global i32 0
@.str.1 = [18 x i8] c"With: (private)\0A\09\00"
define i64 @verify_pair(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @SHA256_DIGEST_LENGTH
%6 = tail call i32 @print_bytes(i8* %1, i32 %5)
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* @SHA256_DIGEST_LENGTH
%9 = tail call i32 @print_bytes(i8* %0, i32 %8)
%10 = icmp eq i64 %2, 0
%11 = select i1 %10, i64 1, i64 %2
%12 = tail call i64 @hash_until(i8* %0, i8* %1, i64 %11)
ret i64 %12
}