// File: tdv[P]boss/boss/examples/simple_enum/main.cpp
// Function: SetMyBets(Boss::RefObjPtr<Boss::IEnum>, unsigned int)
void SetMyBets(Boss::RefObjPtr<Boss::IEnum> collection, unsigned percent)
{
  Boss::EnumHelper<MyNs::IFaces::IAuction> 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->MyBet(Price + (Price * percent) / 100) != Boss::Status::Ok)
      throw std::runtime_error("Failed to set my bet for \"Auction\".");
  }
}

// Assembly:
subq $0xa8, %rsp
movl %esi, %eax
movq %rdi, %rsi
movq %rsi, 0xa0(%rsp)
movl %eax, 0x9c(%rsp)
leaq 0x88(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x1a2b0
movq 0x50(%rsp), %rsi
leaq 0x90(%rsp), %rdi
callq 0x1b190
jmp 0x19501
leaq 0x88(%rsp), %rdi
callq 0x1a3b0
leaq 0x70(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x1b240
jmp 0x19522
jmp 0x19524
leaq 0x70(%rsp), %rdi
callq 0x1b2d0
movq %rax, 0x48(%rsp)
jmp 0x19535
movq 0x48(%rsp), %rax
cmpq $0x0, %rax
jne 0x1959e
leaq 0x70(%rsp), %rdi
callq 0x1b4f0
jmp 0x19802
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x80(%rsp)
movl %eax, 0x7c(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x1a3b0
jmp 0x19824
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x80(%rsp)
movl %eax, 0x7c(%rsp)
jmp 0x19817
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x80(%rsp)
movl %eax, 0x7c(%rsp)
jmp 0x197f6
leaq 0x68(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x1b2e0
jmp 0x195af
leaq 0x68(%rsp), %rdi
callq 0x1a4c0
movq %rax, 0x40(%rsp)
jmp 0x195c0
movq 0x40(%rsp), %rax
cmpq $0x0, %rax
jne 0x19641
movl $0x10, %edi
callq 0x23000
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x38(%rsp)
leaq 0xadbef(%rip), %rsi     # 0xc71d6
callq 0x365a0
jmp 0x195ee
movq 0x38(%rsp), %rdi
leaq 0xe92b6(%rip), %rsi     # 0x1028b0
leaq 0x1361f(%rip), %rdx     # 0x2cc20
callq 0x24050
jmp 0x19831
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x80(%rsp)
movl %eax, 0x7c(%rsp)
jmp 0x197cf
movq 0x38(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x80(%rsp)
movl %eax, 0x7c(%rsp)
callq 0x23060
jmp 0x197cf
movq $0x0, 0x60(%rsp)
leaq 0x68(%rsp), %rdi
callq 0x1a4d0
movq %rax, 0x30(%rsp)
jmp 0x1965b
movq 0x30(%rsp), %rdi
movq (%rdi), %rax
movq 0x28(%rax), %rax
leaq 0x60(%rsp), %rsi
callq *%rax
movl %eax, 0x2c(%rsp)
jmp 0x19674
movl 0x2c(%rsp), %eax
cmpl $0x0, %eax
je 0x196dd
movl $0x10, %edi
callq 0x23000
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x20(%rsp)
leaq 0xadb59(%rip), %rsi     # 0xc71f2
callq 0x365a0
jmp 0x196a0
movq 0x20(%rsp), %rdi
leaq 0xe9204(%rip), %rsi     # 0x1028b0
leaq 0x1356d(%rip), %rdx     # 0x2cc20
callq 0x24050
jmp 0x19831
movq 0x20(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x80(%rsp)
movl %eax, 0x7c(%rsp)
callq 0x23060
jmp 0x197cf
leaq 0x70(%rsp), %rdi
callq 0x1b330
movq %rax, 0x18(%rsp)
jmp 0x196ee
movq 0x18(%rsp), %rdi
movsd 0x60(%rsp), %xmm0
movl 0x9c(%rsp), %eax
cvtsi2sd %rax, %xmm2
movaps %xmm0, %xmm1
mulsd %xmm2, %xmm1
movsd 0xad91c(%rip), %xmm2    # 0xc7030
divsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movq (%rdi), %rax
movq 0x28(%rax), %rax
callq *%rax
movl %eax, 0x14(%rsp)
jmp 0x1972b
movl 0x14(%rsp), %eax
cmpl $0x0, %eax
je 0x19791
movl $0x10, %edi
callq 0x23000
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x8(%rsp)
leaq 0xadb1f(%rip), %rsi     # 0xc726f
callq 0x365a0
jmp 0x19757
movq 0x8(%rsp), %rdi
leaq 0xe914d(%rip), %rsi     # 0x1028b0
leaq 0x134b6(%rip), %rdx     # 0x2cc20
callq 0x24050
jmp 0x19831
movq 0x8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x80(%rsp)
movl %eax, 0x7c(%rsp)
callq 0x23060
jmp 0x197cf
leaq 0x68(%rsp), %rdi
callq 0x1a4e0
leaq 0x58(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x1b340
jmp 0x197af
leaq 0x70(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x1b4b0
jmp 0x197c0
leaq 0x58(%rsp), %rdi
callq 0x1b4f0
jmp 0x19524
leaq 0x68(%rsp), %rdi
callq 0x1a4e0
jmp 0x197f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x80(%rsp)
movl %eax, 0x7c(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x1b4f0
leaq 0x70(%rsp), %rdi
callq 0x1b4f0
jmp 0x19817
leaq 0x90(%rsp), %rdi
callq 0x1b510
addq $0xa8, %rsp
retq
leaq 0x90(%rsp), %rdi
callq 0x1b510
movq 0x80(%rsp), %rdi
callq 0xc42f0
nopw %cs:(%rax,%rax)