// File: hzeller[P]gcode-multi-shell-extrude/printer.cc
// Function: (anonymous namespace)::GCodePrinter::Init(Vector2D const&, double)
virtual void Init(const Vector2D &machine_limit,
                    double feed_mm_per_sec) {
    printf("G28\nG1 F%.1f\n", feed_mm_per_sec * 60);
    printf("G1 Z5\n");
    printf("M82      ; absolute E\n"
           "G92 E0.0 ; zero E\n");
    const bool with_heated_bed = bed_temp_ > 0 && bed_temp_ < 120;
    if (with_heated_bed) {
      printf("M140 S%.0f  ; not waiting for it yet\n", bed_temp_);
    }

    // Bed leveling
    printf("\n");
    Comment("Bed leveling\n");
    printf("M84 E         ; turn off e motor\n");
    printf("M109 S170     ; min temperature not have soft nozzle buggers\n");
    printf("G1 E-2 F2400  ; retract to not ooze while bed leveling\n");
    printf("M84 E\n");
    printf("G28 Z0        ; Establish a general Z0\n");
    printf("G29           ; bed levelling after everything is hot\n\n");

    Comment("Wait for all temperatures reached\n");
    printf("G1 E0\n");
    printf("G0 X%.1f Y10 Z30 F6000 ; move to center front while heating\n",
           machine_limit.x/2);

    SetTemperature(temperature_);

    // Waiting for temperature
    printf("M109 S%.0f\n", temperature_);
    if (with_heated_bed) {
      printf("M190 S%.0f ; wait for bed-temp\n", bed_temp_);
    }

    printf("M82      ; absolute E\nG92 E0.0 ; zero E\n");
    printf("G1 E3    ; squirt out some test in air\n"); // squirt out some test
    printf("G92 E0.0\n\n; test extrusion...\n");
    const double test_extrusion_from = 0.5 * machine_limit.x;
    const double test_extrusion_to = 0.1 * machine_limit.x;
    SetSpeed(300.0);
    MoveTo(Vector2D(test_extrusion_from, 10), 0.2);
    SetSpeed(15);
    ExtrudeTo(Vector2D((test_extrusion_from + test_extrusion_to)/2, 10),
              0.2, 1.0);
    // Remaining just move to wipe nozzle properly.
    MoveTo(Vector2D(test_extrusion_to, 10), 0.2);
    Retract();
    GoZPos(5);
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movsd %xmm0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
movsd 0x1d653(%rip), %xmm0    # 0x2bf68
mulsd -0x18(%rbp), %xmm0
leaq 0x1d6ea(%rip), %rdi     # 0x2c00b
movb $0x1, %al
callq 0x3040
leaq 0x1d6ea(%rip), %rdi     # 0x2c019
movb $0x0, %al
callq 0x3040
leaq 0x1d6e3(%rip), %rdi     # 0x2c020
movb $0x0, %al
callq 0x3040
movq -0x70(%rbp), %rax
movsd 0x28(%rax), %xmm0
xorl %eax, %eax
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
movb %al, -0x61(%rbp)
jbe 0xe972
movq -0x70(%rbp), %rax
movsd 0x1d609(%rip), %xmm0    # 0x2bf70
ucomisd 0x28(%rax), %xmm0
seta %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
andb $0x1, %al
movb %al, -0x19(%rbp)
testb $0x1, -0x19(%rbp)
je 0xe997
movq -0x70(%rbp), %rax
movsd 0x28(%rax), %xmm0
leaq 0x1d6b9(%rip), %rdi     # 0x2c049
movb $0x1, %al
callq 0x3040
leaq 0x1d66b(%rip), %rdi     # 0x2c009
movb $0x0, %al
callq 0x3040
movq -0x70(%rbp), %rdi
movq (%rdi), %rcx
leaq 0x1d6bc(%rip), %rsi     # 0x2c06f
movb $0x0, %al
callq *0x18(%rcx)
leaq 0x1d6be(%rip), %rdi     # 0x2c07d
movb $0x0, %al
callq 0x3040
leaq 0x1d6d2(%rip), %rdi     # 0x2c09f
movb $0x0, %al
callq 0x3040
leaq 0x1d702(%rip), %rdi     # 0x2c0dd
movb $0x0, %al
callq 0x3040
leaq 0x1d72c(%rip), %rdi     # 0x2c115
movb $0x0, %al
callq 0x3040
leaq 0x1d725(%rip), %rdi     # 0x2c11c
movb $0x0, %al
callq 0x3040
leaq 0x1d73f(%rip), %rdi     # 0x2c144
movb $0x0, %al
callq 0x3040
movq -0x70(%rbp), %rdi
movq (%rdi), %rcx
leaq 0x1d762(%rip), %rsi     # 0x2c17c
movb $0x0, %al
callq *0x18(%rcx)
leaq 0x1d779(%rip), %rdi     # 0x2c19f
movb $0x0, %al
callq 0x3040
movq -0x10(%rbp), %rax
movsd (%rax), %xmm0
movsd 0x1c603(%rip), %xmm1    # 0x2b040
divsd %xmm1, %xmm0
leaq 0x1d75e(%rip), %rdi     # 0x2c1a6
movb $0x1, %al
callq 0x3040
movq -0x70(%rbp), %rdi
movsd 0x20(%rdi), %xmm0
movq (%rdi), %rax
callq *0x20(%rax)
movq -0x70(%rbp), %rax
movsd 0x20(%rax), %xmm0
leaq 0x1d775(%rip), %rdi     # 0x2c1e3
movb $0x1, %al
callq 0x3040
testb $0x1, -0x19(%rbp)
je 0xea92
movq -0x70(%rbp), %rax
movsd 0x28(%rax), %xmm0
leaq 0x1d764(%rip), %rdi     # 0x2c1ef
movb $0x1, %al
callq 0x3040
leaq 0x1d587(%rip), %rdi     # 0x2c020
movb $0x0, %al
callq 0x3040
leaq 0x1d768(%rip), %rdi     # 0x2c20f
movb $0x0, %al
callq 0x3040
leaq 0x1d782(%rip), %rdi     # 0x2c237
movb $0x0, %al
callq 0x3040
movq -0x70(%rbp), %rdi
movq -0x10(%rbp), %rax
movsd 0x1d4cc(%rip), %xmm0    # 0x2bf98
mulsd (%rax), %xmm0
movsd %xmm0, -0x28(%rbp)
movq -0x10(%rbp), %rax
movsd 0x1c547(%rip), %xmm0    # 0x2b028
mulsd (%rax), %xmm0
movsd %xmm0, -0x30(%rbp)
movq (%rdi), %rax
movsd 0x1d49b(%rip), %xmm0    # 0x2bf90
callq *0x28(%rax)
movsd -0x28(%rbp), %xmm0
leaq -0x40(%rbp), %rdi
movsd 0x1d477(%rip), %xmm1    # 0x2bf80
callq 0x8470
movq -0x70(%rbp), %rdi
movq (%rdi), %rax
leaq -0x40(%rbp), %rsi
movsd 0x1d457(%rip), %xmm0    # 0x2bf78
callq *0x48(%rax)
movq -0x70(%rbp), %rdi
movq (%rdi), %rax
movsd 0x1d455(%rip), %xmm0    # 0x2bf88
callq *0x28(%rax)
movsd -0x28(%rbp), %xmm0
addsd -0x30(%rbp), %xmm0
movsd 0x1c4f8(%rip), %xmm1    # 0x2b040
divsd %xmm1, %xmm0
leaq -0x50(%rbp), %rdi
movsd 0x1d428(%rip), %xmm1    # 0x2bf80
callq 0x8470
movq -0x70(%rbp), %rdi
movq (%rdi), %rax
leaq -0x50(%rbp), %rsi
movsd 0x1d408(%rip), %xmm0    # 0x2bf78
movsd 0x1c4b8(%rip), %xmm1    # 0x2b030
callq *0x50(%rax)
movsd -0x30(%rbp), %xmm0
leaq -0x60(%rbp), %rdi
movsd 0x1d3f4(%rip), %xmm1    # 0x2bf80
callq 0x8470
movq -0x70(%rbp), %rdi
movq (%rdi), %rax
leaq -0x60(%rbp), %rsi
movsd 0x1d3d4(%rip), %xmm0    # 0x2bf78
callq *0x48(%rax)
movq -0x70(%rbp), %rdi
movq (%rdi), %rax
callq *0x38(%rax)
movq -0x70(%rbp), %rdi
movq (%rdi), %rax
movsd 0x1c460(%rip), %xmm0    # 0x2b020
callq *0x40(%rax)
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)