// File: /workspace/github_c_makefile_star2_O1/theck01[P]offbrand_lib/src/classes/obint.c
// Function: obint_add_unsigned
obint * obint_add_unsigned(const obint *a, const obint *b){

  uint64_t i, large_most_sig, small_most_sig;
  int8_t carry = 0;
  obint *result;
  const obint *larger, *smaller;

  larger = obint_most_sig(a) > obint_most_sig(b) ? a : b;
  smaller = obint_most_sig(a) <= obint_most_sig(b) ? a : b;

  large_most_sig = obint_most_sig(larger);
  small_most_sig = obint_most_sig(smaller);

  /* reserve enough space for the result, +2 required for actual size of larger
   * and possible extra digit needed to catch any addition overflow */
  result = obint_create_default(large_most_sig+2);

  for(i=0; i<= small_most_sig; i++){
    result->digits[i] = (larger->digits[i] + smaller->digits[i] + carry)%10;
    carry = (larger->digits[i] + smaller->digits[i] + carry)/10;
  }

  for( ; i<= large_most_sig; i++){
    result->digits[i] = (larger->digits[i] + carry)%10;
    carry = (larger->digits[i] + carry)/10;
  }

  result->digits[i] = carry;

  return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rcx
movq 0x18(%rdi), %r8
movq %r8, %rdx
leaq -0x1(%rdx), %rax
cmpq $0x1, %rdx
je 0x2a2a
cmpb $0x0, -0x1(%rcx,%rdx)
movq %rax, %rdx
je 0x2a16
movq 0x10(%rsi), %rdi
movq 0x18(%rsi), %r9
movq %r9, %rdx
leaq -0x1(%rdx), %r10
cmpq $0x1, %rdx
je 0x2a49
cmpb $0x0, -0x1(%rdi,%rdx)
movq %r10, %rdx
je 0x2a35
leaq -0x1(%r8), %rdx
cmpq $0x1, %r8
je 0x2a6b
cmpb $0x0, -0x1(%rcx,%r8)
movq %rdx, %r8
je 0x2a49
jmp 0x2a6b
cmpb $0x0, -0x1(%rdi,%r9)
movq %rcx, %r9
jne 0x2a75
leaq -0x1(%r9), %rcx
cmpq $0x1, %r9
jne 0x2a60
cmpq %r10, %rax
movq %rsi, %r14
cmovaq %rbx, %r14
movq 0x10(%r14), %rax
movq 0x18(%r14), %rdi
leaq -0x1(%rdi), %r15
cmpq $0x1, %rdi
je 0x2a9b
cmpb $0x0, -0x1(%rax,%rdi)
movq %r15, %rdi
je 0x2a87
cmpq %rcx, %rdx
cmovaq %rsi, %rbx
movq 0x10(%rbx), %rax
movq 0x18(%rbx), %rcx
leaq -0x1(%rcx), %r12
cmpq $0x1, %rcx
je 0x2abe
cmpb $0x0, -0x1(%rax,%rcx)
movq %r12, %rcx
je 0x2aaa
leaq 0x2(%r15), %rdi
callq 0x2531
xorl %edx, %edx
xorl %ecx, %ecx
movq %rdx, %rsi
movq 0x10(%r14), %rdx
movsbl (%rdx,%rsi), %edx
movq 0x10(%rbx), %rdi
movsbl (%rdi,%rsi), %edi
addl %ecx, %edx
addl %edi, %edx
movslq %edx, %rdx
imulq $0x66666667, %rdx, %rdi # imm = 0x66666667
movq %rdi, %r8
shrq $0x3f, %r8
sarq $0x22, %rdi
addl %r8d, %edi
addl %edi, %edi
leal (%rdi,%rdi,4), %edi
subl %edi, %edx
movq 0x10(%rax), %rdi
movb %dl, (%rdi,%rsi)
movq 0x10(%r14), %rdx
movsbl (%rdx,%rsi), %edx
movq 0x10(%rbx), %rdi
movsbl (%rdi,%rsi), %edi
addl %ecx, %edx
addl %edi, %edx
movslq %edx, %rcx
imulq $0x66666667, %rcx, %rcx # imm = 0x66666667
movq %rcx, %rdx
shrq $0x3f, %rdx
sarq $0x22, %rcx
addl %edx, %ecx
leaq 0x1(%rsi), %rdx
cmpq %r12, %rsi
jb 0x2acb
leaq -0x1(%rdx), %rsi
cmpq %r15, %rsi
jae 0x2ba2
movq 0x10(%r14), %rsi
movsbl (%rsi,%rdx), %esi
movsbl %cl, %ecx
addl %ecx, %esi
movslq %esi, %rsi
imulq $0x66666667, %rsi, %rdi # imm = 0x66666667
movq %rdi, %r8
shrq $0x3f, %r8
sarq $0x22, %rdi
addl %r8d, %edi
addl %edi, %edi
leal (%rdi,%rdi,4), %edi
subl %edi, %esi
movq 0x10(%rax), %rdi
movb %sil, (%rdi,%rdx)
movq 0x10(%r14), %rsi
movsbl (%rsi,%rdx), %esi
addl %ecx, %esi
movslq %esi, %rcx
imulq $0x66666667, %rcx, %rcx # imm = 0x66666667
movq %rcx, %rsi
shrq $0x3f, %rsi
sarq $0x22, %rcx
addl %esi, %ecx
incq %rdx
cmpq %r15, %rdx
jbe 0x2b45
movq 0x10(%rax), %rsi
movb %cl, (%rsi,%rdx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq