// File: /workspace/github_c_makefile_star2_O0/orestesleal[P]base64/base64.c
// Function: base64url_enc
void base64url_enc(char *s, char b[])
{
	unsigned int x, npad;
	int i;

	npad = 0;
	for (i = 0; *s; i++) {
		x = s[0] == ESC ? s++[1]-'0' : s[0];
		x <<= 8;
		x |= s[1] == ESC ? s++[2]-'0' : s[1];
		x <<= 8;
		x |= s[2] == ESC ? s++[3]-'0' : s[2];
		x <<= 8;
		b[i++] = b64_url_alp[x >> 26];
		b[i++] = b64_url_alp[(x << 6) >> 26];

		if (s[1] == '\0') { /* quantum of encoding of 8 bits */
			npad = 2;
			break;
		}
		b[i++] = b64_url_alp[(x << 12) >> 26];
		
		if (s[2] == '\0') { /* quantum of 16 bits */
			npad = 1;
			break;
		}
		b[i] = b64_url_alp[(x << 18) >> 26];
		s += 3; /* point to the next 24 bit group */ 
	}
	for (;npad > 0; npad--) { /* add padding if needed */
		b[i++] = PAD;
	}
	b[i] = '\0';
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x8(%rbp), %rax
cmpb $0x0, (%rax)
je 0x177a
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5c, %eax
jne 0x15ee
movq -0x8(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x8(%rbp)
movsbl 0x1(%rax), %eax
subl $0x30, %eax
movl %eax, -0x20(%rbp)
jmp 0x15f8
movq -0x8(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
shll $0x8, %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x5c, %eax
jne 0x162f
movq -0x8(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x8(%rbp)
movsbl 0x2(%rax), %eax
subl $0x30, %eax
movl %eax, -0x24(%rbp)
jmp 0x163a
movq -0x8(%rbp), %rax
movsbl 0x1(%rax), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
orl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
shll $0x8, %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x5c, %eax
jne 0x1674
movq -0x8(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x8(%rbp)
movsbl 0x3(%rax), %eax
subl $0x30, %eax
movl %eax, -0x28(%rbp)
jmp 0x167f
movq -0x8(%rbp), %rax
movsbl 0x2(%rax), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %eax
orl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
shll $0x8, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
shrl $0x1a, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x3a1e(%rip), %rax      # 0x50c0
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x1c(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movl -0x14(%rbp), %eax
shll $0x6, %eax
shrl $0x1a, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x39f2(%rip), %rax      # 0x50c0
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x1c(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x8(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
jne 0x16fc
movl $0x2, -0x18(%rbp)
jmp 0x177a
movl -0x14(%rbp), %eax
shll $0xc, %eax
shrl $0x1a, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x39b0(%rip), %rax      # 0x50c0
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x1c(%rbp)
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x8(%rbp), %rax
movsbl 0x2(%rax), %eax
cmpl $0x0, %eax
jne 0x173e
movl $0x1, -0x18(%rbp)
jmp 0x177a
movl -0x14(%rbp), %eax
shll $0x12, %eax
shrl $0x1a, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x396e(%rip), %rax      # 0x50c0
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq -0x8(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x8(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x15ba
jmp 0x177c
cmpl $0x0, -0x18(%rbp)
jbe 0x17a3
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
movb $0x3d, (%rax,%rcx)
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x177c
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movb $0x0, (%rax,%rcx)
popq %rbp
retq
nopw %cs:(%rax,%rax)