// File: dwkim606[P]IPPBA/Scheme.cpp
// Function: Scheme::encryptBio(unsigned long (&) [147758], MasterSecretKey&, unsigned long (&) [145832])
void encryptBio(EncryptedBio& encY, MasterSecretKey& msk, Biometric& y) {
		int i, j;
		for (i = K + 1; i < M + 1; ++i) encY[i] = (U(GEN) << (SFT));
		for (i = 0; i < K; ++i) {
			encY[i + 1] = (ZmodQ)(DG(GEN)*pow(2, SFT) + 0.5) + (y[i] << (LOGQ - LOGP + SFT));
			for (j = 0; j < N; ++j) encY[i + 1] -= encY[K + 1 + j] * msk.S[j * K + i];
		}
		encY[0] = (ZmodQ)(DGstar(GEN)*pow(2, SFT) + 0.5);
		for (i = 0; i < M; ++i) encY[0] -= msk.U[i] * encY[i + 1];	
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x239a9, -0x1c(%rbp)   # imm = 0x239A9
cmpl $0x2412e, -0x1c(%rbp)   # imm = 0x2412E
jge 0x3f05
leaq 0x7d9d(%rip), %rdi      # 0xbc78
leaq 0x73ce(%rip), %rsi      # 0xb2b0
callq 0x2fc0
movq %rax, %rdx
shlq $0x0, %rdx
movq -0x8(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x3ecb
movl $0x0, -0x1c(%rbp)
cmpl $0x239a8, -0x1c(%rbp)   # imm = 0x239A8
jge 0x4016
leaq 0x7d68(%rip), %rdi      # 0xbc88
leaq 0x7389(%rip), %rsi      # 0xb2b0
callq 0x4190
movsd %xmm0, -0x28(%rbp)
movl $0x2, %edi
xorl %esi, %esi
callq 0x41c0
movaps %xmm0, %xmm1
movsd -0x28(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd 0x124f(%rip), %xmm1     # 0x51a0
addsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rdx
movq %rdx, %rcx
sarq $0x3f, %rcx
movsd 0x123c(%rip), %xmm1     # 0x51a8
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
andq %rcx, %rax
orq %rax, %rdx
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shlq $0x20, %rax
addq %rax, %rdx
movq -0x8(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x0, -0x20(%rbp)
cmpl $0x785, -0x20(%rbp)     # imm = 0x785
jge 0x4006
movq -0x8(%rbp), %rax
movl -0x20(%rbp), %ecx
addl $0x239a9, %ecx          # imm = 0x239A9
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rsi
movq -0x10(%rbp), %rax
movq (%rax), %rax
imull $0x239a8, -0x20(%rbp), %ecx # imm = 0x239A8
addl -0x1c(%rbp), %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %al
andb $0x1, %al
movzbl %al, %eax
imulq %rax, %rsi
movq -0x8(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
subq %rsi, %rdx
movq %rdx, (%rax,%rcx,8)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x3fa6
jmp 0x4008
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x3f0c
leaq 0x7c8b(%rip), %rdi      # 0xbca8
leaq 0x728c(%rip), %rsi      # 0xb2b0
callq 0x4190
movsd %xmm0, -0x30(%rbp)
movl $0x2, %edi
xorl %esi, %esi
callq 0x41c0
movaps %xmm0, %xmm1
movsd -0x30(%rbp), %xmm0
mulsd %xmm1, %xmm0
movsd 0x1152(%rip), %xmm1     # 0x51a0
addsd %xmm1, %xmm0
movaps %xmm0, %xmm1
cvttsd2si %xmm1, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
movsd 0x113f(%rip), %xmm1     # 0x51a8
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
andq %rdx, %rax
orq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x1c(%rbp)
cmpl $0x2412d, -0x1c(%rbp)   # imm = 0x2412D
jge 0x40c9
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x8(%rbp), %rax
movl -0x1c(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
imulq (%rax,%rcx,8), %rdx
movq -0x8(%rbp), %rax
movq (%rax), %rcx
subq %rdx, %rcx
movq %rcx, (%rax)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x4086
addq $0x30, %rsp
popq %rbp
retq
nop