#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;
typedef int uint64_t;
typedef int /*<<< orphan*/ tweak;
typedef int /*<<< orphan*/ Tag;

/* Variables and functions */
int /*<<< orphan*/ aesTweakEncrypt(int, int const *, int *, int *);
int get_block_number_from_tag(int *);
scalar_t__ memcmp_const(int *, int *, int);
int /*<<< orphan*/ memcpy(int *, int const *, size_t);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, size_t);
int /*<<< orphan*/ set_block_number_in_tweak(int *, int);
int /*<<< orphan*/ set_stage_in_tweak(int *, int);
int /*<<< orphan*/ set_tweak_in_tweakey(int *, int *);
int /*<<< orphan*/ xor_values(int *, int const *);
int deoxys_aead_decrypt(const uint8_t *ass_data, size_t ass_data_len,
                        uint8_t *message, size_t *m_len, const uint8_t *key,
                        const uint8_t *nonce, const uint8_t *ciphertext,
                        size_t c_len) {
  uint64_t i;
  uint64_t j;
  uint64_t hblock1, hblock2;
  uint8_t tweak[16];
  uint8_t tweakey[256 / 8];
  uint8_t Auth[16];
  uint8_t last_block[16];
  uint8_t Checksum[16];
  uint8_t Final[16];
  uint8_t zero_block[16];
  uint8_t Pad[16];
  uint8_t Tag[16], tag[16];
  uint8_t temp[16];
  memcpy(Tag, ciphertext + c_len - 16, 16);
  c_len -= 16;
  memset(tweak, 0, sizeof(tweak));
  memcpy(tweakey, key, 16);
  memset(Auth, 0, 16);
  set_block_number_in_tweak(tweak + 0, 0);
  set_block_number_in_tweak(tweak + 8, 0);
  set_stage_in_tweak(tweak, (0x3 << 4));
  set_tweak_in_tweakey(tweakey, tweak);
  aesTweakEncrypt(256, nonce, tweakey, temp);
  xor_values(Auth, temp);
  set_stage_in_tweak(tweak, (0x7 << 4));
  set_tweak_in_tweakey(tweakey, tweak);
  aesTweakEncrypt(256, nonce, tweakey, temp);
  xor_values(Auth, temp);
  if (ass_data_len) {
    set_stage_in_tweak(tweak, (0x2 << 4));
    i = 0;
    while (16 * (i + 1) <= ass_data_len) {
      set_block_number_in_tweak(tweak + 8, i);
      set_tweak_in_tweakey(tweakey, tweak);
      aesTweakEncrypt(256, ass_data + 16 * i, tweakey, temp);
      xor_values(Auth, temp);
      i++;
    }
    if (ass_data_len > 16 * i) {
      memset(last_block, 0, 16);
      memcpy(last_block, ass_data + 16 * i, ass_data_len - 16 * i);
      last_block[ass_data_len - 16 * i] = 0x80;
      set_stage_in_tweak(tweak, (0x6 << 4));
      set_block_number_in_tweak(tweak + 8, i);
      set_tweak_in_tweakey(tweakey, tweak);
      aesTweakEncrypt(256, last_block, tweakey, temp);
      xor_values(Auth, temp);
    }
  }
  memcpy(tweak, Tag, 16);
  tweak[0] = 0x80 ^ (tweak[0] & 0x7f);
  i = 0;
  hblock1 = get_block_number_from_tag(Tag + 0);
  hblock2 = get_block_number_from_tag(Tag + 8);
  while (16 * (i + 1) <= c_len) {
    set_block_number_in_tweak(tweak + 8, hblock2);
    set_tweak_in_tweakey(tweakey, tweak);
    aesTweakEncrypt(256, nonce, tweakey, message + 16 * i);
    xor_values(message + 16 * i, ciphertext + 16 * i);
    i++;
    hblock2++;
    if (hblock2 == 0) {
      hblock1++;
      set_block_number_in_tweak(tweak, hblock1);
      tweak[0] = 0x80 ^ (tweak[0] & 0x7f);
    }
  }
  if (c_len > 16 * i) {
    set_block_number_in_tweak(tweak + 8, hblock2);
    set_tweak_in_tweakey(tweakey, tweak);
    aesTweakEncrypt(256, nonce, tweakey, temp);
    for (j = 0; j < c_len - 16 * i; j++)
      message[16 * i + j] = ciphertext[16 * i + j] ^ temp[j];
  }
  memset(tweak, 0, sizeof(tweak));
  set_stage_in_tweak(tweak, (0x0 << 4));
  i = 0;
  while (16 * (i + 1) <= c_len) {
    set_block_number_in_tweak(tweak + 8, i);
    set_tweak_in_tweakey(tweakey, tweak);
    aesTweakEncrypt(256, message + 16 * i, tweakey, temp);
    xor_values(Auth, temp);
    i++;
  }
  if (c_len > 16 * i) {
    memset(last_block, 0, 16);
    memcpy(last_block, message + 16 * i, c_len - 16 * i);
    last_block[c_len - 16 * i] = 0x80;
    set_stage_in_tweak(tweak, (0x4 << 4));
    set_block_number_in_tweak(tweak + 8, i);
    set_tweak_in_tweakey(tweakey, tweak);
    aesTweakEncrypt(256, last_block, tweakey, temp);
    xor_values(Auth, temp);
  }
  set_stage_in_tweak(tweak, (0x1 << 4));
  set_block_number_in_tweak(tweak + 8, 0);
  set_tweak_in_tweakey(tweakey, tweak);
  aesTweakEncrypt(256, Auth, tweakey, tag);
  if (0 != memcmp_const(Tag, tag, sizeof(Tag))) {
    memset(message, 0, c_len);
    return -1;
  }
  *m_len = c_len;
  return 0;
}


x86 assembly (clang, -O0):
<deoxys_aead_decrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x350,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
lea    -0x2d0(%rbp),%rdi
mov    0x10(%rbp),%rsi
mov    0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
add    $0xffffffffffffffc0,%rsi
mov    $0x10,%edx
call   1070 <memcpy@plt>
mov    0x18(%rbp),%rax
sub    $0x10,%rax
mov    %rax,0x18(%rbp)
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
lea    -0x110(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    $0x10,%edx
call   1070 <memcpy@plt>
lea    -0x150(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1050 <memset@plt>
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
call   1090 <set_block_number_in_tweak@plt>
lea    -0x90(%rbp),%rdi
add    $0x20,%rdi
xor    %esi,%esi
call   1090 <set_block_number_in_tweak@plt>
lea    -0x90(%rbp),%rdi
mov    $0x30,%esi
call   1030 <set_stage_in_tweak@plt>
lea    -0x110(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1080 <set_tweak_in_tweakey@plt>
mov    -0x38(%rbp),%rsi
lea    -0x110(%rbp),%rdx
lea    -0x350(%rbp),%rcx
mov    $0x100,%edi
call   1060 <aesTweakEncrypt@plt>
lea    -0x150(%rbp),%rdi
lea    -0x350(%rbp),%rsi
call   10a0 <xor_values@plt>
lea    -0x90(%rbp),%rdi
mov    $0x70,%esi
call   1030 <set_stage_in_tweak@plt>
lea    -0x110(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1080 <set_tweak_in_tweakey@plt>
mov    -0x38(%rbp),%rsi
lea    -0x110(%rbp),%rdx
lea    -0x350(%rbp),%rcx
mov    $0x100,%edi
call   1060 <aesTweakEncrypt@plt>
lea    -0x150(%rbp),%rdi
lea    -0x350(%rbp),%rsi
call   10a0 <xor_values@plt>
cmpq   $0x0,-0x18(%rbp)
je     1476 <deoxys_aead_decrypt+0x2e6>
lea    -0x90(%rbp),%rdi
mov    $0x20,%esi
call   1030 <set_stage_in_tweak@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
shl    $0x4,%eax
cltq
cmp    -0x18(%rbp),%rax
ja     1396 <deoxys_aead_decrypt+0x206>
lea    -0x90(%rbp),%rdi
add    $0x20,%rdi
mov    -0x3c(%rbp),%esi
call   1090 <set_block_number_in_tweak@plt>
lea    -0x110(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1080 <set_tweak_in_tweakey@plt>
mov    -0x10(%rbp),%rsi
mov    -0x3c(%rbp),%eax
shl    $0x4,%eax
cltq
shl    $0x2,%rax
add    %rax,%rsi
lea    -0x110(%rbp),%rdx
lea    -0x350(%rbp),%rcx
mov    $0x100,%edi
call   1060 <aesTweakEncrypt@plt>
lea    -0x150(%rbp),%rdi
lea    -0x350(%rbp),%rsi
call   10a0 <xor_values@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    130f <deoxys_aead_decrypt+0x17f>
mov    -0x18(%rbp),%rax
mov    -0x3c(%rbp),%ecx
shl    $0x4,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
jbe    1471 <deoxys_aead_decrypt+0x2e1>
lea    -0x190(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1050 <memset@plt>
lea    -0x190(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x3c(%rbp),%eax
shl    $0x4,%eax
cltq
shl    $0x2,%rax
add    %rax,%rsi
mov    -0x18(%rbp),%rdx
mov    -0x3c(%rbp),%eax
shl    $0x4,%eax
cltq
sub    %rax,%rdx
call   1070 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    -0x3c(%rbp),%ecx
shl    $0x4,%ecx
movslq %ecx,%rcx
sub    %rcx,%rax
movl   $0x80,-0x190(%rbp,%rax,4)
lea    -0x90(%rbp),%rdi
mov    $0x60,%esi
call   1030 <set_stage_in_tweak@plt>
lea    -0x90(%rbp),%rdi
add    $0x20,%rdi
mov    -0x3c(%rbp),%esi
call   1090 <set_block_number_in_tweak@plt>
lea    -0x110(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1080 <set_tweak_in_tweakey@plt>
lea    -0x190(%rbp),%rsi
lea    -0x110(%rbp),%rdx
lea    -0x350(%rbp),%rcx
mov    $0x100,%edi
call   1060 <aesTweakEncrypt@plt>
lea    -0x150(%rbp),%rdi
lea    -0x350(%rbp),%rsi
call   10a0 <xor_values@plt>
jmp    1476 <deoxys_aead_decrypt+0x2e6>
lea    -0x90(%rbp),%rdi
lea    -0x2d0(%rbp),%rsi
mov    $0x10,%edx
call   1070 <memcpy@plt>
mov    -0x90(%rbp),%eax
and    $0x7f,%eax
xor    $0x80,%eax
mov    %eax,-0x90(%rbp)
movl   $0x0,-0x3c(%rbp)
lea    -0x2d0(%rbp),%rdi
call   10b0 <get_block_number_from_tag@plt>
mov    %eax,-0x44(%rbp)
lea    -0x2d0(%rbp),%rdi
add    $0x20,%rdi
call   10b0 <get_block_number_from_tag@plt>
mov    %eax,-0x48(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
shl    $0x4,%eax
cltq
cmp    0x18(%rbp),%rax
ja     15a6 <deoxys_aead_decrypt+0x416>
lea    -0x90(%rbp),%rdi
add    $0x20,%rdi
mov    -0x48(%rbp),%esi
call   1090 <set_block_number_in_tweak@plt>
lea    -0x110(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1080 <set_tweak_in_tweakey@plt>
mov    -0x38(%rbp),%rsi
lea    -0x110(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x3c(%rbp),%eax
shl    $0x4,%eax
cltq
shl    $0x2,%rax
add    %rax,%rcx
mov    $0x100,%edi
call   1060 <aesTweakEncrypt@plt>
mov    -0x20(%rbp),%rdi
mov    -0x3c(%rbp),%eax
shl    $0x4,%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    0x10(%rbp),%rsi
mov    -0x3c(%rbp),%eax
shl    $0x4,%eax
cltq
shl    $0x2,%rax
add    %rax,%rsi
call   10a0 <xor_values@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jne    15a1 <deoxys_aead_decrypt+0x411>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1090 <set_block_number_in_tweak@plt>
mov    -0x90(%rbp),%eax
and    $0x7f,%eax
xor    $0x80,%eax
mov    %eax,-0x90(%rbp)
jmp    14cb <deoxys_aead_decrypt+0x33b>
mov    0x18(%rbp),%rax
mov    -0x3c(%rbp),%ecx
shl    $0x4,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
jbe    1666 <deoxys_aead_decrypt+0x4d6>
lea    -0x90(%rbp),%rdi
add    $0x20,%rdi
mov    -0x48(%rbp),%esi
call   1090 <set_block_number_in_tweak@plt>
lea    -0x110(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1080 <set_tweak_in_tweakey@plt>
mov    -0x38(%rbp),%rsi
lea    -0x110(%rbp),%rdx
lea    -0x350(%rbp),%rcx
mov    $0x100,%edi
call   1060 <aesTweakEncrypt@plt>
movl   $0x0,-0x40(%rbp)
movslq -0x40(%rbp),%rax
mov    0x18(%rbp),%rcx
mov    -0x3c(%rbp),%edx
shl    $0x4,%edx
movslq %edx,%rdx
sub    %rdx,%rcx
cmp    %rcx,%rax
jae    1661 <deoxys_aead_decrypt+0x4d1>
mov    0x10(%rbp),%rax
mov    -0x3c(%rbp),%ecx
shl    $0x4,%ecx
add    -0x40(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
movslq -0x40(%rbp),%rax
xor    -0x350(%rbp,%rax,4),%edx
mov    -0x20(%rbp),%rax
mov    -0x3c(%rbp),%ecx
shl    $0x4,%ecx
add    -0x40(%rbp),%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1605 <deoxys_aead_decrypt+0x475>
jmp    1666 <deoxys_aead_decrypt+0x4d6>
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1050 <memset@plt>
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
call   1030 <set_stage_in_tweak@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
shl    $0x4,%eax
cltq
cmp    0x18(%rbp),%rax
ja     1715 <deoxys_aead_decrypt+0x585>
lea    -0x90(%rbp),%rdi
add    $0x20,%rdi
mov    -0x3c(%rbp),%esi
call   1090 <set_block_number_in_tweak@plt>
lea    -0x110(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1080 <set_tweak_in_tweakey@plt>
mov    -0x20(%rbp),%rsi
mov    -0x3c(%rbp),%eax
shl    $0x4,%eax
cltq
shl    $0x2,%rax
add    %rax,%rsi
lea    -0x110(%rbp),%rdx
lea    -0x350(%rbp),%rcx
mov    $0x100,%edi
call   1060 <aesTweakEncrypt@plt>
lea    -0x150(%rbp),%rdi
lea    -0x350(%rbp),%rsi
call   10a0 <xor_values@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    168e <deoxys_aead_decrypt+0x4fe>
mov    0x18(%rbp),%rax
mov    -0x3c(%rbp),%ecx
shl    $0x4,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
jbe    17f0 <deoxys_aead_decrypt+0x660>
lea    -0x190(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1050 <memset@plt>
lea    -0x190(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x3c(%rbp),%eax
shl    $0x4,%eax
cltq
shl    $0x2,%rax
add    %rax,%rsi
mov    0x18(%rbp),%rdx
mov    -0x3c(%rbp),%eax
shl    $0x4,%eax
cltq
sub    %rax,%rdx
call   1070 <memcpy@plt>
mov    0x18(%rbp),%rax
mov    -0x3c(%rbp),%ecx
shl    $0x4,%ecx
movslq %ecx,%rcx
sub    %rcx,%rax
movl   $0x80,-0x190(%rbp,%rax,4)
lea    -0x90(%rbp),%rdi
mov    $0x40,%esi
call   1030 <set_stage_in_tweak@plt>
lea    -0x90(%rbp),%rdi
add    $0x20,%rdi
mov    -0x3c(%rbp),%esi
call   1090 <set_block_number_in_tweak@plt>
lea    -0x110(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1080 <set_tweak_in_tweakey@plt>
lea    -0x190(%rbp),%rsi
lea    -0x110(%rbp),%rdx
lea    -0x350(%rbp),%rcx
mov    $0x100,%edi
call   1060 <aesTweakEncrypt@plt>
lea    -0x150(%rbp),%rdi
lea    -0x350(%rbp),%rsi
call   10a0 <xor_values@plt>
lea    -0x90(%rbp),%rdi
mov    $0x10,%esi
call   1030 <set_stage_in_tweak@plt>
lea    -0x90(%rbp),%rdi
add    $0x20,%rdi
xor    %esi,%esi
call   1090 <set_block_number_in_tweak@plt>
lea    -0x110(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1080 <set_tweak_in_tweakey@plt>
lea    -0x150(%rbp),%rsi
lea    -0x110(%rbp),%rdx
lea    -0x310(%rbp),%rcx
mov    $0x100,%edi
call   1060 <aesTweakEncrypt@plt>
lea    -0x2d0(%rbp),%rdi
lea    -0x310(%rbp),%rsi
mov    $0x40,%edx
call   1040 <memcmp_const@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1886 <deoxys_aead_decrypt+0x6f6>
mov    -0x20(%rbp),%rdi
mov    0x18(%rbp),%rdx
xor    %esi,%esi
call   1050 <memset@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1898 <deoxys_aead_decrypt+0x708>
mov    0x18(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x350,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deoxys_aead_decrypt>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x238,%rsp
mov    %r9,%r12
mov    %r8,%rbx
mov    %rcx,0x60(%rsp)
mov    %rdx,0x10(%rsp)
mov    %rsi,0x68(%rsp)
mov    %rdi,0x8(%rsp)
mov    0x270(%rsp),%rax
mov    0x278(%rsp),%rbp
lea    (%rax,%rbp,4),%rsi
add    $0xffffffffffffffc0,%rsi
lea    0xf0(%rsp),%rdi
mov    $0x10,%edx
call   1070 <memcpy@plt>
add    $0xfffffffffffffff0,%rbp
mov    %rbp,(%rsp)
lea    0x20(%rsp),%r14
xor    %r15d,%r15d
mov    $0x40,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
lea    0x170(%rsp),%rbp
mov    $0x10,%edx
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1070 <memcpy@plt>
lea    0xb0(%rsp),%r13
mov    $0x10,%edx
mov    %r13,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1090 <set_block_number_in_tweak@plt>
lea    0x40(%rsp),%rdi
xor    %esi,%esi
call   1090 <set_block_number_in_tweak@plt>
mov    %r14,%rdi
mov    $0x30,%esi
call   1030 <set_stage_in_tweak@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
call   1080 <set_tweak_in_tweakey@plt>
lea    0x70(%rsp),%rbx
mov    $0x100,%edi
mov    %r12,%rsi
mov    %rbp,%rdx
mov    %rbx,%rcx
call   1060 <aesTweakEncrypt@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   10a0 <xor_values@plt>
mov    %r14,%rdi
mov    $0x70,%esi
call   1030 <set_stage_in_tweak@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
call   1080 <set_tweak_in_tweakey@plt>
mov    $0x100,%edi
mov    %r12,0x18(%rsp)
mov    %r12,%rsi
mov    %rbp,%rdx
mov    %rbx,%rcx
call   1060 <aesTweakEncrypt@plt>
mov    %r13,%rdi
mov    0x68(%rsp),%r13
mov    %rbx,%rsi
call   10a0 <xor_values@plt>
test   %r13,%r13
je     13fc <deoxys_aead_decrypt+0x26c>
lea    0x20(%rsp),%rdi
mov    $0x20,%esi
call   1030 <set_stage_in_tweak@plt>
cmp    $0x10,%r13
lea    0x40(%rsp),%r14
jb     1359 <deoxys_aead_decrypt+0x1c9>
xor    %r15d,%r15d
lea    0x170(%rsp),%rbx
lea    0x70(%rsp),%r12
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15d,%esi
call   1090 <set_block_number_in_tweak@plt>
mov    %rbx,%rdi
lea    0x20(%rsp),%rsi
call   1080 <set_tweak_in_tweakey@plt>
mov    %ebp,%eax
and    $0xfffffff0,%eax
mov    0x8(%rsp),%rcx
lea    (%rcx,%rax,4),%rsi
mov    $0x100,%edi
mov    %rbx,%rdx
mov    %r12,%rcx
call   1060 <aesTweakEncrypt@plt>
lea    0xb0(%rsp),%rdi
mov    %r12,%rsi
call   10a0 <xor_values@plt>
lea    0x20(%rbp),%eax
and    $0xfffffff0,%eax
add    $0x10,%rbp
add    $0x1,%r15d
cmp    %r13,%rax
jbe    1300 <deoxys_aead_decrypt+0x170>
mov    %r15d,%ebx
shl    $0x4,%ebx
cmp    %r13,%rbx
jae    13fc <deoxys_aead_decrypt+0x26c>
lea    0x130(%rsp),%r14
mov    $0x10,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
mov    0x8(%rsp),%rax
lea    (%rax,%rbx,4),%rsi
sub    %rbx,%r13
mov    %r14,%rdi
mov    %r13,%rdx
call   1070 <memcpy@plt>
movl   $0x80,0x130(%rsp,%r13,4)
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x60,%esi
call   1030 <set_stage_in_tweak@plt>
lea    0x40(%rsp),%rdi
mov    %r15d,%esi
call   1090 <set_block_number_in_tweak@plt>
lea    0x170(%rsp),%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1080 <set_tweak_in_tweakey@plt>
lea    0x70(%rsp),%rbp
mov    $0x100,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
call   1060 <aesTweakEncrypt@plt>
lea    0xb0(%rsp),%rdi
mov    %rbp,%rsi
call   10a0 <xor_values@plt>
lea    0x20(%rsp),%rdi
lea    0xf0(%rsp),%rbx
mov    $0x10,%edx
mov    %rbx,%rsi
call   1070 <memcpy@plt>
movzbl 0x20(%rsp),%eax
or     $0x80,%eax
mov    %eax,0x20(%rsp)
mov    %rbx,%rdi
call   10b0 <get_block_number_from_tag@plt>
mov    %eax,%ebx
lea    0x110(%rsp),%rdi
call   10b0 <get_block_number_from_tag@plt>
mov    %eax,%r13d
mov    (%rsp),%rcx
cmp    $0x10,%rcx
jae    1459 <deoxys_aead_decrypt+0x2c9>
xor    %r12d,%r12d
cmp    %r12,%rcx
ja     1521 <deoxys_aead_decrypt+0x391>
jmp    15d3 <deoxys_aead_decrypt+0x443>
mov    %ebx,0x8(%rsp)
xor    %r12d,%r12d
lea    0x20(%rsp),%r15
jmp    148d <deoxys_aead_decrypt+0x2fd>
nopw   0x0(%rax,%rax,1)
mov    (%rsp),%rcx
lea    0x20(%r12),%eax
and    $0xfffffff0,%eax
add    $0x10,%r12
add    $0x1,%r13d
cmp    %rax,%rcx
jb     1514 <deoxys_aead_decrypt+0x384>
lea    0x40(%rsp),%rdi
mov    %r13d,%esi
call   1090 <set_block_number_in_tweak@plt>
lea    0x170(%rsp),%r14
mov    %r14,%rdi
mov    %r15,%rsi
call   1080 <set_tweak_in_tweakey@plt>
mov    %r12d,%ebx
and    $0xfffffff0,%ebx
shl    $0x2,%rbx
mov    0x10(%rsp),%rax
lea    (%rax,%rbx,1),%rbp
mov    $0x100,%edi
mov    0x18(%rsp),%rsi
mov    %r14,%rdx
mov    %rbp,%rcx
call   1060 <aesTweakEncrypt@plt>
add    0x270(%rsp),%rbx
mov    %rbp,%rdi
mov    %rbx,%rsi
call   10a0 <xor_values@plt>
cmp    $0xffffffff,%r13d
jne    1470 <deoxys_aead_decrypt+0x2e0>
mov    0x8(%rsp),%esi
add    $0x1,%esi
mov    %r15,%rdi
mov    %esi,0x8(%rsp)
call   1090 <set_block_number_in_tweak@plt>
movzbl 0x20(%rsp),%eax
or     $0x80,%eax
mov    %eax,0x20(%rsp)
jmp    1470 <deoxys_aead_decrypt+0x2e0>
and    $0xfffffff0,%r12d
cmp    %r12,%rcx
jbe    15d3 <deoxys_aead_decrypt+0x443>
lea    0x40(%rsp),%rdi
mov    %r13d,%esi
call   1090 <set_block_number_in_tweak@plt>
lea    0x170(%rsp),%rbx
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1080 <set_tweak_in_tweakey@plt>
lea    0x70(%rsp),%rcx
mov    $0x100,%edi
mov    0x18(%rsp),%rsi
mov    %rbx,%rdx
call   1060 <aesTweakEncrypt@plt>
mov    (%rsp),%rsi
mov    %rsi,%rax
sub    %r12,%rax
je     15d3 <deoxys_aead_decrypt+0x443>
cmp    $0x8,%rax
jb     159b <deoxys_aead_decrypt+0x40b>
mov    0x10(%rsp),%r8
lea    (%r8,%r12,4),%rcx
mov    0x270(%rsp),%r9
lea    (%r9,%rsi,4),%rdx
cmp    %rdx,%rcx
jae    17b6 <deoxys_aead_decrypt+0x626>
lea    (%r8,%rsi,4),%rcx
lea    (%r9,%r12,4),%rdx
cmp    %rcx,%rdx
jae    17b6 <deoxys_aead_decrypt+0x626>
xor    %ecx,%ecx
mov    0x10(%rsp),%rdx
lea    (%rdx,%r12,4),%rdx
mov    0x270(%rsp),%rsi
lea    (%rsi,%r12,4),%rsi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x70(%rsp,%rcx,4),%edi
xor    (%rsi,%rcx,4),%edi
mov    %edi,(%rdx,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    15c0 <deoxys_aead_decrypt+0x430>
lea    0x20(%rsp),%rbx
xor    %ebp,%ebp
mov    $0x40,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <set_stage_in_tweak@plt>
mov    (%rsp),%rcx
cmp    $0x10,%rcx
mov    0x10(%rsp),%r12
lea    0x40(%rsp),%r14
jb     1676 <deoxys_aead_decrypt+0x4e6>
xor    %ebp,%ebp
lea    0x170(%rsp),%r15
lea    0x70(%rsp),%r13
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebp,%esi
call   1090 <set_block_number_in_tweak@plt>
mov    %r15,%rdi
lea    0x20(%rsp),%rsi
call   1080 <set_tweak_in_tweakey@plt>
mov    %ebx,%eax
and    $0xfffffff0,%eax
lea    (%r12,%rax,4),%rsi
mov    $0x100,%edi
mov    %r15,%rdx
mov    %r13,%rcx
call   1060 <aesTweakEncrypt@plt>
lea    0xb0(%rsp),%rdi
mov    %r13,%rsi
call   10a0 <xor_values@plt>
mov    (%rsp),%rcx
lea    0x20(%rbx),%eax
and    $0xfffffff0,%eax
add    $0x10,%rbx
add    $0x1,%ebp
cmp    %rax,%rcx
jae    1620 <deoxys_aead_decrypt+0x490>
mov    %ebp,%ebx
shl    $0x4,%ebx
mov    %rcx,%r15
sub    %rbx,%r15
mov    %r14,%r13
jbe    1713 <deoxys_aead_decrypt+0x583>
lea    0x130(%rsp),%r14
mov    $0x10,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
lea    (%r12,%rbx,4),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
call   1070 <memcpy@plt>
movl   $0x80,0x130(%rsp,%r15,4)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x40,%esi
call   1030 <set_stage_in_tweak@plt>
mov    %r13,%rdi
mov    %ebp,%esi
call   1090 <set_block_number_in_tweak@plt>
lea    0x170(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1080 <set_tweak_in_tweakey@plt>
lea    0x70(%rsp),%rbx
mov    $0x100,%edi
mov    %r14,%rsi
mov    %rbp,%rdx
mov    %rbx,%rcx
call   1060 <aesTweakEncrypt@plt>
lea    0xb0(%rsp),%rdi
mov    %rbx,%rsi
call   10a0 <xor_values@plt>
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    $0x10,%esi
call   1030 <set_stage_in_tweak@plt>
xor    %r15d,%r15d
mov    %r13,%rdi
xor    %esi,%esi
call   1090 <set_block_number_in_tweak@plt>
lea    0x170(%rsp),%rbp
mov    %rbp,%rdi
mov    %r14,%rsi
call   1080 <set_tweak_in_tweakey@plt>
lea    0xb0(%rsp),%rsi
lea    0x1f0(%rsp),%rbx
mov    $0x100,%edi
mov    %rbp,%rdx
mov    %rbx,%rcx
call   1060 <aesTweakEncrypt@plt>
lea    0xf0(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x40,%edx
call   1040 <memcmp_const@plt>
test   %rax,%rax
je     1795 <deoxys_aead_decrypt+0x605>
mov    %r12,%rdi
xor    %esi,%esi
mov    (%rsp),%rdx
call   1050 <memset@plt>
mov    $0xffffffff,%r15d
jmp    17a1 <deoxys_aead_decrypt+0x611>
mov    (%rsp),%rax
mov    0x60(%rsp),%rcx
mov    %rax,(%rcx)
mov    %r15d,%eax
add    $0x238,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rax,%rcx
and    $0xfffffffffffffff8,%rcx
lea    -0x8(%rcx),%rsi
mov    %rsi,%rdx
shr    $0x3,%rdx
add    $0x1,%rdx
test   %rsi,%rsi
je     1878 <deoxys_aead_decrypt+0x6e8>
mov    %rdx,%rdi
and    $0xfffffffffffffffe,%rdi
lea    (%r8,%r12,4),%rbp
add    $0x30,%rbp
lea    (%r9,%r12,4),%rbx
add    $0x30,%rbx
xor    %esi,%esi
xchg   %ax,%ax
movups -0x30(%rbx,%rsi,4),%xmm0
movups -0x20(%rbx,%rsi,4),%xmm1
xorps  0x70(%rsp,%rsi,4),%xmm0
xorps  0x80(%rsp,%rsi,4),%xmm1
movups %xmm0,-0x30(%rbp,%rsi,4)
movups %xmm1,-0x20(%rbp,%rsi,4)
movups -0x10(%rbx,%rsi,4),%xmm0
movups (%rbx,%rsi,4),%xmm1
xorps  0x90(%rsp,%rsi,4),%xmm0
xorps  0xa0(%rsp,%rsi,4),%xmm1
movups %xmm0,-0x10(%rbp,%rsi,4)
movups %xmm1,0x0(%rbp,%rsi,4)
add    $0x10,%rsi
add    $0xfffffffffffffffe,%rdi
jne    17f0 <deoxys_aead_decrypt+0x660>
test   $0x1,%dl
je     186a <deoxys_aead_decrypt+0x6da>
lea    (%rsi,%r12,1),%rdx
movups (%r9,%rdx,4),%xmm0
movups 0x10(%r9,%rdx,4),%xmm1
xorps  0x70(%rsp,%rsi,4),%xmm0
xorps  0x80(%rsp,%rsi,4),%xmm1
movups %xmm0,(%r8,%rdx,4)
movups %xmm1,0x10(%r8,%rdx,4)
cmp    %rcx,%rax
je     15d3 <deoxys_aead_decrypt+0x443>
jmp    159d <deoxys_aead_decrypt+0x40d>
xor    %esi,%esi
test   $0x1,%dl
jne    1843 <deoxys_aead_decrypt+0x6b3>
jmp    186a <deoxys_aead_decrypt+0x6da>

LLVM IR (-O0):
define i32 @deoxys_aead_decrypt(i32* %0, i64 %1, i32* %2, i64* %3, i32* %4, i32* %5, i32* %6, i64 %7) {
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i64
%12 = alloca i32*
%13 = alloca i64*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i64
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca [16 x i32]
%23 = alloca [32 x i32]
%24 = alloca [16 x i32]
%25 = alloca [16 x i32]
%26 = alloca [16 x i32]
%27 = alloca [16 x i32]
%28 = alloca [16 x i32]
%29 = alloca [16 x i32]
%30 = alloca [16 x i32]
%31 = alloca [16 x i32]
%32 = alloca [16 x i32]
store i32* %0, i32** %10
store i64 %1, i64* %11
store i32* %2, i32** %12
store i64* %3, i64** %13
store i32* %4, i32** %14
store i32* %5, i32** %15
store i32* %6, i32** %16
store i64 %7, i64* %17
%33 = getelementptr inbounds [16 x i32], [16 x i32]* %30, i64 0, i64 0
%34 = load i32*, i32** %16
%35 = load i64, i64* %17
%36 = getelementptr inbounds i32, i32* %34, i64 %35
%37 = getelementptr inbounds i32, i32* %36, i64 -16
%38 = call i32 @memcpy(i32* %33, i32* %37, i64 16)
%39 = load i64, i64* %17
%40 = sub i64 %39, 16
store i64 %40, i64* %17
%41 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%42 = call i32 @memset(i32* %41, i32 0, i64 64)
%43 = getelementptr inbounds [32 x i32], [32 x i32]* %23, i64 0, i64 0
%44 = load i32*, i32** %14
%45 = call i32 @memcpy(i32* %43, i32* %44, i64 16)
%46 = getelementptr inbounds [16 x i32], [16 x i32]* %24, i64 0, i64 0
%47 = call i32 @memset(i32* %46, i32 0, i64 16)
%48 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%49 = getelementptr inbounds i32, i32* %48, i64 0
%50 = call i32 @set_block_number_in_tweak(i32* %49, i32 0)
%51 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%52 = getelementptr inbounds i32, i32* %51, i64 8
%53 = call i32 @set_block_number_in_tweak(i32* %52, i32 0)
%54 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%55 = call i32 @set_stage_in_tweak(i32* %54, i32 48)
%56 = getelementptr inbounds [32 x i32], [32 x i32]* %23, i64 0, i64 0
%57 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%58 = call i32 @set_tweak_in_tweakey(i32* %56, i32* %57)
%59 = load i32*, i32** %15
%60 = getelementptr inbounds [32 x i32], [32 x i32]* %23, i64 0, i64 0
%61 = getelementptr inbounds [16 x i32], [16 x i32]* %32, i64 0, i64 0
%62 = call i32 @aesTweakEncrypt(i32 256, i32* %59, i32* %60, i32* %61)
%63 = getelementptr inbounds [16 x i32], [16 x i32]* %24, i64 0, i64 0
%64 = getelementptr inbounds [16 x i32], [16 x i32]* %32, i64 0, i64 0
%65 = call i32 @xor_values(i32* %63, i32* %64)
%66 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%67 = call i32 @set_stage_in_tweak(i32* %66, i32 112)
%68 = getelementptr inbounds [32 x i32], [32 x i32]* %23, i64 0, i64 0
%69 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%70 = call i32 @set_tweak_in_tweakey(i32* %68, i32* %69)
%71 = load i32*, i32** %15
%72 = getelementptr inbounds [32 x i32], [32 x i32]* %23, i64 0, i64 0
%73 = getelementptr inbounds [16 x i32], [16 x i32]* %32, i64 0, i64 0
%74 = call i32 @aesTweakEncrypt(i32 256, i32* %71, i32* %72, i32* %73)
%75 = getelementptr inbounds [16 x i32], [16 x i32]* %24, i64 0, i64 0
%76 = getelementptr inbounds [16 x i32], [16 x i32]* %32, i64 0, i64 0
%77 = call i32 @xor_values(i32* %75, i32* %76)
%78 = load i64, i64* %11
%79 = icmp ne i64 %78, 0
br i1 %79, label %80, label %155
80: ; preds = %8
%81 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%82 = call i32 @set_stage_in_tweak(i32* %81, i32 32)
store i32 0, i32* %18
br label %83
83: ; preds = %90, %80
%84 = load i32, i32* %18
%85 = add nsw i32 %84, 1
%86 = mul nsw i32 16, %85
%87 = sext i32 %86 to i64
%88 = load i64, i64* %11
%89 = icmp ule i64 %87, %88
br i1 %89, label %90, label %111
90: ; preds = %83
%91 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%92 = getelementptr inbounds i32, i32* %91, i64 8
%93 = load i32, i32* %18
%94 = call i32 @set_block_number_in_tweak(i32* %92, i32 %93)
%95 = getelementptr inbounds [32 x i32], [32 x i32]* %23, i64 0, i64 0
%96 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%97 = call i32 @set_tweak_in_tweakey(i32* %95, i32* %96)
%98 = load i32*, i32** %10
%99 = load i32, i32* %18
%100 = mul nsw i32 16, %99
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i32, i32* %98, i64 %101
%103 = getelementptr inbounds [32 x i32], [32 x i32]* %23, i64 0, i64 0
%104 = getelementptr inbounds [16 x i32], [16 x i32]* %32, i64 0, i64 0
%105 = call i32 @aesTweakEncrypt(i32 256, i32* %102, i32* %103, i32* %104)
%106 = getelementptr inbounds [16 x i32], [16 x i32]* %24, i64 0, i64 0
%107 = getelementptr inbounds [16 x i32], [16 x i32]* %32, i64 0, i64 0
%108 = call i32 @xor_values(i32* %106, i32* %107)
%109 = load i32, i32* %18
%110 = add nsw i32 %109, 1
store i32 %110, i32* %18
br label %83
111: ; preds = %83
%112 = load i64, i64* %11
%113 = load i32, i32* %18
%114 = mul nsw i32 16, %113
%115 = sext i32 %114 to i64
%116 = icmp ugt i64 %112, %115
br i1 %116, label %117, label %154
117: ; preds = %111
%118 = getelementptr inbounds [16 x i32], [16 x i32]* %25, i64 0, i64 0
%119 = call i32 @memset(i32* %118, i32 0, i64 16)
%120 = getelementptr inbounds [16 x i32], [16 x i32]* %25, i64 0, i64 0
%121 = load i32*, i32** %10
%122 = load i32, i32* %18
%123 = mul nsw i32 16, %122
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds i32, i32* %121, i64 %124
%126 = load i64, i64* %11
%127 = load i32, i32* %18
%128 = mul nsw i32 16, %127
%129 = sext i32 %128 to i64
%130 = sub i64 %126, %129
%131 = call i32 @memcpy(i32* %120, i32* %125, i64 %130)
%132 = load i64, i64* %11
%133 = load i32, i32* %18
%134 = mul nsw i32 16, %133
%135 = sext i32 %134 to i64
%136 = sub i64 %132, %135
%137 = getelementptr inbounds [16 x i32], [16 x i32]* %25, i64 0, i64 %136
store i32 128, i32* %137
%138 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%139 = call i32 @set_stage_in_tweak(i32* %138, i32 96)
%140 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%141 = getelementptr inbounds i32, i32* %140, i64 8
%142 = load i32, i32* %18
%143 = call i32 @set_block_number_in_tweak(i32* %141, i32 %142)
%144 = getelementptr inbounds [32 x i32], [32 x i32]* %23, i64 0, i64 0
%145 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%146 = call i32 @set_tweak_in_tweakey(i32* %144, i32* %145)
%147 = getelementptr inbounds [16 x i32], [16 x i32]* %25, i64 0, i64 0
%148 = getelementptr inbounds [32 x i32], [32 x i32]* %23, i64 0, i64 0
%149 = getelementptr inbounds [16 x i32], [16 x i32]* %32, i64 0, i64 0
%150 = call i32 @aesTweakEncrypt(i32 256, i32* %147, i32* %148, i32* %149)
%151 = getelementptr inbounds [16 x i32], [16 x i32]* %24, i64 0, i64 0
%152 = getelementptr inbounds [16 x i32], [16 x i32]* %32, i64 0, i64 0
%153 = call i32 @xor_values(i32* %151, i32* %152)
br label %154
154: ; preds = %117, %111
br label %155
155: ; preds = %154, %8
%156 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%157 = getelementptr inbounds [16 x i32], [16 x i32]* %30, i64 0, i64 0
%158 = call i32 @memcpy(i32* %156, i32* %157, i64 16)
%159 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%160 = load i32, i32* %159
%161 = and i32 %160, 127
%162 = xor i32 128, %161
%163 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
store i32 %162, i32* %163
store i32 0, i32* %18
%164 = getelementptr inbounds [16 x i32], [16 x i32]* %30, i64 0, i64 0
%165 = getelementptr inbounds i32, i32* %164, i64 0
%166 = call i32 @get_block_number_from_tag(i32* %165)
store i32 %166, i32* %20
%167 = getelementptr inbounds [16 x i32], [16 x i32]* %30, i64 0, i64 0
%168 = getelementptr inbounds i32, i32* %167, i64 8
%169 = call i32 @get_block_number_from_tag(i32* %168)
store i32 %169, i32* %21
br label %170
170: ; preds = %221, %155
%171 = load i32, i32* %18
%172 = add nsw i32 %171, 1
%173 = mul nsw i32 16, %172
%174 = sext i32 %173 to i64
%175 = load i64, i64* %17
%176 = icmp ule i64 %174, %175
br i1 %176, label %177, label %222
177: ; preds = %170
%178 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%179 = getelementptr inbounds i32, i32* %178, i64 8
%180 = load i32, i32* %21
%181 = call i32 @set_block_number_in_tweak(i32* %179, i32 %180)
%182 = getelementptr inbounds [32 x i32], [32 x i32]* %23, i64 0, i64 0
%183 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%184 = call i32 @set_tweak_in_tweakey(i32* %182, i32* %183)
%185 = load i32*, i32** %15
%186 = getelementptr inbounds [32 x i32], [32 x i32]* %23, i64 0, i64 0
%187 = load i32*, i32** %12
%188 = load i32, i32* %18
%189 = mul nsw i32 16, %188
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds i32, i32* %187, i64 %190
%192 = call i32 @aesTweakEncrypt(i32 256, i32* %185, i32* %186, i32* %191)
%193 = load i32*, i32** %12
%194 = load i32, i32* %18
%195 = mul nsw i32 16, %194
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds i32, i32* %193, i64 %196
%198 = load i32*, i32** %16
%199 = load i32, i32* %18
%200 = mul nsw i32 16, %199
%201 = sext i32 %200 to i64
%202 = getelementptr inbounds i32, i32* %198, i64 %201
%203 = call i32 @xor_values(i32* %197, i32* %202)
%204 = load i32, i32* %18
%205 = add nsw i32 %204, 1
store i32 %205, i32* %18
%206 = load i32, i32* %21
%207 = add nsw i32 %206, 1
store i32 %207, i32* %21
%208 = load i32, i32* %21
%209 = icmp eq i32 %208, 0
br i1 %209, label %210, label %221
210: ; preds = %177
%211 = load i32, i32* %20
%212 = add nsw i32 %211, 1
store i32 %212, i32* %20
%213 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%214 = load i32, i32* %20
%215 = call i32 @set_block_number_in_tweak(i32* %213, i32 %214)
%216 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%217 = load i32, i32* %216
%218 = and i32 %217, 127
%219 = xor i32 128, %218
%220 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
store i32 %219, i32* %220
br label %221
221: ; preds = %210, %177
br label %170
222: ; preds = %170
%223 = load i64, i64* %17
%224 = load i32, i32* %18
%225 = mul nsw i32 16, %224
%226 = sext i32 %225 to i64
%227 = icmp ugt i64 %223, %226
br i1 %227, label %228, label %274
228: ; preds = %222
%229 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%230 = getelementptr inbounds i32, i32* %229, i64 8
%231 = load i32, i32* %21
%232 = call i32 @set_block_number_in_tweak(i32* %230, i32 %231)
%233 = getelementptr inbounds [32 x i32], [32 x i32]* %23, i64 0, i64 0
%234 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%235 = call i32 @set_tweak_in_tweakey(i32* %233, i32* %234)
%236 = load i32*, i32** %15
%237 = getelementptr inbounds [32 x i32], [32 x i32]* %23, i64 0, i64 0
%238 = getelementptr inbounds [16 x i32], [16 x i32]* %32, i64 0, i64 0
%239 = call i32 @aesTweakEncrypt(i32 256, i32* %236, i32* %237, i32* %238)
store i32 0, i32* %19
br label %240
240: ; preds = %270, %228
%241 = load i32, i32* %19
%242 = sext i32 %241 to i64
%243 = load i64, i64* %17
%244 = load i32, i32* %18
%245 = mul nsw i32 16, %244
%246 = sext i32 %245 to i64
%247 = sub i64 %243, %246
%248 = icmp ult i64 %242, %247
br i1 %248, label %249, label %273
249: ; preds = %240
%250 = load i32*, i32** %16
%251 = load i32, i32* %18
%252 = mul nsw i32 16, %251
%253 = load i32, i32* %19
%254 = add nsw i32 %252, %253
%255 = sext i32 %254 to i64
%256 = getelementptr inbounds i32, i32* %250, i64 %255
%257 = load i32, i32* %256
%258 = load i32, i32* %19
%259 = sext i32 %258 to i64
%260 = getelementptr inbounds [16 x i32], [16 x i32]* %32, i64 0, i64 %259
%261 = load i32, i32* %260
%262 = xor i32 %257, %261
%263 = load i32*, i32** %12
%264 = load i32, i32* %18
%265 = mul nsw i32 16, %264
%266 = load i32, i32* %19
%267 = add nsw i32 %265, %266
%268 = sext i32 %267 to i64
%269 = getelementptr inbounds i32, i32* %263, i64 %268
store i32 %262, i32* %269
br label %270
270: ; preds = %249
%271 = load i32, i32* %19
%272 = add nsw i32 %271, 1
store i32 %272, i32* %19
br label %240
273: ; preds = %240
br label %274
274: ; preds = %273, %222
%275 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%276 = call i32 @memset(i32* %275, i32 0, i64 64)
%277 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%278 = call i32 @set_stage_in_tweak(i32* %277, i32 0)
store i32 0, i32* %18
br label %279
279: ; preds = %286, %274
%280 = load i32, i32* %18
%281 = add nsw i32 %280, 1
%282 = mul nsw i32 16, %281
%283 = sext i32 %282 to i64
%284 = load i64, i64* %17
%285 = icmp ule i64 %283, %284
br i1 %285, label %286, label %307
286: ; preds = %279
%287 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%288 = getelementptr inbounds i32, i32* %287, i64 8
%289 = load i32, i32* %18
%290 = call i32 @set_block_number_in_tweak(i32* %288, i32 %289)
%291 = getelementptr inbounds [32 x i32], [32 x i32]* %23, i64 0, i64 0
%292 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%293 = call i32 @set_tweak_in_tweakey(i32* %291, i32* %292)
%294 = load i32*, i32** %12
%295 = load i32, i32* %18
%296 = mul nsw i32 16, %295
%297 = sext i32 %296 to i64
%298 = getelementptr inbounds i32, i32* %294, i64 %297
%299 = getelementptr inbounds [32 x i32], [32 x i32]* %23, i64 0, i64 0
%300 = getelementptr inbounds [16 x i32], [16 x i32]* %32, i64 0, i64 0
%301 = call i32 @aesTweakEncrypt(i32 256, i32* %298, i32* %299, i32* %300)
%302 = getelementptr inbounds [16 x i32], [16 x i32]* %24, i64 0, i64 0
%303 = getelementptr inbounds [16 x i32], [16 x i32]* %32, i64 0, i64 0
%304 = call i32 @xor_values(i32* %302, i32* %303)
%305 = load i32, i32* %18
%306 = add nsw i32 %305, 1
store i32 %306, i32* %18
br label %279
307: ; preds = %279
%308 = load i64, i64* %17
%309 = load i32, i32* %18
%310 = mul nsw i32 16, %309
%311 = sext i32 %310 to i64
%312 = icmp ugt i64 %308, %311
br i1 %312, label %313, label %350
313: ; preds = %307
%314 = getelementptr inbounds [16 x i32], [16 x i32]* %25, i64 0, i64 0
%315 = call i32 @memset(i32* %314, i32 0, i64 16)
%316 = getelementptr inbounds [16 x i32], [16 x i32]* %25, i64 0, i64 0
%317 = load i32*, i32** %12
%318 = load i32, i32* %18
%319 = mul nsw i32 16, %318
%320 = sext i32 %319 to i64
%321 = getelementptr inbounds i32, i32* %317, i64 %320
%322 = load i64, i64* %17
%323 = load i32, i32* %18
%324 = mul nsw i32 16, %323
%325 = sext i32 %324 to i64
%326 = sub i64 %322, %325
%327 = call i32 @memcpy(i32* %316, i32* %321, i64 %326)
%328 = load i64, i64* %17
%329 = load i32, i32* %18
%330 = mul nsw i32 16, %329
%331 = sext i32 %330 to i64
%332 = sub i64 %328, %331
%333 = getelementptr inbounds [16 x i32], [16 x i32]* %25, i64 0, i64 %332
store i32 128, i32* %333
%334 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%335 = call i32 @set_stage_in_tweak(i32* %334, i32 64)
%336 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%337 = getelementptr inbounds i32, i32* %336, i64 8
%338 = load i32, i32* %18
%339 = call i32 @set_block_number_in_tweak(i32* %337, i32 %338)
%340 = getelementptr inbounds [32 x i32], [32 x i32]* %23, i64 0, i64 0
%341 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%342 = call i32 @set_tweak_in_tweakey(i32* %340, i32* %341)
%343 = getelementptr inbounds [16 x i32], [16 x i32]* %25, i64 0, i64 0
%344 = getelementptr inbounds [32 x i32], [32 x i32]* %23, i64 0, i64 0
%345 = getelementptr inbounds [16 x i32], [16 x i32]* %32, i64 0, i64 0
%346 = call i32 @aesTweakEncrypt(i32 256, i32* %343, i32* %344, i32* %345)
%347 = getelementptr inbounds [16 x i32], [16 x i32]* %24, i64 0, i64 0
%348 = getelementptr inbounds [16 x i32], [16 x i32]* %32, i64 0, i64 0
%349 = call i32 @xor_values(i32* %347, i32* %348)
br label %350
350: ; preds = %313, %307
%351 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%352 = call i32 @set_stage_in_tweak(i32* %351, i32 16)
%353 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%354 = getelementptr inbounds i32, i32* %353, i64 8
%355 = call i32 @set_block_number_in_tweak(i32* %354, i32 0)
%356 = getelementptr inbounds [32 x i32], [32 x i32]* %23, i64 0, i64 0
%357 = getelementptr inbounds [16 x i32], [16 x i32]* %22, i64 0, i64 0
%358 = call i32 @set_tweak_in_tweakey(i32* %356, i32* %357)
%359 = getelementptr inbounds [16 x i32], [16 x i32]* %24, i64 0, i64 0
%360 = getelementptr inbounds [32 x i32], [32 x i32]* %23, i64 0, i64 0
%361 = getelementptr inbounds [16 x i32], [16 x i32]* %31, i64 0, i64 0
%362 = call i32 @aesTweakEncrypt(i32 256, i32* %359, i32* %360, i32* %361)
%363 = getelementptr inbounds [16 x i32], [16 x i32]* %30, i64 0, i64 0
%364 = getelementptr inbounds [16 x i32], [16 x i32]* %31, i64 0, i64 0
%365 = call i64 @memcmp_const(i32* %363, i32* %364, i32 64)
%366 = icmp ne i64 0, %365
br i1 %366, label %367, label %371
367: ; preds = %350
%368 = load i32*, i32** %12
%369 = load i64, i64* %17
%370 = call i32 @memset(i32* %368, i32 0, i64 %369)
store i32 -1, i32* %9
br label %374
371: ; preds = %350
%372 = load i64, i64* %17
%373 = load i64*, i64** %13
store i64 %372, i64* %373
store i32 0, i32* %9
br label %374
374: ; preds = %371, %367
%375 = load i32, i32* %9
ret i32 %375
}

LLVM IR (-O2):
define i32 @deoxys_aead_decrypt(i32* %0, i64 %1, i32* %2, i64* nocapture writeonly %3, i32* %4, i32* %5, i32* %6, i64 %7) {
%9 = alloca [16 x i32]
%10 = alloca [32 x i32]
%11 = alloca [16 x i32]
%12 = alloca [16 x i32]
%13 = alloca [16 x i32]
%14 = alloca [16 x i32]
%15 = alloca [16 x i32]
%16 = bitcast [16 x i32]* %9 to i8*
%17 = bitcast [32 x i32]* %10 to i8*
%18 = bitcast [16 x i32]* %11 to i8*
%19 = bitcast [16 x i32]* %12 to i8*
%20 = bitcast [16 x i32]* %13 to i8*
%21 = bitcast [16 x i32]* %14 to i8*
%22 = bitcast [16 x i32]* %15 to i8*
%23 = getelementptr inbounds [16 x i32], [16 x i32]* %13, i64 0, i64 0
%24 = getelementptr inbounds i32, i32* %6, i64 %7
%25 = getelementptr inbounds i32, i32* %24, i64 -16
%26 = call i32 @memcpy(i32* %23, i32* %25, i64 16)
%27 = add i64 %7, -16
%28 = getelementptr inbounds [16 x i32], [16 x i32]* %9, i64 0, i64 0
%29 = call i32 @memset(i32* %28, i32 0, i64 64)
%30 = getelementptr inbounds [32 x i32], [32 x i32]* %10, i64 0, i64 0
%31 = call i32 @memcpy(i32* %30, i32* %4, i64 16)
%32 = getelementptr inbounds [16 x i32], [16 x i32]* %11, i64 0, i64 0
%33 = call i32 @memset(i32* %32, i32 0, i64 16)
%34 = call i32 @set_block_number_in_tweak(i32* %28, i32 0)
%35 = getelementptr inbounds [16 x i32], [16 x i32]* %9, i64 0, i64 8
%36 = call i32 @set_block_number_in_tweak(i32* %35, i32 0)
%37 = call i32 @set_stage_in_tweak(i32* %28, i32 48)
%38 = call i32 @set_tweak_in_tweakey(i32* %30, i32* %28)
%39 = getelementptr inbounds [16 x i32], [16 x i32]* %15, i64 0, i64 0
%40 = call i32 @aesTweakEncrypt(i32 256, i32* %5, i32* %30, i32* %39)
%41 = call i32 @xor_values(i32* %32, i32* %39)
%42 = call i32 @set_stage_in_tweak(i32* %28, i32 112)
%43 = call i32 @set_tweak_in_tweakey(i32* %30, i32* %28)
%44 = call i32 @aesTweakEncrypt(i32 256, i32* %5, i32* %30, i32* %39)
%45 = call i32 @xor_values(i32* %32, i32* %39)
%46 = icmp eq i64 %1, 0
br i1 %46, label %85, label %47
47: ; preds = %8
%48 = call i32 @set_stage_in_tweak(i32* %28, i32 32)
%49 = icmp ult i64 %1, 16
br i1 %49, label %68, label %50
50: ; preds = %47, %50
%51 = phi i64 [ %53, %50 ], [ 0, %47 ]
%52 = phi i64 [ %62, %50 ], [ 1, %47 ]
%53 = add nuw nsw i64 %51, 1
%54 = trunc i64 %51 to i32
%55 = call i32 @set_block_number_in_tweak(i32* %35, i32 %54)
%56 = call i32 @set_tweak_in_tweakey(i32* %30, i32* %28)
%57 = shl i64 %51, 4
%58 = and i64 %57, 4294967280
%59 = getelementptr inbounds i32, i32* %0, i64 %58
%60 = call i32 @aesTweakEncrypt(i32 256, i32* %59, i32* %30, i32* %39)
%61 = call i32 @xor_values(i32* %32, i32* %39)
%62 = add nuw i64 %52, 1
%63 = shl i64 %62, 4
%64 = and i64 %63, 4294967280
%65 = icmp ugt i64 %64, %1
br i1 %65, label %66, label %50
66: ; preds = %50
%67 = trunc i64 %52 to i32
br label %68
68: ; preds = %66, %47
%69 = phi i32 [ 0, %47 ], [ %67, %66 ]
%70 = shl nsw i32 %69, 4
%71 = zext i32 %70 to i64
%72 = icmp ult i64 %71, %1
br i1 %72, label %73, label %85
73: ; preds = %68
%74 = getelementptr inbounds [16 x i32], [16 x i32]* %12, i64 0, i64 0
%75 = call i32 @memset(i32* %74, i32 0, i64 16)
%76 = getelementptr inbounds i32, i32* %0, i64 %71
%77 = sub i64 %1, %71
%78 = call i32 @memcpy(i32* %74, i32* %76, i64 %77)
%79 = getelementptr inbounds [16 x i32], [16 x i32]* %12, i64 0, i64 %77
store i32 128, i32* %79
%80 = call i32 @set_stage_in_tweak(i32* %28, i32 96)
%81 = call i32 @set_block_number_in_tweak(i32* %35, i32 %69)
%82 = call i32 @set_tweak_in_tweakey(i32* %30, i32* %28)
%83 = call i32 @aesTweakEncrypt(i32 256, i32* %74, i32* %30, i32* %39)
%84 = call i32 @xor_values(i32* %32, i32* %39)
br label %85
85: ; preds = %68, %73, %8
%86 = call i32 @memcpy(i32* %28, i32* %23, i64 16)
%87 = load i32, i32* %28
%88 = and i32 %87, 127
%89 = or i32 %88, 128
store i32 %89, i32* %28
%90 = call i32 @get_block_number_from_tag(i32* %23)
%91 = getelementptr inbounds [16 x i32], [16 x i32]* %13, i64 0, i64 8
%92 = call i32 @get_block_number_from_tag(i32* %91)
%93 = icmp ult i64 %27, 16
br i1 %93, label %125, label %94
94: ; preds = %85, %116
%95 = phi i64 [ %99, %116 ], [ 0, %85 ]
%96 = phi i64 [ %118, %116 ], [ 1, %85 ]
%97 = phi i32 [ %108, %116 ], [ %92, %85 ]
%98 = phi i32 [ %117, %116 ], [ %90, %85 ]
%99 = add nuw nsw i64 %95, 1
%100 = call i32 @set_block_number_in_tweak(i32* %35, i32 %97)
%101 = call i32 @set_tweak_in_tweakey(i32* %30, i32* %28)
%102 = shl i64 %95, 4
%103 = and i64 %102, 4294967280
%104 = getelementptr inbounds i32, i32* %2, i64 %103
%105 = call i32 @aesTweakEncrypt(i32 256, i32* %5, i32* %30, i32* %104)
%106 = getelementptr inbounds i32, i32* %6, i64 %103
%107 = call i32 @xor_values(i32* %104, i32* %106)
%108 = add nsw i32 %97, 1
%109 = icmp eq i32 %108, 0
br i1 %109, label %110, label %116
110: ; preds = %94
%111 = add nsw i32 %98, 1
%112 = call i32 @set_block_number_in_tweak(i32* %28, i32 %111)
%113 = load i32, i32* %28
%114 = and i32 %113, 127
%115 = or i32 %114, 128
store i32 %115, i32* %28
br label %116
116: ; preds = %110, %94
%117 = phi i32 [ %111, %110 ], [ %98, %94 ]
%118 = add nuw i64 %96, 1
%119 = shl i64 %118, 4
%120 = and i64 %119, 4294967280
%121 = icmp ult i64 %27, %120
br i1 %121, label %122, label %94
122: ; preds = %116
%123 = shl i64 %96, 4
%124 = and i64 %123, 4294967280
br label %125
125: ; preds = %122, %85
%126 = phi i32 [ %92, %85 ], [ %108, %122 ]
%127 = phi i64 [ 0, %85 ], [ %124, %122 ]
%128 = icmp ugt i64 %27, %127
br i1 %128, label %129, label %237
129: ; preds = %125
%130 = call i32 @set_block_number_in_tweak(i32* %35, i32 %126)
%131 = call i32 @set_tweak_in_tweakey(i32* %30, i32* %28)
%132 = call i32 @aesTweakEncrypt(i32 256, i32* %5, i32* %30, i32* %39)
%133 = sub i64 %27, %127
%134 = icmp eq i64 %133, 0
br i1 %134, label %237, label %135
135: ; preds = %129
%136 = icmp ult i64 %133, 8
br i1 %136, label %224, label %137
137: ; preds = %135
%138 = getelementptr i32, i32* %2, i64 %127
%139 = getelementptr i32, i32* %2, i64 %27
%140 = getelementptr i32, i32* %6, i64 %127
%141 = getelementptr i32, i32* %6, i64 %27
%142 = icmp ult i32* %138, %141
%143 = icmp ult i32* %140, %139
%144 = and i1 %142, %143
br i1 %144, label %224, label %145
145: ; preds = %137
%146 = and i64 %133, -8
%147 = add i64 %146, -8
%148 = lshr exact i64 %147, 3
%149 = add nuw nsw i64 %148, 1
%150 = and i64 %149, 1
%151 = icmp eq i64 %147, 0
br i1 %151, label %199, label %152
152: ; preds = %145
%153 = and i64 %149, 4611686018427387902
br label %154
154: ; preds = %154, %152
%155 = phi i64 [ 0, %152 ], [ %196, %154 ]
%156 = phi i64 [ 0, %152 ], [ %197, %154 ]
%157 = add nuw nsw i64 %155, %127
%158 = getelementptr inbounds i32, i32* %6, i64 %157
%159 = bitcast i32* %158 to <4 x i32>*
%160 = load <4 x i32>, <4 x i32>* %159
%161 = getelementptr inbounds i32, i32* %158, i64 4
%162 = bitcast i32* %161 to <4 x i32>*
%163 = load <4 x i32>, <4 x i32>* %162
%164 = getelementptr inbounds [16 x i32], [16 x i32]* %15, i64 0, i64 %155
%165 = bitcast i32* %164 to <4 x i32>*
%166 = load <4 x i32>, <4 x i32>* %165
%167 = getelementptr inbounds i32, i32* %164, i64 4
%168 = bitcast i32* %167 to <4 x i32>*
%169 = load <4 x i32>, <4 x i32>* %168
%170 = xor <4 x i32> %166, %160
%171 = xor <4 x i32> %169, %163
%172 = getelementptr inbounds i32, i32* %2, i64 %157
%173 = bitcast i32* %172 to <4 x i32>*
store <4 x i32> %170, <4 x i32>* %173
%174 = getelementptr inbounds i32, i32* %172, i64 4
%175 = bitcast i32* %174 to <4 x i32>*
store <4 x i32> %171, <4 x i32>* %175
%176 = or i64 %155, 8
%177 = add nuw nsw i64 %176, %127
%178 = getelementptr inbounds i32, i32* %6, i64 %177
%179 = bitcast i32* %178 to <4 x i32>*
%180 = load <4 x i32>, <4 x i32>* %179
%181 = getelementptr inbounds i32, i32* %178, i64 4
%182 = bitcast i32* %181 to <4 x i32>*
%183 = load <4 x i32>, <4 x i32>* %182
%184 = getelementptr inbounds [16 x i32], [16 x i32]* %15, i64 0, i64 %176
%185 = bitcast i32* %184 to <4 x i32>*
%186 = load <4 x i32>, <4 x i32>* %185
%187 = getelementptr inbounds i32, i32* %184, i64 4
%188 = bitcast i32* %187 to <4 x i32>*
%189 = load <4 x i32>, <4 x i32>* %188
%190 = xor <4 x i32> %186, %180
%191 = xor <4 x i32> %189, %183
%192 = getelementptr inbounds i32, i32* %2, i64 %177
%193 = bitcast i32* %192 to <4 x i32>*
store <4 x i32> %190, <4 x i32>* %193
%194 = getelementptr inbounds i32, i32* %192, i64 4
%195 = bitcast i32* %194 to <4 x i32>*
store <4 x i32> %191, <4 x i32>* %195
%196 = add nuw i64 %155, 16
%197 = add i64 %156, 2
%198 = icmp eq i64 %197, %153
br i1 %198, label %199, label %154
199: ; preds = %154, %145
%200 = phi i64 [ 0, %145 ], [ %196, %154 ]
%201 = icmp eq i64 %150, 0
br i1 %201, label %222, label %202
202: ; preds = %199
%203 = add nuw nsw i64 %200, %127
%204 = getelementptr inbounds i32, i32* %6, i64 %203
%205 = bitcast i32* %204 to <4 x i32>*
%206 = load <4 x i32>, <4 x i32>* %205
%207 = getelementptr inbounds i32, i32* %204, i64 4
%208 = bitcast i32* %207 to <4 x i32>*
%209 = load <4 x i32>, <4 x i32>* %208
%210 = getelementptr inbounds [16 x i32], [16 x i32]* %15, i64 0, i64 %200
%211 = bitcast i32* %210 to <4 x i32>*
%212 = load <4 x i32>, <4 x i32>* %211
%213 = getelementptr inbounds i32, i32* %210, i64 4
%214 = bitcast i32* %213 to <4 x i32>*
%215 = load <4 x i32>, <4 x i32>* %214
%216 = xor <4 x i32> %212, %206
%217 = xor <4 x i32> %215, %209
%218 = getelementptr inbounds i32, i32* %2, i64 %203
%219 = bitcast i32* %218 to <4 x i32>*
store <4 x i32> %216, <4 x i32>* %219
%220 = getelementptr inbounds i32, i32* %218, i64 4
%221 = bitcast i32* %220 to <4 x i32>*
store <4 x i32> %217, <4 x i32>* %221
br label %222
222: ; preds = %199, %202
%223 = icmp eq i64 %133, %146
br i1 %223, label %237, label %224
224: ; preds = %137, %135, %222
%225 = phi i64 [ 0, %137 ], [ 0, %135 ], [ %146, %222 ]
br label %226
226: ; preds = %224, %226
%227 = phi i64 [ %235, %226 ], [ %225, %224 ]
%228 = add nuw nsw i64 %227, %127
%229 = getelementptr inbounds i32, i32* %6, i64 %228
%230 = load i32, i32* %229
%231 = getelementptr inbounds [16 x i32], [16 x i32]* %15, i64 0, i64 %227
%232 = load i32, i32* %231
%233 = xor i32 %232, %230
%234 = getelementptr inbounds i32, i32* %2, i64 %228
store i32 %233, i32* %234
%235 = add nuw nsw i64 %227, 1
%236 = icmp eq i64 %235, %133
br i1 %236, label %237, label %226
237: ; preds = %226, %222, %129, %125
%238 = call i32 @memset(i32* %28, i32 0, i64 64)
%239 = call i32 @set_stage_in_tweak(i32* %28, i32 0)
br i1 %93, label %258, label %240
240: ; preds = %237, %240
%241 = phi i64 [ %243, %240 ], [ 0, %237 ]
%242 = phi i64 [ %252, %240 ], [ 1, %237 ]
%243 = add nuw nsw i64 %241, 1
%244 = trunc i64 %241 to i32
%245 = call i32 @set_block_number_in_tweak(i32* %35, i32 %244)
%246 = call i32 @set_tweak_in_tweakey(i32* %30, i32* %28)
%247 = shl i64 %241, 4
%248 = and i64 %247, 4294967280
%249 = getelementptr inbounds i32, i32* %2, i64 %248
%250 = call i32 @aesTweakEncrypt(i32 256, i32* %249, i32* %30, i32* %39)
%251 = call i32 @xor_values(i32* %32, i32* %39)
%252 = add nuw i64 %242, 1
%253 = shl i64 %252, 4
%254 = and i64 %253, 4294967280
%255 = icmp ult i64 %27, %254
br i1 %255, label %256, label %240
256: ; preds = %240
%257 = trunc i64 %242 to i32
br label %258
258: ; preds = %256, %237
%259 = phi i32 [ 0, %237 ], [ %257, %256 ]
%260 = shl nsw i32 %259, 4
%261 = zext i32 %260 to i64
%262 = icmp ugt i64 %27, %261
br i1 %262, label %263, label %275
263: ; preds = %258
%264 = getelementptr inbounds [16 x i32], [16 x i32]* %12, i64 0, i64 0
%265 = call i32 @memset(i32* %264, i32 0, i64 16)
%266 = getelementptr inbounds i32, i32* %2, i64 %261
%267 = sub i64 %27, %261
%268 = call i32 @memcpy(i32* %264, i32* %266, i64 %267)
%269 = getelementptr inbounds [16 x i32], [16 x i32]* %12, i64 0, i64 %267
store i32 128, i32* %269
%270 = call i32 @set_stage_in_tweak(i32* %28, i32 64)
%271 = call i32 @set_block_number_in_tweak(i32* %35, i32 %259)
%272 = call i32 @set_tweak_in_tweakey(i32* %30, i32* %28)
%273 = call i32 @aesTweakEncrypt(i32 256, i32* %264, i32* %30, i32* %39)
%274 = call i32 @xor_values(i32* %32, i32* %39)
br label %275
275: ; preds = %263, %258
%276 = call i32 @set_stage_in_tweak(i32* %28, i32 16)
%277 = call i32 @set_block_number_in_tweak(i32* %35, i32 0)
%278 = call i32 @set_tweak_in_tweakey(i32* %30, i32* %28)
%279 = getelementptr inbounds [16 x i32], [16 x i32]* %14, i64 0, i64 0
%280 = call i32 @aesTweakEncrypt(i32 256, i32* %32, i32* %30, i32* %279)
%281 = call i64 @memcmp_const(i32* %23, i32* %279, i32 64)
%282 = icmp eq i64 %281, 0
br i1 %282, label %285, label %283
283: ; preds = %275
%284 = call i32 @memset(i32* %2, i32 0, i64 %27)
br label %286
285: ; preds = %275
store i64 %27, i64* %3
br label %286
286: ; preds = %285, %283
%287 = phi i32 [ -1, %283 ], [ 0, %285 ]
ret i32 %287
}