// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/primatesv1gibbon80/ref/primate.cpp
// Function: GenerateRoundConstants()
void GenerateRoundConstants() //Generation of 5-bit round constant by using the primitive polynomial x^5+x^2+1 with initial value 1.
{
	//Round constants for p_1
	rc_p1[0]=1;
	//printf("\nRound constants for p_1: \n %.2x", rc_p1[0]);
	for(int i=1; i<p1rounds; i++){
		rc_p1[i] = ((rc_p1[i-1]<<1) ^ ((rc_p1[i-1]>>1)&1) ^ ((rc_p1[i-1]>>4)&1))&31;
		//printf("\n %.2x", rc_p1[i]);
	}

	//Round constant for p_2
	rc_p2[0] = ((rc_p1[p1rounds-1]<<1) ^ ((rc_p1[p1rounds-1]>>1)&1) ^ ((rc_p1[p1rounds-1]>>4)&1))&31;
	//printf("\nRound constants for p_2: \n %.2x", rc_p2[0]);
	for(int i=1; i<p2rounds; i++){
		rc_p2[i] = ((rc_p2[i-1]<<1) ^ ((rc_p2[i-1]>>1)&1) ^ ((rc_p2[i-1]>>4)&1))&31;
		//printf("\n %.2x", rc_p2[i]);
	}
	
	//Round constant for p_3
	rc_p3[0] = ((rc_p2[p2rounds-1]<<1) ^ ((rc_p2[p2rounds-1]>>1)&1) ^ ((rc_p2[p2rounds-1]>>4)&1))&31;
	//printf("\nRound constants for p_3: \n %.2x", rc_p3[0]);
	for(int i=1; i<p3rounds; i++){
		rc_p3[i] = ((rc_p3[i-1]<<1) ^ ((rc_p3[i-1]>>1)&1) ^ ((rc_p3[i-1]>>4)&1))&31;
		//printf("\n %.2x", rc_p3[i]);
	}
}

// Assembly:
movq 0x33b9(%rip), %rax      # 0x5fc0
movb $0x1, (%rax)
movl $0x1, -0x4(%rsp)
cmpl $0xc, -0x4(%rsp)
jge 0x2c8a
movl -0x4(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rcx
movq 0x3396(%rip), %rax      # 0x5fc0
movzbl (%rax,%rcx), %eax
shll %eax
movl -0x4(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rdx
movq 0x337f(%rip), %rcx      # 0x5fc0
movzbl (%rcx,%rdx), %ecx
sarl %ecx
andl $0x1, %ecx
xorl %ecx, %eax
movl -0x4(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rdx
movq 0x3363(%rip), %rcx      # 0x5fc0
movzbl (%rcx,%rdx), %ecx
sarl $0x4, %ecx
andl $0x1, %ecx
xorl %ecx, %eax
andl $0x1f, %eax
movb %al, %dl
movslq -0x4(%rsp), %rcx
movq 0x3346(%rip), %rax      # 0x5fc0
movb %dl, (%rax,%rcx)
movl -0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rsp)
jmp 0x2c12
movq 0x332f(%rip), %rax      # 0x5fc0
movzbl 0xb(%rax), %eax
shll %eax
movq 0x3322(%rip), %rcx      # 0x5fc0
movzbl 0xb(%rcx), %ecx
sarl %ecx
andl $0x1, %ecx
xorl %ecx, %eax
movq 0x3310(%rip), %rcx      # 0x5fc0
movzbl 0xb(%rcx), %ecx
sarl $0x4, %ecx
andl $0x1, %ecx
xorl %ecx, %eax
andl $0x1f, %eax
movb %al, %cl
movq 0x3318(%rip), %rax      # 0x5fe0
movb %cl, (%rax)
movl $0x1, -0x8(%rsp)
cmpl $0x6, -0x8(%rsp)
jge 0x2d4a
movl -0x8(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rcx
movq 0x32f6(%rip), %rax      # 0x5fe0
movzbl (%rax,%rcx), %eax
shll %eax
movl -0x8(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rdx
movq 0x32df(%rip), %rcx      # 0x5fe0
movzbl (%rcx,%rdx), %ecx
sarl %ecx
andl $0x1, %ecx
xorl %ecx, %eax
movl -0x8(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rdx
movq 0x32c3(%rip), %rcx      # 0x5fe0
movzbl (%rcx,%rdx), %ecx
sarl $0x4, %ecx
andl $0x1, %ecx
xorl %ecx, %eax
andl $0x1f, %eax
movb %al, %dl
movslq -0x8(%rsp), %rcx
movq 0x32a6(%rip), %rax      # 0x5fe0
movb %dl, (%rax,%rcx)
movl -0x8(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rsp)
jmp 0x2cd2
movq 0x328f(%rip), %rax      # 0x5fe0
movzbl 0x5(%rax), %eax
shll %eax
movq 0x3282(%rip), %rcx      # 0x5fe0
movzbl 0x5(%rcx), %ecx
sarl %ecx
andl $0x1, %ecx
xorl %ecx, %eax
movq 0x3270(%rip), %rcx      # 0x5fe0
movzbl 0x5(%rcx), %ecx
sarl $0x4, %ecx
andl $0x1, %ecx
xorl %ecx, %eax
andl $0x1f, %eax
movb %al, %cl
movq 0x3270(%rip), %rax      # 0x5ff8
movb %cl, (%rax)
movl $0x1, -0xc(%rsp)
cmpl $0x6, -0xc(%rsp)
jge 0x2e0a
movl -0xc(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rcx
movq 0x324e(%rip), %rax      # 0x5ff8
movzbl (%rax,%rcx), %eax
shll %eax
movl -0xc(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rdx
movq 0x3237(%rip), %rcx      # 0x5ff8
movzbl (%rcx,%rdx), %ecx
sarl %ecx
andl $0x1, %ecx
xorl %ecx, %eax
movl -0xc(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rdx
movq 0x321b(%rip), %rcx      # 0x5ff8
movzbl (%rcx,%rdx), %ecx
sarl $0x4, %ecx
andl $0x1, %ecx
xorl %ecx, %eax
andl $0x1f, %eax
movb %al, %dl
movslq -0xc(%rsp), %rcx
movq 0x31fe(%rip), %rax      # 0x5ff8
movb %dl, (%rax,%rcx)
movl -0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rsp)
jmp 0x2d92
retq
nopl (%rax,%rax)