#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*/ fonction(unsigned char *, unsigned char *, unsigned char *);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
void chiffrement(unsigned char *xi, unsigned char *xo,
                 unsigned char Kn[16][48]) {
  unsigned char r[32], l[32];
  unsigned char rp[32], lp[32];
  int i;
  int n;
  memcpy(l, &xi[0], 32);
  memcpy(r, &xi[32], 32);
  for (n = 0; n < 16; n++) {
    memcpy(lp, r, 32);
    fonction(Kn[n], r, rp);
    for (i = 0; i < 32; i++) {
      r[i] = ((l[i]) ^ (rp[i]));
    }
    memcpy(l, lp, 32);
  }
  memcpy(&xo[0], r, 32);
  memcpy(&xo[32], l, 32);
}


x86 assembly (clang, -O0):
<chiffrement>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x20,%edx
call   1040 <memcpy@plt>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x20,%rsi
mov    $0x20,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0xa8(%rbp)
cmpl   $0x10,-0xa8(%rbp)
jge    1225 <chiffrement+0x105>
lea    -0xa0(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x20,%edx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rdi
movslq -0xa8(%rbp),%rax
imul   $0x30,%rax,%rax
add    %rax,%rdi
lea    -0x40(%rbp),%rsi
lea    -0x80(%rbp),%rdx
call   1030 <fonction@plt>
movl   $0x0,-0xa4(%rbp)
cmpl   $0x20,-0xa4(%rbp)
jge    11fc <chiffrement+0xdc>
movslq -0xa4(%rbp),%rax
movzbl -0x60(%rbp,%rax,1),%eax
movslq -0xa4(%rbp),%rcx
movzbl -0x80(%rbp,%rcx,1),%ecx
xor    %ecx,%eax
mov    %al,%cl
movslq -0xa4(%rbp),%rax
mov    %cl,-0x40(%rbp,%rax,1)
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    11b4 <chiffrement+0x94>
lea    -0x60(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x20,%edx
call   1040 <memcpy@plt>
mov    -0xa8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa8(%rbp)
jmp    1169 <chiffrement+0x49>
mov    -0x10(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x20,%edx
call   1040 <memcpy@plt>
mov    -0x10(%rbp),%rdi
add    $0x20,%rdi
lea    -0x60(%rbp),%rsi
mov    $0x20,%edx
call   1040 <memcpy@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chiffrement>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rdx,%r12
mov    %rsi,0x8(%rsp)
mov    %rdi,%rbx
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x20,%edx
call   1040 <memcpy@plt>
add    $0x20,%rbx
lea    0x30(%rsp),%r13
mov    %r13,%rdi
mov    %rbx,%rsi
mov    $0x20,%edx
call   1040 <memcpy@plt>
xor    %r14d,%r14d
lea    0x70(%rsp),%rbx
lea    0x50(%rsp),%rbp
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r13,%rsi
mov    $0x20,%edx
call   1040 <memcpy@plt>
lea    (%r12,%r14,1),%rdi
mov    %r13,%rsi
mov    %rbp,%rdx
call   1030 <fonction@plt>
movaps 0x50(%rsp),%xmm0
movaps 0x60(%rsp),%xmm1
xorps  0x10(%rsp),%xmm0
movaps %xmm0,0x30(%rsp)
xorps  0x20(%rsp),%xmm1
movaps %xmm1,0x40(%rsp)
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x20,%edx
call   1040 <memcpy@plt>
add    $0x30,%r14
cmp    $0x300,%r14
jne    1180 <chiffrement+0x60>
lea    0x30(%rsp),%rsi
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x20,%edx
call   1040 <memcpy@plt>
add    $0x20,%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x20,%edx
call   1040 <memcpy@plt>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @chiffrement(i8* %0, i8* %1, [48 x i8]* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [48 x i8]*
%7 = alloca [32 x i8]
%8 = alloca [32 x i8]
%9 = alloca [32 x i8]
%10 = alloca [32 x i8]
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store [48 x i8]* %2, [48 x i8]** %6
%13 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = call i32 @memcpy(i8* %13, i8* %15, i32 32)
%17 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i64 32
%20 = call i32 @memcpy(i8* %17, i8* %19, i32 32)
store i32 0, i32* %12
br label %21
21: ; preds = %62, %3
%22 = load i32, i32* %12
%23 = icmp slt i32 %22, 16
br i1 %23, label %24, label %65
24: ; preds = %21
%25 = getelementptr inbounds [32 x i8], [32 x i8]* %10, i64 0, i64 0
%26 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%27 = call i32 @memcpy(i8* %25, i8* %26, i32 32)
%28 = load [48 x i8]*, [48 x i8]** %6
%29 = load i32, i32* %12
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [48 x i8], [48 x i8]* %28, i64 %30
%32 = getelementptr inbounds [48 x i8], [48 x i8]* %31, i64 0, i64 0
%33 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%34 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%35 = call i32 @fonction(i8* %32, i8* %33, i8* %34)
store i32 0, i32* %11
br label %36
36: ; preds = %55, %24
%37 = load i32, i32* %11
%38 = icmp slt i32 %37, 32
br i1 %38, label %39, label %58
39: ; preds = %36
%40 = load i32, i32* %11
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = zext i8 %43 to i32
%45 = load i32, i32* %11
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 %46
%48 = load i8, i8* %47
%49 = zext i8 %48 to i32
%50 = xor i32 %44, %49
%51 = trunc i32 %50 to i8
%52 = load i32, i32* %11
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 %53
store i8 %51, i8* %54
br label %55
55: ; preds = %39
%56 = load i32, i32* %11
%57 = add nsw i32 %56, 1
store i32 %57, i32* %11
br label %36
58: ; preds = %36
%59 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%60 = getelementptr inbounds [32 x i8], [32 x i8]* %10, i64 0, i64 0
%61 = call i32 @memcpy(i8* %59, i8* %60, i32 32)
br label %62
62: ; preds = %58
%63 = load i32, i32* %12
%64 = add nsw i32 %63, 1
store i32 %64, i32* %12
br label %21
65: ; preds = %21
%66 = load i8*, i8** %5
%67 = getelementptr inbounds i8, i8* %66, i64 0
%68 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%69 = call i32 @memcpy(i8* %67, i8* %68, i32 32)
%70 = load i8*, i8** %5
%71 = getelementptr inbounds i8, i8* %70, i64 32
%72 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%73 = call i32 @memcpy(i8* %71, i8* %72, i32 32)
ret void
}

LLVM IR (-O2):
define void @chiffrement(i8* %0, i8* %1, [48 x i8]* %2) {
%4 = alloca [32 x i8]
%5 = alloca [32 x i8]
%6 = alloca [32 x i8]
%7 = alloca [32 x i8]
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%11 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%12 = call i32 @memcpy(i8* %9, i8* %0, i32 32)
%13 = getelementptr inbounds i8, i8* %0, i64 32
%14 = call i32 @memcpy(i8* %8, i8* %13, i32 32)
%15 = bitcast [32 x i8]* %5 to <16 x i8>*
%16 = bitcast [32 x i8]* %6 to <16 x i8>*
%17 = bitcast [32 x i8]* %4 to <16 x i8>*
%18 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 16
%19 = bitcast i8* %18 to <16 x i8>*
%20 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 16
%21 = bitcast i8* %20 to <16 x i8>*
%22 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 16
%23 = bitcast i8* %22 to <16 x i8>*
br label %24
24: ; preds = %3, %24
%25 = phi i64 [ 0, %3 ], [ %36, %24 ]
%26 = call i32 @memcpy(i8* %11, i8* %8, i32 32)
%27 = getelementptr inbounds [48 x i8], [48 x i8]* %2, i64 %25, i64 0
%28 = call i32 @fonction(i8* %27, i8* %8, i8* %10)
%29 = load <16 x i8>, <16 x i8>* %15
%30 = load <16 x i8>, <16 x i8>* %16
%31 = xor <16 x i8> %30, %29
store <16 x i8> %31, <16 x i8>* %17
%32 = load <16 x i8>, <16 x i8>* %19
%33 = load <16 x i8>, <16 x i8>* %21
%34 = xor <16 x i8> %33, %32
store <16 x i8> %34, <16 x i8>* %23
%35 = call i32 @memcpy(i8* %9, i8* %11, i32 32)
%36 = add nuw nsw i64 %25, 1
%37 = icmp eq i64 %36, 16
br i1 %37, label %38, label %24
38: ; preds = %24
%39 = call i32 @memcpy(i8* %1, i8* %8, i32 32)
%40 = getelementptr inbounds i8, i8* %1, i64 32
%41 = call i32 @memcpy(i8* %40, i8* %9, i32 32)
ret void
}