#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 PC1(unsigned int);
unsigned int PC2(unsigned int, unsigned int);
unsigned int functionF(unsigned int, unsigned int);
unsigned int encipher(int startBlock, int keyBlock) {
  int i;
  unsigned int text = startBlock;
  unsigned int keyArray[16];
  int key = PC1(keyBlock);
  for (i = 0; i < 16; i++) {
    unsigned int leftSideKey = key & 0xf;
    unsigned int rightSideKey = (key >> 4) & 0xf;
    keyArray[i] = PC2(leftSideKey, rightSideKey);
    key = PC1((leftSideKey << 4) | rightSideKey);
  }
  for (i = 0; i < 16; i++) {
    unsigned int leftSidePlaintext = text & 0xf;
    unsigned int rightSidePlaintext = (text >> 4) & 0xf;
    unsigned int returnOfFuntion = functionF(rightSidePlaintext, keyArray[i]);
    text = (returnOfFuntion << 4) | rightSidePlaintext;
  }
  return text;
}


x86 assembly (clang, -O0):
<encipher>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <PC1@plt>
mov    %eax,-0x54(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    11a9 <encipher+0x79>
mov    -0x54(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%eax
sar    $0x4,%eax
and    $0xf,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x58(%rbp),%edi
mov    -0x5c(%rbp),%esi
call   1040 <PC2@plt>
mov    %eax,%ecx
movslq -0xc(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
mov    -0x58(%rbp),%edi
shl    $0x4,%edi
or     -0x5c(%rbp),%edi
call   1030 <PC1@plt>
mov    %eax,-0x54(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1156 <encipher+0x26>
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    11fc <encipher+0xcc>
mov    -0x10(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x60(%rbp)
mov    -0x10(%rbp),%eax
shr    $0x4,%eax
and    $0xf,%eax
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%edi
movslq -0xc(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%esi
call   1050 <functionF@plt>
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%eax
shl    $0x4,%eax
or     -0x64(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b0 <encipher+0x80>
mov    -0x10(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encipher>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %edi,%r14d
mov    %esi,%edi
call   1030 <PC1@plt>
mov    %eax,%ebp
xor    %r15d,%r15d
nopl   0x0(%rax)
mov    %ebp,%ebx
and    $0xf,%ebx
shr    $0x4,%ebp
and    $0xf,%ebp
mov    %ebx,%edi
mov    %ebp,%esi
call   1040 <PC2@plt>
mov    %eax,(%rsp,%r15,4)
shl    $0x4,%ebx
or     %ebp,%ebx
mov    %ebx,%edi
call   1030 <PC1@plt>
mov    %eax,%ebp
add    $0x1,%r15
cmp    $0x10,%r15
jne    1150 <encipher+0x20>
shr    $0x4,%r14d
and    $0xf,%r14d
mov    (%rsp),%esi
mov    %r14d,%edi
call   1050 <functionF@plt>
and    $0xf,%eax
mov    0x4(%rsp),%esi
mov    %eax,%edi
call   1050 <functionF@plt>
and    $0xf,%eax
mov    0x8(%rsp),%esi
mov    %eax,%edi
call   1050 <functionF@plt>
and    $0xf,%eax
mov    0xc(%rsp),%esi
mov    %eax,%edi
call   1050 <functionF@plt>
and    $0xf,%eax
mov    0x10(%rsp),%esi
mov    %eax,%edi
call   1050 <functionF@plt>
and    $0xf,%eax
mov    0x14(%rsp),%esi
mov    %eax,%edi
call   1050 <functionF@plt>
and    $0xf,%eax
mov    0x18(%rsp),%esi
mov    %eax,%edi
call   1050 <functionF@plt>
and    $0xf,%eax
mov    0x1c(%rsp),%esi
mov    %eax,%edi
call   1050 <functionF@plt>
and    $0xf,%eax
mov    0x20(%rsp),%esi
mov    %eax,%edi
call   1050 <functionF@plt>
and    $0xf,%eax
mov    0x24(%rsp),%esi
mov    %eax,%edi
call   1050 <functionF@plt>
and    $0xf,%eax
mov    0x28(%rsp),%esi
mov    %eax,%edi
call   1050 <functionF@plt>
and    $0xf,%eax
mov    0x2c(%rsp),%esi
mov    %eax,%edi
call   1050 <functionF@plt>
and    $0xf,%eax
mov    0x30(%rsp),%esi
mov    %eax,%edi
call   1050 <functionF@plt>
and    $0xf,%eax
mov    0x34(%rsp),%esi
mov    %eax,%edi
call   1050 <functionF@plt>
and    $0xf,%eax
mov    0x38(%rsp),%esi
mov    %eax,%edi
call   1050 <functionF@plt>
mov    %eax,%ebx
and    $0xf,%ebx
mov    0x3c(%rsp),%esi
mov    %ebx,%edi
call   1050 <functionF@plt>
shl    $0x4,%eax
or     %ebx,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @encipher(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [16 x i32]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%14 = load i32, i32* %3
store i32 %14, i32* %6
%15 = load i32, i32* %4
%16 = call i32 @PC1(i32 %15)
store i32 %16, i32* %8
store i32 0, i32* %5
br label %17
17: ; preds = %37, %2
%18 = load i32, i32* %5
%19 = icmp slt i32 %18, 16
br i1 %19, label %20, label %40
20: ; preds = %17
%21 = load i32, i32* %8
%22 = and i32 %21, 15
store i32 %22, i32* %9
%23 = load i32, i32* %8
%24 = ashr i32 %23, 4
%25 = and i32 %24, 15
store i32 %25, i32* %10
%26 = load i32, i32* %9
%27 = load i32, i32* %10
%28 = call i32 @PC2(i32 %26, i32 %27)
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [16 x i32], [16 x i32]* %7, i64 0, i64 %30
store i32 %28, i32* %31
%32 = load i32, i32* %9
%33 = shl i32 %32, 4
%34 = load i32, i32* %10
%35 = or i32 %33, %34
%36 = call i32 @PC1(i32 %35)
store i32 %36, i32* %8
br label %37
37: ; preds = %20
%38 = load i32, i32* %5
%39 = add nsw i32 %38, 1
store i32 %39, i32* %5
br label %17
40: ; preds = %17
store i32 0, i32* %5
br label %41
41: ; preds = %60, %40
%42 = load i32, i32* %5
%43 = icmp slt i32 %42, 16
br i1 %43, label %44, label %63
44: ; preds = %41
%45 = load i32, i32* %6
%46 = and i32 %45, 15
store i32 %46, i32* %11
%47 = load i32, i32* %6
%48 = lshr i32 %47, 4
%49 = and i32 %48, 15
store i32 %49, i32* %12
%50 = load i32, i32* %12
%51 = load i32, i32* %5
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [16 x i32], [16 x i32]* %7, i64 0, i64 %52
%54 = load i32, i32* %53
%55 = call i32 @functionF(i32 %50, i32 %54)
store i32 %55, i32* %13
%56 = load i32, i32* %13
%57 = shl i32 %56, 4
%58 = load i32, i32* %12
%59 = or i32 %57, %58
store i32 %59, i32* %6
br label %60
60: ; preds = %44
%61 = load i32, i32* %5
%62 = add nsw i32 %61, 1
store i32 %62, i32* %5
br label %41
63: ; preds = %41
%64 = load i32, i32* %6
ret i32 %64
}

LLVM IR (-O2):
define i32 @encipher(i32 %0, i32 %1) {
%3 = alloca [16 x i32]
%4 = bitcast [16 x i32]* %3 to i8*
%5 = tail call i32 @PC1(i32 %1)
br label %6
6: ; preds = %2, %6
%7 = phi i64 [ 0, %2 ], [ %17, %6 ]
%8 = phi i32 [ %5, %2 ], [ %16, %6 ]
%9 = and i32 %8, 15
%10 = lshr i32 %8, 4
%11 = and i32 %10, 15
%12 = tail call i32 @PC2(i32 %9, i32 %11)
%13 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 %7
store i32 %12, i32* %13
%14 = shl nuw nsw i32 %9, 4
%15 = or i32 %14, %11
%16 = tail call i32 @PC1(i32 %15)
%17 = add nuw nsw i64 %7, 1
%18 = icmp eq i64 %17, 16
br i1 %18, label %19, label %6
19: ; preds = %6
%20 = lshr i32 %0, 4
%21 = and i32 %20, 15
%22 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 0
%23 = load i32, i32* %22
%24 = tail call i32 @functionF(i32 %21, i32 %23)
%25 = and i32 %24, 15
%26 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 1
%27 = load i32, i32* %26
%28 = tail call i32 @functionF(i32 %25, i32 %27)
%29 = and i32 %28, 15
%30 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 2
%31 = load i32, i32* %30
%32 = tail call i32 @functionF(i32 %29, i32 %31)
%33 = and i32 %32, 15
%34 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 3
%35 = load i32, i32* %34
%36 = tail call i32 @functionF(i32 %33, i32 %35)
%37 = and i32 %36, 15
%38 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 4
%39 = load i32, i32* %38
%40 = tail call i32 @functionF(i32 %37, i32 %39)
%41 = and i32 %40, 15
%42 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 5
%43 = load i32, i32* %42
%44 = tail call i32 @functionF(i32 %41, i32 %43)
%45 = and i32 %44, 15
%46 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 6
%47 = load i32, i32* %46
%48 = tail call i32 @functionF(i32 %45, i32 %47)
%49 = and i32 %48, 15
%50 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 7
%51 = load i32, i32* %50
%52 = tail call i32 @functionF(i32 %49, i32 %51)
%53 = and i32 %52, 15
%54 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 8
%55 = load i32, i32* %54
%56 = tail call i32 @functionF(i32 %53, i32 %55)
%57 = and i32 %56, 15
%58 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 9
%59 = load i32, i32* %58
%60 = tail call i32 @functionF(i32 %57, i32 %59)
%61 = and i32 %60, 15
%62 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 10
%63 = load i32, i32* %62
%64 = tail call i32 @functionF(i32 %61, i32 %63)
%65 = and i32 %64, 15
%66 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 11
%67 = load i32, i32* %66
%68 = tail call i32 @functionF(i32 %65, i32 %67)
%69 = and i32 %68, 15
%70 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 12
%71 = load i32, i32* %70
%72 = tail call i32 @functionF(i32 %69, i32 %71)
%73 = and i32 %72, 15
%74 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 13
%75 = load i32, i32* %74
%76 = tail call i32 @functionF(i32 %73, i32 %75)
%77 = and i32 %76, 15
%78 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 14
%79 = load i32, i32* %78
%80 = tail call i32 @functionF(i32 %77, i32 %79)
%81 = and i32 %80, 15
%82 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 15
%83 = load i32, i32* %82
%84 = tail call i32 @functionF(i32 %81, i32 %83)
%85 = shl i32 %84, 4
%86 = or i32 %85, %81
ret i32 %86
}