#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 */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ gen_testvectors(int *, int *);
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Test vectors for the ChaCha stream cipher\n");
  printf("=========================================\n\n");
  printf("TC1: All zero key and IV.\n");
  printf("-------------------------\n");
  uint8_t tc1_key[32] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  uint8_t tc1_iv[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  gen_testvectors(tc1_key, tc1_iv);
  printf("\n");
  printf("TC2: Single bit in key set. All zero IV.\n");
  printf("----------------------------------------\n");
  uint8_t tc2_key[32] = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  uint8_t tc2_iv[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  gen_testvectors(tc2_key, tc2_iv);
  printf("\n");
  printf("TC3: Single bit in IV set. All zero key.\n");
  printf("----------------------------------------\n");
  uint8_t tc3_key[32] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  uint8_t tc3_iv[8] = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  gen_testvectors(tc3_key, tc3_iv);
  printf("\n");
  printf("TC4: All bits in key and IV are set.\n");
  printf("------------------------------------\n");
  uint8_t tc4_key[32] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
                         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
  uint8_t tc4_iv[8] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
  gen_testvectors(tc4_key, tc4_iv);
  printf("\n");
  printf("TC5: Every even bit set in key and IV.\n");
  printf("--------------------------------------\n");
  uint8_t tc5_key[32] = {0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
                         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
                         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
                         0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55};
  uint8_t tc5_iv[8] = {0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55};
  gen_testvectors(tc5_key, tc5_iv);
  printf("\n");
  printf("TC6: Every odd bit set in key and IV.\n");
  printf("-------------------------------------\n");
  uint8_t tc6_key[32] = {0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
                         0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
                         0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
                         0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa};
  uint8_t tc6_iv[8] = {0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa};
  gen_testvectors(tc6_key, tc6_iv);
  printf("\n");
  printf("TC7: Sequence patterns in key and IV.\n");
  printf("-------------------------------------\n");
  uint8_t tc7_key[32] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
                         0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
                         0xff, 0xee, 0xdd, 0xcc, 0xbb, 0xaa, 0x99, 0x88,
                         0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00};
  uint8_t tc7_iv[8] = {0x0f, 0x1e, 0x2d, 0x3c, 0x4b, 0x5a, 0x69, 0x78};
  gen_testvectors(tc7_key, tc7_iv);
  printf("\n");
  printf("TC8: key: 'All your base are belong to us!, IV: 'IETF2013'\n");
  printf("----------------------------------------------------------\n");
  uint8_t tc8_key[32] = {0xc4, 0x6e, 0xc1, 0xb1, 0x8c, 0xe8, 0xa8, 0x78,
                         0x72, 0x5a, 0x37, 0xe7, 0x80, 0xdf, 0xb7, 0x35,
                         0x1f, 0x68, 0xed, 0x2e, 0x19, 0x4c, 0x79, 0xfb,
                         0xc6, 0xae, 0xbe, 0xe1, 0xa6, 0x67, 0x97, 0x5d};
  uint8_t tc8_iv[8] = {0x1a, 0xda, 0x31, 0xd5, 0xcf, 0x68, 0x82, 0x21};
  gen_testvectors(tc8_key, tc8_iv);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x510,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
lea    0x1042(%rip),%rdi
call   1030 <printf@plt>
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
lea    -0xb0(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
lea    -0x90(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
call   1050 <gen_testvectors@plt>
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
lea    0xfd6(%rip),%rdi
call   1030 <printf@plt>
lea    -0x130(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
movl   $0x1,-0x130(%rbp)
lea    -0x150(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
lea    -0x130(%rbp),%rdi
lea    -0x150(%rbp),%rsi
call   1050 <gen_testvectors@plt>
lea    0xe2c(%rip),%rdi
call   1030 <printf@plt>
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
lea    0xf6f(%rip),%rdi
call   1030 <printf@plt>
lea    -0x1d0(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1040 <memset@plt>
mov    0xf80(%rip),%rax
mov    %rax,-0x1f0(%rbp)
mov    0xf7a(%rip),%rax
mov    %rax,-0x1e8(%rbp)
mov    0xf74(%rip),%rax
mov    %rax,-0x1e0(%rbp)
mov    0xf6e(%rip),%rax
mov    %rax,-0x1d8(%rbp)
lea    -0x1d0(%rbp),%rdi
lea    -0x1f0(%rbp),%rsi
call   1050 <gen_testvectors@plt>
lea    0xdaa(%rip),%rdi
call   1030 <printf@plt>
lea    0xe0f(%rip),%rdi
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
call   1030 <printf@plt>
lea    -0x270(%rbp),%rdi
lea    0xfca(%rip),%rsi
mov    $0x80,%edx
call   1060 <memcpy@plt>
mov    0xf19(%rip),%rax
mov    %rax,-0x290(%rbp)
mov    0xf13(%rip),%rax
mov    %rax,-0x288(%rbp)
mov    0xf0d(%rip),%rax
mov    %rax,-0x280(%rbp)
mov    0xf07(%rip),%rax
mov    %rax,-0x278(%rbp)
lea    -0x270(%rbp),%rdi
lea    -0x290(%rbp),%rsi
call   1050 <gen_testvectors@plt>
lea    0xd23(%rip),%rdi
call   1030 <printf@plt>
lea    0xdae(%rip),%rdi
call   1030 <printf@plt>
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
lea    -0x310(%rbp),%rdi
lea    0xfc3(%rip),%rsi
mov    $0x80,%edx
call   1060 <memcpy@plt>
mov    0xeb2(%rip),%rax
mov    %rax,-0x330(%rbp)
mov    0xeac(%rip),%rax
mov    %rax,-0x328(%rbp)
mov    0xea6(%rip),%rax
mov    %rax,-0x320(%rbp)
mov    0xea0(%rip),%rax
mov    %rax,-0x318(%rbp)
lea    -0x310(%rbp),%rdi
lea    -0x330(%rbp),%rsi
call   1050 <gen_testvectors@plt>
lea    0xc9c(%rip),%rdi
call   1030 <printf@plt>
lea    0xd4f(%rip),%rdi
call   1030 <printf@plt>
lea    0xde2(%rip),%rdi
call   1030 <printf@plt>
lea    -0x3b0(%rbp),%rdi
lea    0xfbc(%rip),%rsi
mov    $0x80,%edx
call   1060 <memcpy@plt>
mov    0xe4b(%rip),%rax
mov    %rax,-0x3d0(%rbp)
mov    0xe45(%rip),%rax
mov    %rax,-0x3c8(%rbp)
mov    0xe3f(%rip),%rax
mov    %rax,-0x3c0(%rbp)
mov    0xe39(%rip),%rax
mov    %rax,-0x3b8(%rbp)
lea    -0x3b0(%rbp),%rdi
lea    -0x3d0(%rbp),%rsi
call   1050 <gen_testvectors@plt>
lea    0xc15(%rip),%rdi
call   1030 <printf@plt>
lea    0xcef(%rip),%rdi
call   1030 <printf@plt>
lea    0xd5b(%rip),%rdi
call   1030 <printf@plt>
lea    -0x450(%rbp),%rdi
lea    0xfb5(%rip),%rsi
mov    $0x80,%edx
call   1060 <memcpy@plt>
mov    0xde4(%rip),%rax
mov    %rax,-0x470(%rbp)
mov    0xdde(%rip),%rax
mov    %rax,-0x468(%rbp)
mov    0xdd8(%rip),%rax
mov    %rax,-0x460(%rbp)
mov    0xdd2(%rip),%rax
mov    %rax,-0x458(%rbp)
lea    -0x450(%rbp),%rdi
lea    -0x470(%rbp),%rsi
call   1050 <gen_testvectors@plt>
lea    0xb8e(%rip),%rdi
call   1030 <printf@plt>
lea    0xc8f(%rip),%rdi
call   1030 <printf@plt>
lea    0xcbf(%rip),%rdi
call   1030 <printf@plt>
lea    -0x4f0(%rbp),%rdi
lea    0xfae(%rip),%rsi
mov    $0x80,%edx
call   1060 <memcpy@plt>
mov    0xd7d(%rip),%rax
mov    %rax,-0x510(%rbp)
mov    0xd77(%rip),%rax
mov    %rax,-0x508(%rbp)
mov    0xd71(%rip),%rax
mov    %rax,-0x500(%rbp)
mov    0xd6b(%rip),%rax
mov    %rax,-0x4f8(%rbp)
lea    -0x4f0(%rbp),%rdi
lea    -0x510(%rbp),%rsi
call   1050 <gen_testvectors@plt>
xor    %eax,%eax
add    $0x510,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x500,%rsp
lea    0x1201(%rip),%rdi
call   1040 <puts@plt>
lea    0x121f(%rip),%rdi
call   1040 <puts@plt>
lea    0x123e(%rip),%rdi
call   1040 <puts@plt>
lea    0x1392(%rip),%rdi
call   1040 <puts@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x4f0(%rsp)
movaps %xmm0,0x4e0(%rsp)
movaps %xmm0,0x4d0(%rsp)
movaps %xmm0,0x4c0(%rsp)
movaps %xmm0,0x4b0(%rsp)
movaps %xmm0,0x4a0(%rsp)
movaps %xmm0,0x490(%rsp)
movaps %xmm0,0x480(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
lea    0x480(%rsp),%rdi
lea    0xe0(%rsp),%rsi
call   1050 <gen_testvectors@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x11ce(%rip),%rdi
call   1040 <puts@plt>
lea    0x12f9(%rip),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0x170(%rsp)
movaps %xmm0,0x160(%rsp)
movaps %xmm0,0x150(%rsp)
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
movl   $0x1,0x100(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
lea    0x100(%rsp),%rdi
lea    0xc0(%rsp),%rsi
call   1050 <gen_testvectors@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x115f(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x470(%rsp)
movaps %xmm0,0x460(%rsp)
movaps %xmm0,0x450(%rsp)
movaps %xmm0,0x440(%rsp)
movaps %xmm0,0x430(%rsp)
movaps %xmm0,0x420(%rsp)
movaps %xmm0,0x410(%rsp)
movaps %xmm0,0x400(%rsp)
movaps 0xd40(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0xd21(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
lea    0x400(%rsp),%rdi
lea    0xa0(%rsp),%rsi
call   1050 <gen_testvectors@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x10f4(%rip),%rdi
call   1040 <puts@plt>
lea    0x11d1(%rip),%rdi
call   1040 <puts@plt>
movaps 0xe0b(%rip),%xmm0
movaps %xmm0,0x3f0(%rsp)
movaps 0xdec(%rip),%xmm0
movaps %xmm0,0x3e0(%rsp)
movaps 0xdcd(%rip),%xmm0
movaps %xmm0,0x3d0(%rsp)
movaps 0xdae(%rip),%xmm0
movaps %xmm0,0x3c0(%rsp)
movaps 0xd8f(%rip),%xmm0
movaps %xmm0,0x3b0(%rsp)
movaps 0xd70(%rip),%xmm0
movaps %xmm0,0x3a0(%rsp)
movaps 0xd51(%rip),%xmm0
movaps %xmm0,0x390(%rsp)
movaps 0xd32(%rip),%xmm0
movaps %xmm0,0x380(%rsp)
movaps 0xc93(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xc74(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
lea    0x380(%rsp),%rdi
lea    0x80(%rsp),%rsi
call   1050 <gen_testvectors@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x104c(%rip),%rdi
call   1040 <puts@plt>
lea    0x1102(%rip),%rdi
call   1040 <puts@plt>
movaps 0xdbe(%rip),%xmm0
movaps %xmm0,0x370(%rsp)
movaps 0xd9f(%rip),%xmm0
movaps %xmm0,0x360(%rsp)
movaps 0xd80(%rip),%xmm0
movaps %xmm0,0x350(%rsp)
movaps 0xd61(%rip),%xmm0
movaps %xmm0,0x340(%rsp)
movaps 0xd42(%rip),%xmm0
movaps %xmm0,0x330(%rsp)
movaps 0xd23(%rip),%xmm0
movaps %xmm0,0x320(%rsp)
movaps 0xd04(%rip),%xmm0
movaps %xmm0,0x310(%rsp)
movaps 0xce5(%rip),%xmm0
movaps %xmm0,0x300(%rsp)
movaps 0xbe6(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xbca(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
lea    0x300(%rsp),%rdi
lea    0x60(%rsp),%rsi
call   1050 <gen_testvectors@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xfaf(%rip),%rdi
call   1040 <puts@plt>
lea    0x103f(%rip),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
movaps 0xd77(%rip),%xmm0
movaps %xmm0,0x2f0(%rsp)
movaps 0xd58(%rip),%xmm0
movaps %xmm0,0x2e0(%rsp)
movaps 0xd39(%rip),%xmm0
movaps %xmm0,0x2d0(%rsp)
movaps 0xd1a(%rip),%xmm0
movaps %xmm0,0x2c0(%rsp)
movaps 0xcfb(%rip),%xmm0
movaps %xmm0,0x2b0(%rsp)
movaps 0xcdc(%rip),%xmm0
movaps %xmm0,0x2a0(%rsp)
movaps 0xcbd(%rip),%xmm0
movaps %xmm0,0x290(%rsp)
movaps 0xc9e(%rip),%xmm0
movaps %xmm0,0x280(%rsp)
movaps 0xb3f(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xb23(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
lea    0x280(%rsp),%rdi
lea    0x40(%rsp),%rsi
call   1050 <gen_testvectors@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xf0e(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
movaps 0xd37(%rip),%xmm0
movaps %xmm0,0x270(%rsp)
movaps 0xd18(%rip),%xmm0
movaps %xmm0,0x260(%rsp)
movaps 0xcf9(%rip),%xmm0
movaps %xmm0,0x250(%rsp)
movaps 0xcda(%rip),%xmm0
movaps %xmm0,0x240(%rsp)
movaps 0xcbb(%rip),%xmm0
movaps %xmm0,0x230(%rsp)
movaps 0xc9c(%rip),%xmm0
movaps %xmm0,0x220(%rsp)
movaps 0xc7d(%rip),%xmm0
movaps %xmm0,0x210(%rsp)
movaps 0xc5e(%rip),%xmm0
movaps %xmm0,0x200(%rsp)
movaps 0xa9f(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xa83(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0x200(%rsp),%rdi
lea    0x20(%rsp),%rsi
call   1050 <gen_testvectors@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe74(%rip),%rdi
call   1040 <puts@plt>
lea    0xea3(%rip),%rdi
call   1040 <puts@plt>
movaps 0xcf3(%rip),%xmm0
movaps %xmm0,0x1f0(%rsp)
movaps 0xcd4(%rip),%xmm0
movaps %xmm0,0x1e0(%rsp)
movaps 0xcb5(%rip),%xmm0
movaps %xmm0,0x1d0(%rsp)
movaps 0xc96(%rip),%xmm0
movaps %xmm0,0x1c0(%rsp)
movaps 0xc77(%rip),%xmm0
movaps %xmm0,0x1b0(%rsp)
movaps 0xc58(%rip),%xmm0
movaps %xmm0,0x1a0(%rsp)
movaps 0xc39(%rip),%xmm0
movaps %xmm0,0x190(%rsp)
movaps 0xc1a(%rip),%xmm0
movaps %xmm0,0x180(%rsp)
movaps 0x9fb(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0x9df(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x180(%rsp),%rdi
mov    %rsp,%rsi
call   1050 <gen_testvectors@plt>
xor    %eax,%eax
add    $0x500,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Test vectors for the ChaCha stream cipher\0A\00"
@.str.1 = [44 x i8] c"=========================================\0A\0A\00"
@.str.2 = [27 x i8] c"TC1: All zero key and IV.\0A\00"
@.str.3 = [27 x i8] c"-------------------------\0A\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [42 x i8] c"TC2: Single bit in key set. All zero IV.\0A\00"
@.str.6 = [42 x i8] c"----------------------------------------\0A\00"
@.str.7 = [42 x i8] c"TC3: Single bit in IV set. All zero key.\0A\00"
@__const.main.tc3_iv = [8 x i32] [i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0]
@.str.8 = [38 x i8] c"TC4: All bits in key and IV are set.\0A\00"
@.str.9 = [38 x i8] c"------------------------------------\0A\00"
@__const.main.tc4_key = [32 x i32] [i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255]
@__const.main.tc4_iv = [8 x i32] [i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255]
@.str.10 = [40 x i8] c"TC5: Every even bit set in key and IV.\0A\00"
@.str.11 = [40 x i8] c"--------------------------------------\0A\00"
@__const.main.tc5_key = [32 x i32] [i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85]
@__const.main.tc5_iv = [8 x i32] [i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85]
@.str.12 = [39 x i8] c"TC6: Every odd bit set in key and IV.\0A\00"
@.str.13 = [39 x i8] c"-------------------------------------\0A\00"
@__const.main.tc6_key = [32 x i32] [i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170]
@__const.main.tc6_iv = [8 x i32] [i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170]
@.str.14 = [39 x i8] c"TC7: Sequence patterns in key and IV.\0A\00"
@__const.main.tc7_key = [32 x i32] [i32 0, i32 17, i32 34, i32 51, i32 68, i32 85, i32 102, i32 119, i32 136, i32 153, i32 170, i32 187, i32 204, i32 221, i32 238, i32 255, i32 255, i32 238, i32 221, i32 204, i32 187, i32 170, i32 153, i32 136, i32 119, i32 102, i32 85, i32 68, i32 51, i32 34, i32 17, i32 0]
@__const.main.tc7_iv = [8 x i32] [i32 15, i32 30, i32 45, i32 60, i32 75, i32 90, i32 105, i32 120]
@.str.15 = [60 x i8] c"TC8: key: 'All your base are belong to us!, IV: 'IETF2013'\0A\00"
@.str.16 = [60 x i8] c"----------------------------------------------------------\0A\00"
@__const.main.tc8_key = [32 x i32] [i32 196, i32 110, i32 193, i32 177, i32 140, i32 232, i32 168, i32 120, i32 114, i32 90, i32 55, i32 231, i32 128, i32 223, i32 183, i32 53, i32 31, i32 104, i32 237, i32 46, i32 25, i32 76, i32 121, i32 251, i32 198, i32 174, i32 190, i32 225, i32 166, i32 103, i32 151, i32 93]
@__const.main.tc8_iv = [8 x i32] [i32 26, i32 218, i32 49, i32 213, i32 207, i32 104, i32 130, i32 33]
define i32 @main() {
%1 = alloca i32
%2 = alloca [32 x i32]
%3 = alloca [8 x i32]
%4 = alloca [32 x i32]
%5 = alloca [8 x i32]
%6 = alloca [32 x i32]
%7 = alloca [8 x i32]
%8 = alloca [32 x i32]
%9 = alloca [8 x i32]
%10 = alloca [32 x i32]
%11 = alloca [8 x i32]
%12 = alloca [32 x i32]
%13 = alloca [8 x i32]
%14 = alloca [32 x i32]
%15 = alloca [8 x i32]
%16 = alloca [32 x i32]
%17 = alloca [8 x i32]
store i32 0, i32* %1
%18 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%22 = bitcast [32 x i32]* %2 to i8*
%23 = bitcast [8 x i32]* %3 to i8*
%24 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 0
%25 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%26 = call i32 @gen_testvectors(i32* %24, i32* %25)
%27 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%28 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0))
%29 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0))
%30 = bitcast [32 x i32]* %4 to i8*
%31 = bitcast i8* %30 to <{ i32, [31 x i32] }>*
%32 = getelementptr inbounds <{ i32, [31 x i32] }>, <{ i32, [31 x i32] }>* %31, i32 0, i32 0
store i32 1, i32* %32
%33 = bitcast [8 x i32]* %5 to i8*
%34 = getelementptr inbounds [32 x i32], [32 x i32]* %4, i64 0, i64 0
%35 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 0
%36 = call i32 @gen_testvectors(i32* %34, i32* %35)
%37 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%38 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0))
%39 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0))
%40 = bitcast [32 x i32]* %6 to i8*
%41 = bitcast [8 x i32]* %7 to i8*
%42 = getelementptr inbounds [32 x i32], [32 x i32]* %6, i64 0, i64 0
%43 = getelementptr inbounds [8 x i32], [8 x i32]* %7, i64 0, i64 0
%44 = call i32 @gen_testvectors(i32* %42, i32* %43)
%45 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%46 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0))
%47 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0))
%48 = bitcast [32 x i32]* %8 to i8*
%49 = bitcast [8 x i32]* %9 to i8*
%50 = getelementptr inbounds [32 x i32], [32 x i32]* %8, i64 0, i64 0
%51 = getelementptr inbounds [8 x i32], [8 x i32]* %9, i64 0, i64 0
%52 = call i32 @gen_testvectors(i32* %50, i32* %51)
%53 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%54 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.10, i64 0, i64 0))
%55 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.11, i64 0, i64 0))
%56 = bitcast [32 x i32]* %10 to i8*
%57 = bitcast [8 x i32]* %11 to i8*
%58 = getelementptr inbounds [32 x i32], [32 x i32]* %10, i64 0, i64 0
%59 = getelementptr inbounds [8 x i32], [8 x i32]* %11, i64 0, i64 0
%60 = call i32 @gen_testvectors(i32* %58, i32* %59)
%61 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%62 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.12, i64 0, i64 0))
%63 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.13, i64 0, i64 0))
%64 = bitcast [32 x i32]* %12 to i8*
%65 = bitcast [8 x i32]* %13 to i8*
%66 = getelementptr inbounds [32 x i32], [32 x i32]* %12, i64 0, i64 0
%67 = getelementptr inbounds [8 x i32], [8 x i32]* %13, i64 0, i64 0
%68 = call i32 @gen_testvectors(i32* %66, i32* %67)
%69 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%70 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.14, i64 0, i64 0))
%71 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.13, i64 0, i64 0))
%72 = bitcast [32 x i32]* %14 to i8*
%73 = bitcast [8 x i32]* %15 to i8*
%74 = getelementptr inbounds [32 x i32], [32 x i32]* %14, i64 0, i64 0
%75 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 0
%76 = call i32 @gen_testvectors(i32* %74, i32* %75)
%77 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%78 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.15, i64 0, i64 0))
%79 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.16, i64 0, i64 0))
%80 = bitcast [32 x i32]* %16 to i8*
%81 = bitcast [8 x i32]* %17 to i8*
%82 = getelementptr inbounds [32 x i32], [32 x i32]* %16, i64 0, i64 0
%83 = getelementptr inbounds [8 x i32], [8 x i32]* %17, i64 0, i64 0
%84 = call i32 @gen_testvectors(i32* %82, i32* %83)
ret i32 0
}

LLVM IR (-O2):
@__const.main.tc3_iv = [8 x i32] [i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0]
@__const.main.tc4_key = [32 x i32] [i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255]
@__const.main.tc4_iv = [8 x i32] [i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255, i32 255]
@__const.main.tc5_key = [32 x i32] [i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85]
@__const.main.tc5_iv = [8 x i32] [i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85, i32 85]
@__const.main.tc6_key = [32 x i32] [i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170]
@__const.main.tc6_iv = [8 x i32] [i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170, i32 170]
@__const.main.tc7_key = [32 x i32] [i32 0, i32 17, i32 34, i32 51, i32 68, i32 85, i32 102, i32 119, i32 136, i32 153, i32 170, i32 187, i32 204, i32 221, i32 238, i32 255, i32 255, i32 238, i32 221, i32 204, i32 187, i32 170, i32 153, i32 136, i32 119, i32 102, i32 85, i32 68, i32 51, i32 34, i32 17, i32 0]
@__const.main.tc7_iv = [8 x i32] [i32 15, i32 30, i32 45, i32 60, i32 75, i32 90, i32 105, i32 120]
@__const.main.tc8_key = [32 x i32] [i32 196, i32 110, i32 193, i32 177, i32 140, i32 232, i32 168, i32 120, i32 114, i32 90, i32 55, i32 231, i32 128, i32 223, i32 183, i32 53, i32 31, i32 104, i32 237, i32 46, i32 25, i32 76, i32 121, i32 251, i32 198, i32 174, i32 190, i32 225, i32 166, i32 103, i32 151, i32 93]
@__const.main.tc8_iv = [8 x i32] [i32 26, i32 218, i32 49, i32 213, i32 207, i32 104, i32 130, i32 33]
@str = [42 x i8] c"Test vectors for the ChaCha stream cipher\00"
@str.17 = [43 x i8] c"=========================================\0A\00"
@str.18 = [26 x i8] c"TC1: All zero key and IV.\00"
@str.19 = [26 x i8] c"-------------------------\00"
@str.20 = [41 x i8] c"TC2: Single bit in key set. All zero IV.\00"
@str.22 = [41 x i8] c"TC3: Single bit in IV set. All zero key.\00"
@str.23 = [41 x i8] c"----------------------------------------\00"
@str.24 = [37 x i8] c"TC4: All bits in key and IV are set.\00"
@str.25 = [37 x i8] c"------------------------------------\00"
@str.26 = [39 x i8] c"TC5: Every even bit set in key and IV.\00"
@str.27 = [39 x i8] c"--------------------------------------\00"
@str.28 = [38 x i8] c"TC6: Every odd bit set in key and IV.\00"
@str.30 = [38 x i8] c"TC7: Sequence patterns in key and IV.\00"
@str.31 = [38 x i8] c"-------------------------------------\00"
@str.32 = [59 x i8] c"TC8: key: 'All your base are belong to us!, IV: 'IETF2013'\00"
@str.33 = [59 x i8] c"----------------------------------------------------------\00"
define i32 @main() {
%1 = alloca [32 x i32]
%2 = alloca [8 x i32]
%3 = alloca [32 x i32]
%4 = alloca [8 x i32]
%5 = alloca [32 x i32]
%6 = alloca [8 x i32]
%7 = alloca [32 x i32]
%8 = alloca [8 x i32]
%9 = alloca [32 x i32]
%10 = alloca [8 x i32]
%11 = alloca [32 x i32]
%12 = alloca [8 x i32]
%13 = alloca [32 x i32]
%14 = alloca [8 x i32]
%15 = alloca [32 x i32]
%16 = alloca [8 x i32]
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.17, i64 0, i64 0))
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.18, i64 0, i64 0))
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.19, i64 0, i64 0))
%21 = bitcast [32 x i32]* %1 to i8*
%22 = bitcast [8 x i32]* %2 to i8*
%23 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 0
%24 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%25 = call i32 @gen_testvectors(i32* %23, i32* %24)
%26 = call i32 @putchar(i32 10)
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.20, i64 0, i64 0))
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.23, i64 0, i64 0))
%29 = bitcast [32 x i32]* %3 to i8*
%30 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 0
store i32 1, i32* %30
%31 = bitcast [8 x i32]* %4 to i8*
%32 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 0
%33 = call i32 @gen_testvectors(i32* %30, i32* %32)
%34 = call i32 @putchar(i32 10)
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.22, i64 0, i64 0))
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.23, i64 0, i64 0))
%37 = bitcast [32 x i32]* %5 to i8*
%38 = bitcast [8 x i32]* %6 to i8*
%39 = getelementptr inbounds [32 x i32], [32 x i32]* %5, i64 0, i64 0
%40 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 0
%41 = call i32 @gen_testvectors(i32* %39, i32* %40)
%42 = call i32 @putchar(i32 10)
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.24, i64 0, i64 0))
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.25, i64 0, i64 0))
%45 = bitcast [32 x i32]* %7 to i8*
%46 = bitcast [8 x i32]* %8 to i8*
%47 = getelementptr inbounds [32 x i32], [32 x i32]* %7, i64 0, i64 0
%48 = getelementptr inbounds [8 x i32], [8 x i32]* %8, i64 0, i64 0
%49 = call i32 @gen_testvectors(i32* %47, i32* %48)
%50 = call i32 @putchar(i32 10)
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.26, i64 0, i64 0))
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.27, i64 0, i64 0))
%53 = bitcast [32 x i32]* %9 to i8*
%54 = bitcast [8 x i32]* %10 to i8*
%55 = getelementptr inbounds [32 x i32], [32 x i32]* %9, i64 0, i64 0
%56 = getelementptr inbounds [8 x i32], [8 x i32]* %10, i64 0, i64 0
%57 = call i32 @gen_testvectors(i32* %55, i32* %56)
%58 = call i32 @putchar(i32 10)
%59 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.28, i64 0, i64 0))
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.31, i64 0, i64 0))
%61 = bitcast [32 x i32]* %11 to i8*
%62 = bitcast [8 x i32]* %12 to i8*
%63 = getelementptr inbounds [32 x i32], [32 x i32]* %11, i64 0, i64 0
%64 = getelementptr inbounds [8 x i32], [8 x i32]* %12, i64 0, i64 0
%65 = call i32 @gen_testvectors(i32* %63, i32* %64)
%66 = call i32 @putchar(i32 10)
%67 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.30, i64 0, i64 0))
%68 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.31, i64 0, i64 0))
%69 = bitcast [32 x i32]* %13 to i8*
%70 = bitcast [8 x i32]* %14 to i8*
%71 = getelementptr inbounds [32 x i32], [32 x i32]* %13, i64 0, i64 0
%72 = getelementptr inbounds [8 x i32], [8 x i32]* %14, i64 0, i64 0
%73 = call i32 @gen_testvectors(i32* %71, i32* %72)
%74 = call i32 @putchar(i32 10)
%75 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.32, i64 0, i64 0))
%76 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.33, i64 0, i64 0))
%77 = bitcast [32 x i32]* %15 to i8*
%78 = bitcast [8 x i32]* %16 to i8*
%79 = getelementptr inbounds [32 x i32], [32 x i32]* %15, i64 0, i64 0
%80 = getelementptr inbounds [8 x i32], [8 x i32]* %16, i64 0, i64 0
%81 = call i32 @gen_testvectors(i32* %79, i32* %80)
ret i32 0
}