// File: umdreamer[P]leetcodeproblems/zigzagConversion.cpp
// Function: Solution::method1(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
string method1(string s, int numRows) {
        if (numRows <= 1) {
            return s;
        }
        
        string blankString(s.length(), ' ');
        vector<string> zzs(numRows, blankString);
        
        int r = 0;
        int c = 0;
        int k = 0;
        for (;;) {
            while (r < numRows) {
                zzs[r][c] = s[k];
                k++;
                if (k >= s.length()) {
                    break;
                }
                r++;
            }
            if (k >= s.length()) {
                break;
            }
            r -= 2;
            c++;
            while (r >= 0) {
                zzs[r][c] = s[k];
                k++;
                if (k >= s.length()) {
                    break;
                }
                r--;
                c++;
            }
            if (k >= s.length()) {
                break;
            }
            r += 2;
            c--;
        }
        
        string line; 
        for (int r=0; r<numRows; ++r) {
            for (int c=0; c<s.length(); ++c) {
                if (zzs[r][c] != ' ') {
                    line.push_back(zzs[r][c]);
                }
            }
        }
        printString(zzs);
        printf("%s\n", line.c_str());
        return line;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdx, -0xc8(%rbp)
movq %rdi, -0xc0(%rbp)
movq %rdi, %rax
movq %rax, -0xb8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xb0(%rbp)
cmpl $0x1, -0x1c(%rbp)
jg 0x25db
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rdi
callq 0x20c0
jmp 0x2a64
movq -0xc8(%rbp), %rdi
callq 0x21e0
movq %rax, -0xd8(%rbp)
leaq -0x41(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x2210
movq -0xd8(%rbp), %rsi
movq -0xd0(%rbp), %rcx
leaq -0x40(%rbp), %rdi
movl $0x20, %edx
callq 0x2a80
jmp 0x261c
leaq -0x41(%rbp), %rdi
callq 0x2170
movslq -0x1c(%rbp), %rax
movq %rax, -0xe8(%rbp)
leaq -0x71(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x2af0
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rcx
leaq -0x70(%rbp), %rdi
leaq -0x40(%rbp), %rdx
callq 0x2b10
jmp 0x265d
leaq -0x71(%rbp), %rdi
callq 0x2b90
movl $0x0, -0x78(%rbp)
movl $0x0, -0x7c(%rbp)
movl $0x0, -0x80(%rbp)
jmp 0x267d
movl -0x78(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x2766
movq -0xc8(%rbp), %rdi
movslq -0x80(%rbp), %rsi
callq 0x2240
movq %rax, -0xf0(%rbp)
jmp 0x26a2
movq -0xf0(%rbp), %rax
movb (%rax), %al
movb %al, -0xf9(%rbp)
movslq -0x78(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x2bb0
movq %rax, %rdi
movslq -0x7c(%rbp), %rsi
callq 0x2240
movq %rax, -0xf8(%rbp)
jmp 0x26d3
movq -0xc8(%rbp), %rdi
movq -0xf8(%rbp), %rax
movb -0xf9(%rbp), %cl
movb %cl, (%rax)
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
movslq -0x80(%rbp), %rax
movq %rax, -0x108(%rbp)
callq 0x21e0
movq %rax, %rcx
movq -0x108(%rbp), %rax
cmpq %rcx, %rax
jb 0x2758
jmp 0x2766
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x41(%rbp), %rdi
callq 0x2170
jmp 0x2a74
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x71(%rbp), %rdi
callq 0x2b90
jmp 0x2a59
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x2a50
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x267d
movq -0xc8(%rbp), %rdi
movslq -0x80(%rbp), %rax
movq %rax, -0x110(%rbp)
callq 0x21e0
movq %rax, %rcx
movq -0x110(%rbp), %rax
cmpq %rcx, %rax
jb 0x2791
jmp 0x288d
movl -0x78(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x78(%rbp)
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
cmpl $0x0, -0x78(%rbp)
jl 0x284e
movq -0xc8(%rbp), %rdi
movslq -0x80(%rbp), %rsi
callq 0x2240
movq %rax, -0x118(%rbp)
jmp 0x27c6
movq -0x118(%rbp), %rax
movb (%rax), %al
movb %al, -0x121(%rbp)
movslq -0x78(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x2bb0
movq %rax, %rdi
movslq -0x7c(%rbp), %rsi
callq 0x2240
movq %rax, -0x120(%rbp)
jmp 0x27f7
movq -0xc8(%rbp), %rdi
movq -0x120(%rbp), %rax
movb -0x121(%rbp), %cl
movb %cl, (%rax)
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
movslq -0x80(%rbp), %rax
movq %rax, -0x130(%rbp)
callq 0x21e0
movq %rax, %rcx
movq -0x130(%rbp), %rax
cmpq %rcx, %rax
jb 0x2837
jmp 0x284e
movl -0x78(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x78(%rbp)
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x27a3
movq -0xc8(%rbp), %rdi
movslq -0x80(%rbp), %rax
movq %rax, -0x138(%rbp)
callq 0x21e0
movq %rax, %rcx
movq -0x138(%rbp), %rax
cmpq %rcx, %rax
jb 0x2876
jmp 0x288d
movl -0x78(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x78(%rbp)
movl -0x7c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x267b
movq -0xc0(%rbp), %rdi
movb $0x0, -0x81(%rbp)
callq 0x21c0
movl $0x0, -0x88(%rbp)
movl -0x88(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x29a6
movl $0x0, -0x8c(%rbp)
movq -0xc8(%rbp), %rdi
movslq -0x8c(%rbp), %rax
movq %rax, -0x140(%rbp)
callq 0x21e0
movq %rax, %rcx
movq -0x140(%rbp), %rax
cmpq %rcx, %rax
jae 0x2990
movslq -0x88(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x2bb0
movq %rax, %rdi
movslq -0x8c(%rbp), %rsi
callq 0x2240
movq %rax, -0x148(%rbp)
jmp 0x2918
movq -0x148(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
je 0x297a
movslq -0x88(%rbp), %rsi
leaq -0x70(%rbp), %rdi
callq 0x2bb0
movq %rax, %rdi
movslq -0x8c(%rbp), %rsi
callq 0x2240
movq %rax, -0x150(%rbp)
jmp 0x294f
movq -0xc0(%rbp), %rdi
movq -0x150(%rbp), %rax
movsbl (%rax), %esi
callq 0x2130
jmp 0x2967
jmp 0x297a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x2a44
jmp 0x297c
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x28c3
jmp 0x2992
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x28aa
leaq -0xa8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x2c40
jmp 0x29b8
movq -0xb0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x2bd0
jmp 0x29cd
leaq -0xa8(%rbp), %rdi
callq 0x2d30
movq -0xc0(%rbp), %rdi
callq 0x2080
movq %rax, %rsi
leaq 0x1624(%rip), %rdi      # 0x4013
xorl %eax, %eax
callq 0x2030
jmp 0x29f8
movb $0x1, -0x81(%rbp)
testb $0x1, -0x81(%rbp)
jne 0x2a30
jmp 0x2a24
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x2d30
jmp 0x2a44
movq -0xc0(%rbp), %rdi
callq 0x20d0
leaq -0x70(%rbp), %rdi
callq 0x2d30
leaq -0x40(%rbp), %rdi
callq 0x20d0
jmp 0x2a64
movq -0xc0(%rbp), %rdi
callq 0x20d0
leaq -0x70(%rbp), %rdi
callq 0x2d30
leaq -0x40(%rbp), %rdi
callq 0x20d0
jmp 0x2a74
movq -0xb8(%rbp), %rax
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x2200
nopl (%rax)