// File: /workspace/github_cpp_makefile_star2_O3/tdv[P]boss/boss/examples/simple_enum/main.cpp
// Function: SetMyOffers(Boss::RefObjPtr<Boss::IEnum>, unsigned int, unsigned int)
void SetMyOffers(Boss::RefObjPtr<Boss::IEnum> collection,
                 unsigned minPercent, unsigned maxPercent)
{
  Boss::EnumHelper<MyNs::IFaces::IBestOffer> Collection(collection);
  for (auto i = Collection.First(); i.Get() ; i = Collection.Next())
  {
    Boss::RefObjQIPtr<MyNs::IFaces::IFixPrice> FixPrice(i);
    if (!FixPrice.Get())
      throw std::runtime_error("Failed to get price object.");
    double Price = 0;
    if (FixPrice->GetPrice(&Price) != Boss::Status::Ok)
      throw std::runtime_error("Failed to get price for \"BestOffer\".");
    if (i->MyOffer(Price + (Price * minPercent) / 100) != Boss::Status::Ok)
      throw std::runtime_error("Failed to set my min offer for \"BestOffer\".");
    if (i->MyOffer(Price + (Price * maxPercent) / 100) != Boss::Status::Ok)
      throw std::runtime_error("Failed to set my max offer for \"BestOffer\".");
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movl %edx, %ebp
movl %esi, %r14d
movq (%rdi), %rdi
movq %rdi, 0x10(%rsp)
testq %rdi, %rdi
je 0x17a78
movq (%rdi), %rax
callq *0x10(%rax)
leaq 0x8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x18952
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x17a97
movq (%rdi), %rax
callq *0x18(%rax)
movq $0x0, 0x10(%rsp)
leaq 0x8(%rsp), %rdi
callq 0x1a32a
movq %rsp, %rdi
leaq 0x8(%rsp), %rsi
callq 0x189d4
movq (%rsp), %rbx
testq %rbx, %rbx
je 0x17bb5
movl %r14d, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x28(%rsp)
movl %ebp, %eax
xorps %xmm0, %xmm0
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x20(%rsp)
movq %rsp, %r14
leaq 0x18(%rsp), %r15
leaq 0x8(%rsp), %r12
movq $0x0, (%rsp)
movq (%rbx), %rax
movq %rbx, %rdi
movl $0x29ab589c, %esi       # imm = 0x29AB589C
movq %r14, %rdx
callq *0x20(%rax)
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x17bd2
movq $0x0, 0x18(%rsp)
movq (%rdi), %rax
movq %r15, %rsi
callq *0x28(%rax)
testl %eax, %eax
jne 0x17c40
movsd 0x18(%rsp), %xmm1
movapd %xmm1, %xmm0
mulsd 0x28(%rsp), %xmm0
divsd 0xa64d9(%rip), %xmm0    # 0xbe020
addsd %xmm1, %xmm0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x28(%rax)
testl %eax, %eax
jne 0x17c22
movsd 0x18(%rsp), %xmm1
movapd %xmm1, %xmm0
mulsd 0x20(%rsp), %xmm0
divsd 0xa64ac(%rip), %xmm0    # 0xbe020
addsd %xmm1, %xmm0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x28(%rax)
testl %eax, %eax
jne 0x17c04
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x17b94
movq (%rdi), %rax
callq *0x18(%rax)
movq %r14, %rdi
movq %r12, %rsi
callq 0x189d4
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x18(%rax)
movq (%rsp), %rbx
testq %rbx, %rbx
jne 0x17aef
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x17bc5
movq (%rdi), %rax
callq *0x18(%rax)
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x1abd0
movq %rax, %r15
leaq 0xa64f0(%rip), %rsi     # 0xbe0d6
movq %rax, %rdi
callq 0x2e110
leaq 0xddcbb(%rip), %rsi     # 0xf58b0
leaq 0xcb94(%rip), %rdx      # 0x24790
movq %r15, %rdi
callq 0x1bc20
movl $0x10, %edi
callq 0x1abd0
movq %rax, %r15
leaq 0xa652b(%rip), %rsi     # 0xbe143
movq %rax, %rdi
callq 0x2e110
jmp 0x17c5c
movl $0x10, %edi
callq 0x1abd0
movq %rax, %r15
leaq 0xa64e1(%rip), %rsi     # 0xbe117
movq %rax, %rdi
callq 0x2e110
jmp 0x17c5c
movl $0x10, %edi
callq 0x1abd0
movq %rax, %r15
leaq 0xa649e(%rip), %rsi     # 0xbe0f2
movq %rax, %rdi
callq 0x2e110
leaq 0xddc4d(%rip), %rsi     # 0xf58b0
leaq 0xcb26(%rip), %rdx      # 0x24790
movq %r15, %rdi
callq 0x1bc20
jmp 0x17d05
jmp 0x17d05
movq %rax, %r14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x17cf9
movq (%rdi), %rax
callq *0x18(%rax)
jmp 0x17cf9
jmp 0x17d05
movq %rax, %r14
jmp 0x17ce9
jmp 0x17ca0
jmp 0x17ca0
jmp 0x17ca0
jmp 0x17cce
movq %rax, %r14
movq %r15, %rdi
callq 0x1ac30
jmp 0x17cd1
jmp 0x17d05
jmp 0x17cb1
movq %rax, %r14
jmp 0x17ce0
movq %rax, %r14
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x17ce0
movq (%rdi), %rax
callq *0x18(%rax)
jmp 0x17ce0
jmp 0x17d05
jmp 0x17cce
movq %rax, %r14
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x17ce0
movq (%rdi), %rax
callq *0x18(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x18(%rax)
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x17cf9
movq (%rdi), %rax
callq *0x18(%rax)
movq %r14, %rdi
callq 0xbb300
jmp 0x17d05
jmp 0x17d05
movq %rax, %rdi
callq 0x18c71