// File: /workspace/github_c_makefile_star2_O0/Ziddykins[P]Dawn/src/player.c
// Function: init_new_character
void init_new_character(struct Message *message) {
    //Check if user exists
    char out[MAX_MESSAGE_BUFFER];
    char tmp_pwd[] = "temp";

    if (get_pindex(message->sender_nick) != -1) {
        sprintf(out, "PRIVMSG %s :You already have an account!\r\n", dawn->active_room);
        add_msg(out, strlen(out));
        return;
    }

    struct Player np;
    bzero(&np, sizeof np);

    np.pos_x = 0;
    np.pos_y = 1;

    strncpy(np.username, message->sender_nick, MAX_NICK_LENGTH);
    gen_salt(np.salt, 16);
    hash_pwd(np.pwd, np.salt, tmp_pwd);
    strcpy(np.hostmask, message->sender_hostmask);
    strncpy(np.first_class, "None\0", 5);
    strncpy(np.second_class, "None\0", 5);
    strncpy(np.title, "Newbie\0", 7);

    bzero(np.materials, sizeof np.materials);

    np.health       = 100;
    np.fullness     = 100;
    np.alignment    = 0;
    np.alive        = 1;
    np.available    = 1;
    np.level        = 1;
    np.contribution = 0;
    np.max_health   = 100;
    np.max_mana     = 100;
    np.kills        = 0;
    np.deaths       = 0;
    np.gold         = 100;
    np.experience   = 0;
    np.mana         = 100;
    np.strength     = 5;
    np.intelligence = 5;
    np.defense      = 5;
    np.m_def        = 5;
    np.attr_pts     = 1;
    np.available_slots = 23;
    np.available_capacity = 70;
    np.travel_timer.active = 0;
    np.bounty = 0;
    np.auth_level = AL_USER;
    np.max_auth = AL_USER;
    np.cheese = 1;
    memset(np.inventory, 0, sizeof np.inventory);
    //Name, hp, def, int, str, mdef, reqlvl, weight, soc1,2,3, type, mana, rarity
    struct Inventory sword  = {"Wooden Sword", 0, 0, 0, 5, 0, 1, 15, 0, 0, 0, 0, 0, 0, 1};
    struct Inventory shield = {"Wooden Shield", 5, 5, 5, 5, 5, 1, 15, 0, 0, 0, 1, 5, 0, 1};
    //see inventory.h
    sword.bitfield  &= ~(1 << RUSTED);
    sword.bitfield  &= ~(1 << EQUIPPED);
    sword.bitfield  |=  (1 << EQUIPPABLE);
    shield.bitfield &= ~(1 << RUSTED);
    shield.bitfield &= ~(1 << EQUIPPED);
    shield.bitfield |=  (1 << EQUIPPABLE);
    np.inventory[0] = sword;
    np.inventory[1] = shield;

    dawn->players[dawn->player_count] = np;
    dawn->player_count++;

    sprintf(out, "PRIVMSG %s :Account created for user %s@%s, please set your password by sending me "
                    "a private message containing: ;set password <your_password>\r\n", dawn->active_room,
            message->sender_nick, message->sender_hostmask);
    save_players();
    add_msg(out, strlen(out));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x29a0, %rsp           # imm = 0x29A0
movq %rdi, -0x8(%rbp)
movl 0x9b44(%rip), %eax      # 0x1d819
movl %eax, -0x1a5(%rbp)
movb 0x9b3c(%rip), %al       # 0x1d81d
movb %al, -0x1a1(%rbp)
movq -0x8(%rbp), %rdi
callq 0x13ba0
cmpl $-0x1, %eax
je 0x13d49
leaq -0x1a0(%rbp), %rdi
leaq 0x14d6d(%rip), %rax     # 0x28a70
movq (%rax), %rdx
addq $0x100, %rdx            # imm = 0x100
leaq 0x7c25(%rip), %rsi      # 0x1b939
movb $0x0, %al
callq 0x2050
leaq -0x1a0(%rbp), %rax
movq %rax, -0x2990(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x20c0
movq -0x2990(%rbp), %rdi
movq %rax, %rsi
callq 0x12840
jmp 0x14101
leaq -0x2850(%rbp), %rdi
xorl %esi, %esi
movl $0x26a8, %edx           # imm = 0x26A8
callq 0x20f0
movl $0x0, -0x264(%rbp)
movl $0x1, -0x260(%rbp)
leaq -0x2850(%rbp), %rdi
movq -0x8(%rbp), %rsi
leaq 0x124da(%rip), %rax     # 0x2625c
movl (%rax), %eax
movl %eax, %edx
callq 0x20e0
leaq -0x2850(%rbp), %rdi
addq $0x7f, %rdi
movl $0x10, %esi
callq 0x12e50
leaq -0x2850(%rbp), %rdi
addq $0x8f, %rdi
leaq -0x2850(%rbp), %rsi
addq $0x7f, %rsi
leaq -0x1a5(%rbp), %rdx
callq 0x12ed0
leaq -0x2850(%rbp), %rdi
addq $0x40, %rdi
movq -0x8(%rbp), %rsi
addq $0x80, %rsi
callq 0x21c0
leaq -0x2850(%rbp), %rdi
addq $0xcf, %rdi
leaq 0xc8cf(%rip), %rsi      # 0x206c4
movl $0x5, %edx
callq 0x20e0
leaq -0x2850(%rbp), %rdi
addq $0x10f, %rdi            # imm = 0x10F
leaq 0xc8b0(%rip), %rsi      # 0x206c4
movl $0x5, %edx
callq 0x20e0
leaq -0x2850(%rbp), %rdi
addq $0x14f, %rdi            # imm = 0x14F
leaq 0xc86d(%rip), %rsi      # 0x206a0
movl $0x7, %edx
callq 0x20e0
leaq -0x2850(%rbp), %rdi
addq $0x25f8, %rdi           # imm = 0x25F8
xorl %esi, %esi
movl $0x40, %edx
callq 0x20f0
movq $0x64, -0x200(%rbp)
movw $0x64, -0x1ae(%rbp)
movl $0x0, -0x1bc(%rbp)
movl $0x1, -0x1f0(%rbp)
movl $0x1, -0x1ec(%rbp)
movl $0x1, -0x1e8(%rbp)
movl $0x0, -0x1e4(%rbp)
movl $0x64, -0x1e0(%rbp)
movl $0x64, -0x1dc(%rbp)
movq $0x0, -0x218(%rbp)
movq $0x0, -0x210(%rbp)
movq $0x64, -0x208(%rbp)
movq $0x0, -0x1f8(%rbp)
movl $0x64, -0x1d0(%rbp)
movl $0x5, -0x1cc(%rbp)
movl $0x5, -0x1c8(%rbp)
movl $0x5, -0x1c4(%rbp)
movl $0x5, -0x1c0(%rbp)
movl $0x1, -0x1b8(%rbp)
movl $0x17, -0x1d8(%rbp)
movl $0x46, -0x1d4(%rbp)
movl $0x0, -0x1704(%rbp)
movl $0x0, -0x25c(%rbp)
movb $0x1, -0x1b0(%rbp)
movb $0x1, -0x1af(%rbp)
movl $0x1, -0x1b4(%rbp)
leaq -0x2850(%rbp), %rdi
addq $0x190, %rdi            # imm = 0x190
xorl %esi, %esi
movl $0xf3c, %edx            # imm = 0xF3C
callq 0x20f0
leaq -0x28ec(%rbp), %rdi
leaq 0xc74b(%rip), %rsi      # 0x206cc
movl $0x9c, %edx
callq 0x2170
leaq -0x2988(%rbp), %rdi
leaq 0xc7cf(%rip), %rsi      # 0x20768
movl $0x9c, %edx
callq 0x2170
movzbl -0x2854(%rbp), %eax
andl $-0x11, %eax
movb %al, -0x2854(%rbp)
movzbl -0x2854(%rbp), %eax
andl $-0x5, %eax
movb %al, -0x2854(%rbp)
movzbl -0x2854(%rbp), %eax
orl $0x8, %eax
movb %al, -0x2854(%rbp)
movzbl -0x28f0(%rbp), %eax
andl $-0x11, %eax
movb %al, -0x28f0(%rbp)
movzbl -0x28f0(%rbp), %eax
andl $-0x5, %eax
movb %al, -0x28f0(%rbp)
movzbl -0x28f0(%rbp), %eax
orl $0x8, %eax
movb %al, -0x28f0(%rbp)
leaq -0x2850(%rbp), %rdi
addq $0x190, %rdi            # imm = 0x190
leaq -0x28ec(%rbp), %rsi
movl $0x9c, %edx
callq 0x2170
leaq -0x2850(%rbp), %rdi
addq $0x190, %rdi            # imm = 0x190
addq $0x9c, %rdi
leaq -0x2988(%rbp), %rsi
movl $0x9c, %edx
callq 0x2170
leaq 0x14a21(%rip), %rax     # 0x28a70
movq (%rax), %rdi
addq $0x1a0, %rdi            # imm = 0x1A0
leaq 0x14a10(%rip), %rax     # 0x28a70
movq (%rax), %rax
movslq 0x148(%rax), %rax
imulq $0x26a8, %rax, %rax     # imm = 0x26A8
addq %rax, %rdi
leaq -0x2850(%rbp), %rsi
movl $0x26a8, %edx           # imm = 0x26A8
callq 0x2170
leaq 0x149e4(%rip), %rax     # 0x28a70
movq (%rax), %rax
movl 0x148(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x148(%rax)
leaq -0x1a0(%rbp), %rdi
leaq 0x149c4(%rip), %rax     # 0x28a70
movq (%rax), %rdx
addq $0x100, %rdx            # imm = 0x100
movq -0x8(%rbp), %rcx
movq -0x8(%rbp), %r8
addq $0x80, %r8
leaq 0xc738(%rip), %rsi      # 0x20804
movb $0x0, %al
callq 0x2050
callq 0x14110
leaq -0x1a0(%rbp), %rax
movq %rax, -0x2998(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x20c0
movq -0x2998(%rbp), %rdi
movq %rax, %rsi
callq 0x12840
addq $0x29a0, %rsp           # imm = 0x29A0
popq %rbp
retq
nopw (%rax,%rax)