#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*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ run_crypt_test(unsigned char *, int, int);
int /*<<< orphan*/ stdout;
int rtv_crypt_test(void) {
  unsigned char cyphertext1[] = {
      0x7d, 0xd9, 0xc3, 0x54, 0xec, 0x01, 0x14, 0x73, 0x10, 0x3f, 0x0a,
      0xc5, 0x99, 0x35, 0x12, 0x1e, 0x08, 0xaf, 0xd5, 0xc7, 0x1a, 0xb3,
      0xfe, 0x80, 0xa7, 0x53, 0x72, 0x0d, 0xc9, 0x76, 0xf1, 0x08, 0x6c,
      0xff, 0xa3, 0xb9, 0x25, 0xcc, 0xed, 0xc1, 0x10, 0x41, 0xdd, 0x5d,
      0x04, 0xea, 0xcb, 0xf9, 0x70, 0x79, 0x3f, 0x74, 0x61, 0x9a, 0x6d,
      0xdb, 0x17, 0x58, 0x10, 0x10, 0x45, 0xa4, 0x0c};
  unsigned char cyphertext2[] = {
      0x23, 0xaf, 0xcb, 0x48, 0x0b, 0x00, 0x00, 0x6e, 0x2e, 0xf0, 0x47,
      0x1a, 0xb9, 0xa2, 0x32, 0xae, 0xf8, 0xf7, 0x06, 0xf6, 0xa1, 0xa1,
      0xbc, 0xc7, 0x0a, 0xce, 0xdf, 0x10, 0x05, 0xc0, 0xc8, 0x1d, 0x46,
      0x30, 0x8d, 0xbc, 0x25, 0xce, 0xa6, 0x00, 0x6c, 0x14, 0xaf};
  fprintf(stdout, "\nTesting checksum 0, RDDNS hourly update\n");
  if (run_crypt_test(cyphertext1, sizeof cyphertext1, 0) != 0) {
    fprintf(stdout, "Test #1 FAILED\n");
  } else {
    fprintf(stdout, "Test #1 PASSED\n");
  }
  fprintf(stdout, "\nTesting checksum 1, self-generated 4.3 query string\n");
  if (run_crypt_test(cyphertext2, sizeof cyphertext2, 1) != 0) {
    fprintf(stdout, "Test #2 FAILED\n");
  } else {
    fprintf(stdout, "Test #2 PASSED\n");
  }
  return (0);
}


x86 assembly (clang, -O0):
<rtv_crypt_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x40(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x3f,%edx
call   1050 <memcpy@plt>
lea    -0x70(%rbp),%rdi
lea    0xee8(%rip),%rsi
mov    $0x2b,%edx
call   1050 <memcpy@plt>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
lea    0xef9(%rip),%rsi
call   1030 <fprintf@plt>
lea    -0x40(%rbp),%rdi
mov    $0x3f,%esi
xor    %edx,%edx
call   1040 <run_crypt_test@plt>
cmp    $0x0,%rax
je     11ab <rtv_crypt_test+0x7b>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
lea    0xef4(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11c0 <rtv_crypt_test+0x90>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
lea    0xeea(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
lea    0xee5(%rip),%rsi
call   1030 <fprintf@plt>
lea    -0x70(%rbp),%rdi
mov    $0x2b,%esi
mov    $0x1,%edx
call   1040 <run_crypt_test@plt>
cmp    $0x0,%rax
je     120c <rtv_crypt_test+0xdc>
mov    0x2de7(%rip),%rax
mov    (%rax),%edi
lea    0xee9(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1221 <rtv_crypt_test+0xf1>
mov    0x2dcd(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtv_crypt_test>:
push   %rbx
sub    $0x70,%rsp
movups 0xf03(%rip),%xmm0
movups %xmm0,0x5f(%rsp)
movaps 0xee8(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xecc(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xeb0(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movups 0xeff(%rip),%xmm0
movups %xmm0,0x1b(%rsp)
movaps 0xee8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xecc(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    0x2e61(%rip),%rbx
mov    (%rbx),%edi
lea    0xee3(%rip),%rsi
call   1030 <fprintf@plt>
lea    0x30(%rsp),%rdi
mov    $0x3f,%esi
xor    %edx,%edx
call   1040 <run_crypt_test@plt>
test   %rax,%rax
mov    (%rbx),%edi
lea    0xefb(%rip),%rax
lea    0xee4(%rip),%rsi
cmove  %rax,%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xef2(%rip),%rsi
call   1030 <fprintf@plt>
mov    %rsp,%rdi
mov    $0x2b,%esi
mov    $0x1,%edx
call   1040 <run_crypt_test@plt>
test   %rax,%rax
lea    0xf17(%rip),%rax
lea    0xf00(%rip),%rsi
cmove  %rax,%rsi
mov    (%rbx),%edi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.rtv_crypt_test.cyphertext1 = [63 x i8] c"}\D9\C3T\EC\01\14s\10?\0A\C5\995\12\1E\08\AF\D5\C7\1A\B3\FE\80\A7Sr\0D\C9v\F1\08l\FF\A3\B9%\CC\ED\C1\10A\DD]\04\EA\CB\F9py?ta\9Am\DB\17X\10\10E\A4\0C"
@__const.rtv_crypt_test.cyphertext2 = [43 x i8] c"#\AF\CBH\0B\00\00n.\F0G\1A\B9\A22\AE\F8\F7\06\F6\A1\A1\BC\C7\0A\CE\DF\10\05\C0\C8\1DF0\8D\BC%\CE\A6\00l\14\AF"
@stdout = global i32 0
@.str = [42 x i8] c"\0ATesting checksum 0, RDDNS hourly update\0A\00"
@.str.1 = [16 x i8] c"Test FAILED\0A\00"
@.str.2 = [16 x i8] c"Test PASSED\0A\00"
@.str.3 = [54 x i8] c"\0ATesting checksum 1, self-generated 4.3 query string\0A\00"
@.str.4 = [16 x i8] c"Test FAILED\0A\00"
@.str.5 = [16 x i8] c"Test PASSED\0A\00"
define i32 @rtv_crypt_test() {
%1 = alloca [63 x i8]
%2 = alloca [43 x i8]
%3 = bitcast [63 x i8]* %1 to i8*
%4 = bitcast [43 x i8]* %2 to i8*
%5 = load i32, i32* @stdout
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [63 x i8], [63 x i8]* %1, i64 0, i64 0
%8 = call i64 @run_crypt_test(i8* %7, i32 63, i32 0)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = load i32, i32* @stdout
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %16
13: ; preds = %0
%14 = load i32, i32* @stdout
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %13, %10
%17 = load i32, i32* @stdout
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0))
%19 = getelementptr inbounds [43 x i8], [43 x i8]* %2, i64 0, i64 0
%20 = call i64 @run_crypt_test(i8* %19, i32 43, i32 1)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %16
%23 = load i32, i32* @stdout
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %28
25: ; preds = %16
%26 = load i32, i32* @stdout
%27 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
br label %28
28: ; preds = %25, %22
ret i32 0
}

LLVM IR (-O2):
@__const.rtv_crypt_test.cyphertext1 = [63 x i8] c"}\D9\C3T\EC\01\14s\10?\0A\C5\995\12\1E\08\AF\D5\C7\1A\B3\FE\80\A7Sr\0D\C9v\F1\08l\FF\A3\B9%\CC\ED\C1\10A\DD]\04\EA\CB\F9py?ta\9Am\DB\17X\10\10E\A4\0C"
@__const.rtv_crypt_test.cyphertext2 = [43 x i8] c"#\AF\CBH\0B\00\00n.\F0G\1A\B9\A22\AE\F8\F7\06\F6\A1\A1\BC\C7\0A\CE\DF\10\05\C0\C8\1DF0\8D\BC%\CE\A6\00l\14\AF"
@stdout = global i32 0
@.str = [42 x i8] c"\0ATesting checksum 0, RDDNS hourly update\0A\00"
@.str.1 = [16 x i8] c"Test FAILED\0A\00"
@.str.2 = [16 x i8] c"Test PASSED\0A\00"
@.str.3 = [54 x i8] c"\0ATesting checksum 1, self-generated 4.3 query string\0A\00"
@.str.4 = [16 x i8] c"Test FAILED\0A\00"
@.str.5 = [16 x i8] c"Test PASSED\0A\00"
define i32 @rtv_crypt_test() {
%1 = alloca [63 x i8]
%2 = alloca [43 x i8]
%3 = getelementptr inbounds [63 x i8], [63 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [43 x i8], [43 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @stdout
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%7 = call i64 @run_crypt_test(i8* %3, i32 63, i32 0)
%8 = icmp eq i64 %7, 0
%9 = load i32, i32* @stdout
%10 = select i1 %8, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0)
%11 = call i32 @fprintf(i32 %9, i8* %10)
%12 = load i32, i32* @stdout
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0))
%14 = call i64 @run_crypt_test(i8* %4, i32 43, i32 1)
%15 = icmp eq i64 %14, 0
%16 = select i1 %15, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0)
%17 = load i32, i32* @stdout
%18 = call i32 @fprintf(i32 %17, i8* %16)
ret i32 0
}