// File: /workspace/github_cpp_makefile_star2_O2/Aries-orz[P]Ari-RayTracing/src/Demo.cpp
// Function: generateWorld(rt::Scene&)
void generateWorld(Scene& scene) {
    //Add the walls
    scene.addObj(new RTPlane(Vec3d(1, 0, 0), Vec3d(1, 0, 0), RTObject::DIFFUSE, Vec3d(), Vec3d(.75, .25, .25)));//left
    scene.addObj(new RTPlane(Vec3d(99, 0, 0), Vec3d(-1, 0, 0), RTObject::DIFFUSE, Vec3d(), Vec3d(.25, .75, .25)));//right
    scene.addObj(new RTPlane(Vec3d(0, 0, 0), Vec3d(0, 0, 1), RTObject::REFRACTIVE, Vec3d(), Vec3d(1, 1, 1)));//back
    scene.addObj(new RTPlane(Vec3d(0, 0, 300), Vec3d(0, 0, -1), RTObject::REFRACTIVE, Vec3d(), Vec3d()));//front
    scene.addObj(new RTPlane(Vec3d(0, 0, 0), Vec3d(0, 1, 0), RTObject::DIFFUSE, Vec3d(), Vec3d(.75, .75, .75)));//bottom
    scene.addObj(new RTPlane(Vec3d(0, 81.6, 0), Vec3d(0, -1, 0), RTObject::DIFFUSE, Vec3d(), Vec3d(.75, .75, .75)));//top
    
    //Add the light
    scene.addObj(new RTTriangle(Vec3d(40, 81.6-.01, 70), Vec3d(60, 81.6-.01, 70), Vec3d(40, 81.6-.01, 90),
                                RTObject::DIFFUSE, Vec3d(12, 12, 12), Vec3d()));
    scene.addObj(new RTTriangle(Vec3d(60, 81.6-.01, 90), Vec3d(60, 81.6-.01, 70), Vec3d(40, 81.6-.01, 90),
                                RTObject::DIFFUSE, Vec3d(12, 12, 12), Vec3d()));
    
    //Add two sphere
    scene.addObj(new RTSphere(Vec3d(45,12,120),    Vec3d(), Vec3d(1,1,1)*.999, 12, RTObject::REFRACTIVE));
    scene.addObj(new RTSphere(Vec3d(27,52.001,47), Vec3d(), Vec3d(1,1,1)*.999, 12, RTObject::DIFFUSE));

    //Add one box
    scene.addObj(new RTBox(Vec3d(10.5,0,30.5), Vec3d(43.5,40,63.5), RTObject::DIFFUSE, Vec3d(), Vec3d(1,1,1)*.999));
    
    //Parse the .obj file
    ObjParser parser;
    parser.readFromObj("test_data/block.obj");
    int num = parser.numOfFaces;
    
    //Add the block object
    RTTriangle* indices = new RTTriangle[num];
    for (int i=0; i<num; ++i) {
        Vec3d p0 = parser.verticeList[parser.faceList[i][0]];
        Vec3d p1 = parser.verticeList[parser.faceList[i][1]];
        Vec3d p2 = parser.verticeList[parser.faceList[i][2]];
        indices[i] = RTTriangle(p0+Vec3d(73,10,79), p1+Vec3d(73,10,79), p2+Vec3d(73,10,79), RTObject::DIFFUSE, Vec3d(), Vec3d(0,0,1));
    }
    RTBBox *bbox = new RTBBox(Vec3d(53,0,68), Vec3d(93,20,88)); //Add a bounding box for the complex object
    scene.addObj(new RTComplexObj(indices, bbox, num, RTObject::DIFFUSE, Vec3d(), Vec3d(0,0,1)));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x668, %rsp            # imm = 0x668
movq %rdi, %rbp
pushq $0x70
popq %rdi
callq 0x2110
movq %rax, %r14
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
leaq 0x270(%rsp), %rsi
movq %rax, (%rsi)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rsi)
leaq 0x10(%rsp), %rdx
movq %rax, (%rdx)
movups %xmm0, 0x8(%rdx)
leaq 0x620(%rsp), %r8
movaps %xmm0, (%r8)
andq $0x0, 0x10(%r8)
movaps 0x3cb5(%rip), %xmm0     # 0x6010
leaq 0x600(%rsp), %r9
movaps %xmm0, (%r9)
movabsq $0x3fd0000000000000, %r15 # imm = 0x3FD0000000000000
movq %r15, 0x10(%r9)
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x51b8
movq %rbp, %rdi
movq %r14, %rsi
callq 0x58ea
pushq $0x70
popq %rdi
callq 0x2110
movq %rax, %r14
movabsq $0x4058c00000000000, %rax # imm = 0x4058C00000000000
leaq 0x270(%rsp), %rsi
movq %rax, (%rsi)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rsi)
movabsq $-0x4010000000000000, %rbx # imm = 0xBFF0000000000000
leaq 0x10(%rsp), %rdx
movq %rbx, (%rdx)
movups %xmm0, 0x8(%rdx)
leaq 0x5e0(%rsp), %r8
movaps %xmm0, (%r8)
andq $0x0, 0x10(%r8)
movaps 0x3c41(%rip), %xmm0     # 0x6020
leaq 0x5c0(%rsp), %r9
movaps %xmm0, (%r9)
movq %r15, 0x10(%r9)
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x51b8
movq %rbp, %rdi
movq %r14, %rsi
callq 0x58ea
pushq $0x70
popq %rdi
callq 0x2110
movq %rax, %r14
xorps %xmm0, %xmm0
leaq 0x270(%rsp), %rsi
movaps %xmm0, (%rsi)
andq $0x0, 0x10(%rsi)
leaq 0x10(%rsp), %rdx
movaps %xmm0, (%rdx)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x10(%rdx)
leaq 0x5a0(%rsp), %r8
movaps %xmm0, (%r8)
andq $0x0, 0x10(%r8)
movaps 0x3be0(%rip), %xmm0     # 0x6030
leaq 0x580(%rsp), %r9
movaps %xmm0, (%r9)
movq %rax, 0x10(%r9)
pushq $0x2
popq %rcx
movq %r14, %rdi
callq 0x51b8
movq %rbp, %rdi
movq %r14, %rsi
callq 0x58ea
pushq $0x70
popq %rdi
callq 0x2110
movq %rax, %r14
leaq 0x270(%rsp), %rsi
xorps %xmm0, %xmm0
movaps %xmm0, (%rsi)
movabsq $0x4072c00000000000, %rax # imm = 0x4072C00000000000
movq %rax, 0x10(%rsi)
leaq 0x10(%rsp), %rdx
movaps %xmm0, (%rdx)
movq %rbx, 0x10(%rdx)
leaq 0x560(%rsp), %r8
movaps %xmm0, (%r8)
andq $0x0, 0x10(%r8)
leaq 0x540(%rsp), %r9
movaps %xmm0, (%r9)
andq $0x0, 0x10(%r9)
pushq $0x2
popq %rcx
movq %r14, %rdi
callq 0x51b8
movq %rbp, %rdi
movq %r14, %rsi
callq 0x58ea
pushq $0x70
popq %rdi
callq 0x2110
movq %rax, %r14
leaq 0x270(%rsp), %rsi
andq $0x0, 0x10(%rsi)
xorps %xmm0, %xmm0
movhps 0x3bed(%rip), %xmm0     # xmm0 = xmm0[0,1],mem[0,1]
leaq 0x10(%rsp), %rdx
movaps %xmm0, (%rdx)
andq $0x0, 0x10(%rdx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsi)
leaq 0x520(%rsp), %r8
movaps %xmm0, (%r8)
andq $0x0, 0x10(%r8)
movaps 0x3b12(%rip), %xmm0     # 0x6040
leaq 0x500(%rsp), %r9
movaps %xmm0, (%r9)
movabsq $0x3fe8000000000000, %rbx # imm = 0x3FE8000000000000
movq %rbx, 0x10(%r9)
movq %rax, %rdi
xorl %ecx, %ecx
callq 0x51b8
movq %rbp, %rdi
movq %r14, %rsi
callq 0x58ea
pushq $0x70
popq %rdi
callq 0x2110
movq %rax, %r14
xorps %xmm0, %xmm0
movhps 0x3b86(%rip), %xmm0     # xmm0 = xmm0[0,1],mem[0,1]
leaq 0x270(%rsp), %rsi
movaps %xmm0, (%rsi)
andq $0x0, 0x10(%rsi)
xorps %xmm0, %xmm0
movhps 0x3b74(%rip), %xmm0     # xmm0 = xmm0[0,1],mem[0,1]
leaq 0x10(%rsp), %rdx
movaps %xmm0, (%rdx)
andq $0x0, 0x10(%rdx)
leaq 0x4e0(%rsp), %r8
andq $0x0, 0x10(%r8)
xorps %xmm0, %xmm0
movaps %xmm0, (%r8)
leaq 0x4c0(%rsp), %r9
movaps 0x3a84(%rip), %xmm0     # 0x6040
movaps %xmm0, (%r9)
movq %rbx, 0x10(%r9)
movq %rax, %rdi
xorl %ecx, %ecx
callq 0x51b8
movq %rbp, %rdi
movq %r14, %rsi
callq 0x58ea
movl $0x88, %edi
callq 0x2110
movq %rax, %r14
movaps 0x3a63(%rip), %xmm0     # 0x6050
leaq 0x4a0(%rsp), %rsi
movaps %xmm0, (%rsi)
movabsq $0x4051800000000000, %rbx # imm = 0x4051800000000000
movq %rbx, 0x10(%rsi)
movaps 0x3a53(%rip), %xmm1     # 0x6060
leaq 0x480(%rsp), %rdx
movaps %xmm1, (%rdx)
movq %rbx, 0x10(%rdx)
leaq 0x460(%rsp), %rcx
movaps %xmm0, (%rcx)
movabsq $0x4056800000000000, %r15 # imm = 0x4056800000000000
movq %r15, 0x10(%rcx)
movaps 0x3a34(%rip), %xmm0     # 0x6070
leaq 0x440(%rsp), %r9
movaps %xmm0, (%r9)
movabsq $0x4028000000000000, %r12 # imm = 0x4028000000000000
movq %r12, 0x10(%r9)
xorps %xmm0, %xmm0
leaq 0x420(%rsp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq %rax, (%rsp)
movq %r14, %rdi
xorl %r8d, %r8d
callq 0x5520
movq %rbp, %rdi
movq %r14, %rsi
callq 0x58ea
movl $0x88, %edi
callq 0x2110
movq %rax, %r14
leaq 0x400(%rsp), %rsi
movaps 0x39c1(%rip), %xmm0     # 0x6060
movaps %xmm0, (%rsi)
movq %r15, 0x10(%rsi)
leaq 0x3e0(%rsp), %rdx
movaps %xmm0, (%rdx)
movq %rbx, 0x10(%rdx)
leaq 0x3c0(%rsp), %rcx
movaps 0x398c(%rip), %xmm0     # 0x6050
movaps %xmm0, (%rcx)
movq %r15, 0x10(%rcx)
leaq 0x3a0(%rsp), %r9
movaps 0x3996(%rip), %xmm0     # 0x6070
movaps %xmm0, (%r9)
movq %r12, 0x10(%r9)
leaq 0x380(%rsp), %rax
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq %rax, (%rsp)
movq %r14, %rdi
xorl %r8d, %r8d
callq 0x5520
movq %rbp, %rdi
movq %r14, %rsi
callq 0x58ea
pushq $0x60
popq %rdi
callq 0x2110
movq %rax, %r14
movaps 0x395f(%rip), %xmm0     # 0x6080
movaps %xmm0, 0x1b0(%rsp)
movabsq $0x405e000000000000, %rax # imm = 0x405E000000000000
movq %rax, 0x1c0(%rsp)
xorps %xmm0, %xmm0
andq $0x0, 0x1a0(%rsp)
movaps %xmm0, 0x190(%rsp)
leaq 0x270(%rsp), %rsi
movaps 0x38d2(%rip), %xmm0     # 0x6030
movaps %xmm0, (%rsi)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x10(%rsi)
leaq 0x258(%rsp), %rdi
movsd 0x3989(%rip), %xmm0     # 0x6108
callq 0x5c12
leaq 0x1b0(%rsp), %rsi
leaq 0x190(%rsp), %rdx
leaq 0x258(%rsp), %rcx
movsd 0x396c(%rip), %xmm0     # 0x6110
pushq $0x2
popq %r8
movq %r14, %rdi
callq 0x531c
movq %rbp, %rdi
movq %r14, %rsi
callq 0x58ea
pushq $0x60
popq %rdi
callq 0x2110
movq %rax, %r14
movaps 0x38c3(%rip), %xmm0     # 0x6090
movaps %xmm0, 0x170(%rsp)
movabsq $0x4047800000000000, %rax # imm = 0x4047800000000000
movq %rax, 0x180(%rsp)
xorps %xmm0, %xmm0
andq $0x0, 0x160(%rsp)
movaps %xmm0, 0x150(%rsp)
leaq 0x270(%rsp), %rsi
movaps 0x3826(%rip), %xmm0     # 0x6030
movaps %xmm0, (%rsi)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x10(%rsi)
leaq 0x240(%rsp), %rdi
movsd 0x38dd(%rip), %xmm0     # 0x6108
callq 0x5c12
leaq 0x170(%rsp), %rsi
leaq 0x150(%rsp), %rdx
leaq 0x240(%rsp), %rcx
movsd 0x38c0(%rip), %xmm0     # 0x6110
movq %r14, %rdi
xorl %r8d, %r8d
callq 0x531c
movq %rbp, %rdi
movq %r14, %rsi
callq 0x58ea
pushq $0x78
popq %rdi
callq 0x2110
movq %rax, %r14
movsd 0x389f(%rip), %xmm0     # 0x6118
movaps %xmm0, 0x130(%rsp)
movabsq $0x403e800000000000, %rax # imm = 0x403E800000000000
movq %rax, 0x140(%rsp)
movaps 0x3806(%rip), %xmm0     # 0x60a0
movaps %xmm0, 0x110(%rsp)
movabsq $0x404fc00000000000, %rax # imm = 0x404FC00000000000
movq %rax, 0x120(%rsp)
xorps %xmm0, %xmm0
andq $0x0, 0x100(%rsp)
movaps %xmm0, 0xf0(%rsp)
leaq 0x270(%rsp), %rsi
movaps 0x3759(%rip), %xmm0     # 0x6030
movaps %xmm0, (%rsi)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x10(%rsi)
leaq 0x228(%rsp), %rdi
movsd 0x3810(%rip), %xmm0     # 0x6108
callq 0x5c12
leaq 0x130(%rsp), %rsi
leaq 0x110(%rsp), %rdx
leaq 0xf0(%rsp), %r8
leaq 0x228(%rsp), %r9
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x4c4c
movq %rbp, %rdi
movq %r14, %rsi
callq 0x58ea
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x4010
leaq 0x37ea(%rip), %rsi      # 0x6130
movq %rbx, %rdi
callq 0x405c
movslq 0x14(%rsp), %rbx
movl $0x88, %ecx
movq %rbx, %rax
mulq %rcx
movq %rax, %r14
seto %al
addq $0x8, %r14
pushq $-0x1
popq %rcx
cmovbq %rcx, %r14
testb %al, %al
cmovneq %rcx, %r14
movq %r14, %rdi
callq 0x2030
movq %rax, %r15
movq %rbx, (%rax)
addq $0x8, %rax
movq %rax, 0x30(%rsp)
movq %rbx, 0x38(%rsp)
testl %ebx, %ebx
je 0x29c1
imulq $-0x88, 0x38(%rsp), %r13
xorl %r12d, %r12d
movq 0x30(%rsp), %rbx
movq %rbx, %rdi
callq 0x54f0
addq $-0x88, %r12
addq $0x88, %rbx
cmpq %r12, %r13
jne 0x29a6
movq %rbp, 0x40(%rsp)
xorl %ebp, %ebp
movq 0x38(%rsp), %rcx
testl %ecx, %ecx
movl $0x0, %eax
cmovgl %ecx, %eax
imulq $0xc, %rax, %rax
movq %rax, 0x48(%rsp)
movabsq $0x4053c00000000000, %r15 # imm = 0x4053C00000000000
leaq 0x650(%rsp), %r14
leaq 0x638(%rsp), %rbx
leaq 0x270(%rsp), %r12
movq 0x30(%rsp), %r13
cmpq %rbp, 0x48(%rsp)
je 0x2b72
movq 0x20(%rsp), %rax
movslq (%rax,%rbp), %rax
imulq $0x18, %rax, %rsi
addq 0x18(%rsp), %rsi
leaq 0x210(%rsp), %rdi
callq 0x5b94
movq 0x20(%rsp), %rax
movslq 0x4(%rax,%rbp), %rax
imulq $0x18, %rax, %rsi
addq 0x18(%rsp), %rsi
leaq 0x1f8(%rsp), %rdi
callq 0x5b94
movq 0x20(%rsp), %rax
movslq 0x8(%rax,%rbp), %rax
imulq $0x18, %rax, %rsi
addq 0x18(%rsp), %rsi
leaq 0x1e0(%rsp), %rdi
callq 0x5b94
movaps 0x3638(%rip), %xmm0     # 0x60b0
movaps %xmm0, 0xd0(%rsp)
movq %r15, 0xe0(%rsp)
leaq 0x1c8(%rsp), %rdi
leaq 0x210(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
callq 0x5ba6
movaps 0x3604(%rip), %xmm0     # 0x60b0
movaps %xmm0, 0xb0(%rsp)
movq %r15, 0xc0(%rsp)
movq %r14, %rdi
leaq 0x1f8(%rsp), %rsi
leaq 0xb0(%rsp), %rdx
callq 0x5ba6
movaps 0x35d5(%rip), %xmm0     # 0x60b0
movaps %xmm0, 0x90(%rsp)
movq %r15, 0xa0(%rsp)
movq %rbx, %rdi
leaq 0x1e0(%rsp), %rsi
leaq 0x90(%rsp), %rdx
callq 0x5ba6
andq $0x0, 0x80(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x50(%rsp)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x60(%rsp)
leaq 0x50(%rsp), %rax
movq %rax, (%rsp)
movq %r12, %rdi
leaq 0x1c8(%rsp), %rsi
movq %r14, %rdx
movq %rbx, %rcx
xorl %r8d, %r8d
leaq 0x70(%rsp), %r9
callq 0x5520
movq %r13, %rdi
movq %r12, %rsi
callq 0x2e10
movq %r12, %rdi
callq 0x51b4
addq $0xc, %rbp
addq $0x88, %r13
jmp 0x2a07
pushq $0x70
popq %rdi
callq 0x2110
movq 0x40(%rsp), %rbx
movq %rax, %r14
movsd 0x3596(%rip), %xmm0     # 0x6120
leaq 0x360(%rsp), %rsi
movaps %xmm0, (%rsi)
movabsq $0x4051000000000000, %rax # imm = 0x4051000000000000
movq %rax, 0x10(%rsi)
movaps 0x3516(%rip), %xmm0     # 0x60c0
leaq 0x340(%rsp), %rdx
movaps %xmm0, (%rdx)
movabsq $0x4056000000000000, %rax # imm = 0x4056000000000000
movq %rax, 0x10(%rdx)
movq %r14, %rdi
callq 0x4a94
pushq $0x58
popq %rdi
callq 0x2110
movq %rax, %r15
xorps %xmm0, %xmm0
leaq 0x320(%rsp), %r9
andq $0x0, 0x10(%r9)
movaps %xmm0, (%r9)
leaq 0x300(%rsp), %rax
movaps %xmm0, (%rax)
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0x10(%rax)
movq %rax, (%rsp)
movq %r15, %rdi
movq 0x30(%rsp), %rsi
movq %r14, %rdx
movq 0x38(%rsp), %rcx
xorl %r8d, %r8d
callq 0x4f8c
movq %rbx, %rdi
movq %r15, %rsi
callq 0x58ea
leaq 0x10(%rsp), %rdi
callq 0x401c
addq $0x668, %rsp            # imm = 0x668
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
pushq $0x58
popq %rsi
movq %r15, %rdi
jmp 0x2c5a
movq %rax, %rbx
pushq $0x70
popq %rsi
movq %r14, %rdi
callq 0x2120
jmp 0x2cf6
jmp 0x2cf3
jmp 0x2cf3
jmp 0x2c70
movq %rax, %rbx
movl $0x88, %esi
jmp 0x2c9a
jmp 0x2c84
jmp 0x2c84
jmp 0x2c84
jmp 0x2c84
jmp 0x2c84
movq %rax, %rbx
pushq $0x70
jmp 0x2c99
movq %rax, %rbx
pushq $0x78
jmp 0x2c99
jmp 0x2c94
movq %rax, %rbx
pushq $0x60
popq %rsi
movq %r14, %rdi
callq 0x2120
jmp 0x2d00
jmp 0x2cf3
movq %rax, %rbx
testq %r12, %r12
je 0x2cca
negq %r12
movq %r15, %r13
addq $-0x80, %r13
leaq (%r12,%r13), %rdi
callq 0x51b4
addq $-0x88, %r12
jne 0x2cb8
movq %r15, %rdi
movq %r14, %rsi
callq 0x21f0
jmp 0x2cf6
jmp 0x2cf3
movq %rax, %rbx
leaq 0x270(%rsp), %rdi
callq 0x51b4
jmp 0x2cf6
jmp 0x2cf3
jmp 0x2cf3
jmp 0x2cf3
jmp 0x2cf3
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x401c
movq %rbx, %rdi
callq 0x21c0