#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 /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ xtea_encipher(int /*<<< orphan*/ *,
                                 int /*<<< orphan*/ const *);
void xtea_encipher_cbc(uint32_t v[2], const uint32_t key[4], uint32_t iv[2]) {
  v[0] ^= iv[0];
  v[1] ^= iv[1];
  xtea_encipher(v, key);
  iv[0] = v[0];
  iv[1] = v[1];
}


x86 assembly (clang, -O0):
<xtea_encipher_cbc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x8(%rbp),%rax
xor    0x4(%rax),%ecx
mov    %ecx,0x4(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <xtea_encipher@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xtea_encipher_cbc>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
mov    (%rdx),%eax
xor    %eax,(%rdi)
mov    0x4(%rdx),%eax
xor    %eax,0x4(%rdi)
call   1030 <xtea_encipher@plt>
mov    (%rbx),%eax
mov    %eax,(%r14)
mov    0x4(%rbx),%eax
mov    %eax,0x4(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @xtea_encipher_cbc(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %6
%8 = getelementptr inbounds i32, i32* %7, i64 0
%9 = load i32, i32* %8
%10 = load i32*, i32** %4
%11 = getelementptr inbounds i32, i32* %10, i64 0
%12 = load i32, i32* %11
%13 = xor i32 %12, %9
store i32 %13, i32* %11
%14 = load i32*, i32** %6
%15 = getelementptr inbounds i32, i32* %14, i64 1
%16 = load i32, i32* %15
%17 = load i32*, i32** %4
%18 = getelementptr inbounds i32, i32* %17, i64 1
%19 = load i32, i32* %18
%20 = xor i32 %19, %16
store i32 %20, i32* %18
%21 = load i32*, i32** %4
%22 = load i32*, i32** %5
%23 = call i32 @xtea_encipher(i32* %21, i32* %22)
%24 = load i32*, i32** %4
%25 = getelementptr inbounds i32, i32* %24, i64 0
%26 = load i32, i32* %25
%27 = load i32*, i32** %6
%28 = getelementptr inbounds i32, i32* %27, i64 0
store i32 %26, i32* %28
%29 = load i32*, i32** %4
%30 = getelementptr inbounds i32, i32* %29, i64 1
%31 = load i32, i32* %30
%32 = load i32*, i32** %6
%33 = getelementptr inbounds i32, i32* %32, i64 1
store i32 %31, i32* %33
ret void
}

LLVM IR (-O2):
define void @xtea_encipher_cbc(i32* %0, i32* %1, i32* nocapture %2) {
%4 = load i32, i32* %2
%5 = load i32, i32* %0
%6 = xor i32 %5, %4
store i32 %6, i32* %0
%7 = getelementptr inbounds i32, i32* %2, i64 1
%8 = load i32, i32* %7
%9 = getelementptr inbounds i32, i32* %0, i64 1
%10 = load i32, i32* %9
%11 = xor i32 %10, %8
store i32 %11, i32* %9
%12 = tail call i32 @xtea_encipher(i32* %0, i32* %1)
%13 = load i32, i32* %0
store i32 %13, i32* %2
%14 = load i32, i32* %9
store i32 %14, i32* %7
ret void
}