// File: /workspace/github_c_makefile_star2_O3/rafa9811[P]theIndiependenceGame/interface.c
// Function: interface_printInventory
int interface_printInventory(Interact *interact, Interface *interface){
  Inventory *aux;
  int i=0,linenumber=1,j=0,len,max;
  char line[STAT_LINE],prename[STAT_LINE*10],*name,*ini;
  Object *o;
  if(!interact||!interface) return -1;
  aux = interact_getInventory(interact);
  if(!aux) return -1;
  win_cls(interface->stats);
  max = inventory_getMax(aux);
  sprintf(line,"I N V E N T O R Y:");
  win_write_line_at(interface->stats,0,2,line);
  for(i=0;i<max && linenumber<STATY;i++){
    o = inventory_get(aux,i);
    if(!o){
        name = ini;
        if(name) free(name);
        return 0;
    }
    strcpy(prename,object_getName(o));
    name=(char*)malloc(STAT_LINE*10);
    sprintf(name,"%d: %s",i,prename);
    len = strlen(name);
    ini=name;
    if(len>STAT_LINE){
    j=0;
    while(j<len && linenumber<STATY){
      name = ini + j;
      memcpy(line,name,STAT_LINE);
      win_write_line_at(interface->stats,linenumber,2,line);
      j+=STAT_LINE;
      linenumber++;
    }
    }
    else{
      win_write_line_at(interface->stats,linenumber,2,name);
      linenumber++;
    }
  }
  name=ini;
  if(name)free(name);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
orb %al, %cl
jne 0x55fc
movq %rsi, %rbx
callq 0x45e1
testq %rax, %rax
je 0x55fc
movq %rax, %r14
movq 0x10(%rbx), %rdi
callq 0x3f12
movq %r14, %rdi
callq 0x2370
movl %eax, (%rsp)
movups 0x1655(%rip), %xmm0     # 0x6b19
leaq 0x10(%rsp), %rcx
movaps %xmm0, (%rcx)
movl $0x3a5920, 0xf(%rcx)    # imm = 0x3A5920
movq 0x10(%rbx), %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x4025
movq %r14, %rdi
xorl %esi, %esi
callq 0x237f
testq %rax, %rax
je 0x55ed
movl $0x1, %r15d
xorl %r12d, %r12d
movq %r14, 0x8(%rsp)
movq %rax, %rdi
callq 0x398d
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x1050
movl $0x190, %edi            # imm = 0x190
callq 0x1130
movq %rax, %rbp
movq %rax, %rdi
leaq 0x15f9(%rip), %rsi      # 0x6b2c
movl %r12d, 0x4(%rsp)
movl %r12d, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0x11a0
movq %rbp, %rdi
callq 0x1080
movq %rax, %r14
cmpl $0x29, %r14d
jl 0x55aa
xorl %r12d, %r12d
movl %r15d, %r13d
movq 0x20(%rbp,%r12), %rax
movq %rax, 0x30(%rsp)
movups (%rbp,%r12), %xmm0
movups 0x10(%rbp,%r12), %xmm1
movaps %xmm1, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movq 0x10(%rbx), %rdi
movl %r13d, %esi
movl $0x2, %edx
leaq 0x10(%rsp), %rcx
callq 0x4025
addq $0x28, %r12
leal 0x1(%r13), %r15d
cmpl %r14d, %r12d
jge 0x55c1
cmpl $0x1e, %r13d
movl %r15d, %r13d
jl 0x555c
jmp 0x55c1
movq 0x10(%rbx), %rdi
movl %r15d, %esi
movl $0x2, %edx
movq %rbp, %rcx
callq 0x4025
incl %r15d
movl 0x4(%rsp), %r12d
incl %r12d
cmpl (%rsp), %r12d
jae 0x55ed
cmpl $0x1f, %r15d
jge 0x55ed
movq 0x8(%rsp), %rdi
movl %r12d, %esi
callq 0x237f
testq %rax, %rax
jne 0x5504
jmp 0x55ed
testq %rbp, %rbp
je 0x55fa
movq %rbp, %rdi
callq 0x1030
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq