// File: /workspace/github_c_makefile_star2_O0/pje[P]pixelsort/sorting.c
// Function: create_sort_plan
sort_plan_t * create_sort_plan(const struct image * img, const context_t * ctx, enum orientation_e o) {
    sort_plan_t * plan = (sort_plan_t*)malloc(sizeof(sort_plan_t));
    plan->next_step_ptr = NULL;
    plan->orientation = o;
    plan->context_ptr = ctx;
    plan->run_length = (ROW == o) ? img->width  : img->height;
    plan->run_count     = (ROW == o) ? img->height : img->width;
    switch(ctx->run_type) {
    case DARK:
        plan->run_processor_fn = dark_run_processor;
        break;
    case LIGHT:
        plan->run_processor_fn = light_run_processor;
        break;
    case ALL:
    default:
        plan->run_processor_fn = default_run_processor;
        break;
    }
    switch(ctx->comparison) {
    case AVG:
        plan->compare_fn = AVG_CMP;
        plan->sort_val_fn = AVG_VAL;
        break;
    case MUL:
        plan->compare_fn = MUL_CMP;
        plan->sort_val_fn = MUL_VAL;
        break;
    case MAX:
        plan->compare_fn = MAX_CMP;
        plan->sort_val_fn = MAX_VAL;
        break;
    case MIN:
        plan->compare_fn = MIN_CMP;
        plan->sort_val_fn = MIN_VAL;
        break;
    case XOR:
    default:
        plan->compare_fn = XOR_CMP;
        plan->sort_val_fn = XOR_VAL;
        break;
    }
    return plan;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl $0x38, %edi
callq 0x1110
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq $0x0, 0x30(%rax)
movl -0x14(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
movl $0x1, %eax
cmpl -0x14(%rbp), %eax
jne 0x117b9
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x24(%rbp)
jmp 0x117c3
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x4(%rax)
movl $0x1, %eax
cmpl -0x14(%rbp), %eax
jne 0x117e3
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x28(%rbp)
jmp 0x117ed
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x2c(%rbp)
testl %eax, %eax
je 0x1183c
jmp 0x11806
movl -0x2c(%rbp), %eax
subl $0x1, %eax
je 0x1181a
jmp 0x11810
movl -0x2c(%rbp), %eax
subl $0x2, %eax
je 0x1182b
jmp 0x1183e
movq -0x20(%rbp), %rax
leaq 0x56b(%rip), %rcx       # 0x11d90
movq %rcx, 0x10(%rax)
jmp 0x1184d
movq -0x20(%rbp), %rax
leaq 0x7aa(%rip), %rcx       # 0x11fe0
movq %rcx, 0x10(%rax)
jmp 0x1184d
jmp 0x1183e
movq -0x20(%rbp), %rax
leaq 0x9b7(%rip), %rcx       # 0x12200
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
movq %rax, -0x38(%rbp)
subq $0x4, %rax
ja 0x118fb
movq -0x38(%rbp), %rax
leaq 0x2d9f(%rip), %rcx      # 0x1460c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x20(%rbp), %rax
leaq 0x9af(%rip), %rcx       # 0x12230
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rax
leaq 0x9e0(%rip), %rcx       # 0x12270
movq %rcx, 0x18(%rax)
jmp 0x11919
movq -0x20(%rbp), %rax
leaq 0xa1c(%rip), %rcx       # 0x122c0
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rax
leaq 0xa4d(%rip), %rcx       # 0x12300
movq %rcx, 0x18(%rax)
jmp 0x11919
movq -0x20(%rbp), %rax
leaq 0xa8c(%rip), %rcx       # 0x12350
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rax
leaq 0xabd(%rip), %rcx       # 0x12390
movq %rcx, 0x18(%rax)
jmp 0x11919
movq -0x20(%rbp), %rax
leaq 0xb0c(%rip), %rcx       # 0x123f0
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rax
leaq 0xb3d(%rip), %rcx       # 0x12430
movq %rcx, 0x18(%rax)
jmp 0x11919
jmp 0x118fb
movq -0x20(%rbp), %rax
leaq 0xb8a(%rip), %rcx       # 0x12490
movq %rcx, 0x20(%rax)
movq -0x20(%rbp), %rax
leaq 0xbbb(%rip), %rcx       # 0x124d0
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)