// File: /workspace/github_c_makefile_star2_O0/ryvnf[P]czc/type.c
// Function: type_dup
struct type *type_dup(struct type *t, enum type_tag flags)
{
    struct type *t2;
    switch (type_type(t->tag)) {
        case VOID_TYPE_FLAG:
        case BOOL_TYPE_FLAG:
        case INT_TYPE_FLAG:
        case FLOAT_TYPE_FLAG:
            t2 = malloc(sizeof *t2);
            memcpy(t2, t, sizeof *t2);
            break;
        case PTR_TYPE_FLAG:
            t2 = malloc(sizeof (struct ptr_type));
            memcpy(t2, t, sizeof (struct ptr_type));
            break;
        case ARRAY_TYPE_FLAG:
            t2 = malloc(sizeof (struct array_type));
            memcpy(t2, t, sizeof (struct array_type));
            break;
        case FUNC_TYPE_FLAG: {
            struct func_type *t_ = (struct func_type *)t;
            size_t n = sizeof *t_ + t_->n_params * sizeof *t_->params;
            struct func_type *t2_ = malloc(n);
            t2 = (struct type *)memcpy(t2_, t, n);
            break;
        }
        case STRUCT_TYPE_FLAG: {
            struct struct_type *t_ = (struct struct_type *)t;
            size_t n = sizeof *t_ + t_->n_fields * sizeof *t_->fields;
            struct struct_type *t2_ = malloc(n);
            t2 = (struct type *)memcpy(t2_, t, n);
            break;
        }
        default:
            unreachable();
    }
    t2->tag = (t2->tag & ~LVAL_TYPE_FLAG) | flags;
    return t2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %edi
callq 0x10f30
movl %eax, %ecx
movl %ecx, %eax
decl %eax
movl %ecx, -0x4c(%rbp)
subl $0x2, %eax
jb 0x10fd4
jmp 0x10f8a
movl -0x4c(%rbp), %eax
subl $0x4, %eax
je 0x10fd4
jmp 0x10f94
movl -0x4c(%rbp), %eax
subl $0x8, %eax
je 0x10ff3
jmp 0x10f9e
movl -0x4c(%rbp), %eax
subl $0x10, %eax
je 0x1101c
jmp 0x10fa8
movl -0x4c(%rbp), %eax
subl $0x20, %eax
je 0x1104d
jmp 0x10fb6
movl -0x4c(%rbp), %eax
subl $0x40, %eax
je 0x11095
jmp 0x10fc4
movl -0x4c(%rbp), %eax
subl $0x80, %eax
jne 0x110dd
jmp 0x10fd4
movl $0x4, %edi
callq 0x2170
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
movl (%rcx), %ecx
movl %ecx, (%rax)
jmp 0x110fe
movl $0x10, %edi
callq 0x2170
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
jmp 0x110fe
movl $0x18, %edi
callq 0x2170
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
jmp 0x110fe
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
shlq $0x3, %rax
addq $0x20, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x2170
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq %rdi, -0x58(%rbp)
movq -0x8(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x2160
movq -0x58(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x110fe
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
shlq $0x4, %rax
addq $0x20, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x2170
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movq %rdi, -0x60(%rbp)
movq -0x8(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x2160
movq -0x60(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x110fe
leaq 0x20ac(%rip), %rdi      # 0x13190
leaq 0x3653(%rip), %rsi      # 0x1473e
movl $0x1e6, %edx            # imm = 0x1E6
leaq 0x3743(%rip), %rcx      # 0x1483a
movb $0x0, %al
callq 0x6510
movq -0x18(%rbp), %rax
movl (%rax), %ecx
andl $0xfffffbff, %ecx       # imm = 0xFFFFFBFF
orl -0xc(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)