user: Translate the below assembly code into C programming language:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    D109(%rip),%rdi
  call   <puts@plt>
  lea    D26(%rip),%rdi
  call   <puts@plt>
  lea    D28(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    0x10(%rsp),%rsi
  lea    D31(%rip),%rbx
  mov    %rbx,%rdi
  call   <scanf@plt>
  lea    D86(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    0x14(%rsp),%rsi
  mov    %rbx,%rdi
  call   <scanf@plt>
  mov    0x14(%rsp),%eax
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    %rax,%r15
  mov    $0x1,%eax
  test   %r15,%r15
  je     L19
  mov    0x14(%rsp),%eax
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    %rax,%rcx
  mov    %rax,0x8(%rsp)
  mov    $0x1,%eax
  test   %rcx,%rcx
  je     L19
  mov    0x14(%rsp),%eax
  lea    0x0(,%rax,4),%edi
  call   <malloc@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L77
  cmpl   $0x0,0x14(%rsp)
  jle    L18
  mov    $0x0,%eax
L69:
  movl   $0x0,0x0(%r13,%rax,4)
  mov    0x14(%rsp),%edx
  add    $0x1,%rax
  cmp    %eax,%edx
  jg     L69
  test   %edx,%edx
  jle    L18
  mov    %r15,%r12
  mov    0x8(%rsp),%rbp
  mov    $0x0,%ebx
  lea    D31(%rip),%r14
L87:
  add    $0x1,%ebx
  mov    %ebx,%esi
  lea    D33(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %r12,%rsi
  mov    %r14,%rdi
  call   <scanf@plt>
  mov    %ebx,%esi
  lea    D99(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  mov    %rbp,%rsi
  mov    %r14,%rdi
  call   <scanf@plt>
  add    $0x4,%r12
  add    $0x4,%rbp
  cmp    0x14(%rsp),%ebx
  jl     L87
L18:
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    0x14(%rsp),%r8d
  mov    0x10(%rsp),%ecx
  mov    0x8(%rsp),%rdx
  mov    %r13,%rsi
  mov    %r15,%rdi
  call   <knapsack_greedy@plt>
  lea    D5(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D29(%rip),%rdi
  call   <puts@plt>
  cmpl   $0x0,0x14(%rsp)
  jle    L45
  mov    $0x0,%ebx
  mov    $0x0,%r12d
  mov    $0x0,%ebp
  lea    D125(%rip),%r14
  jmp    L134
L4:
  add    $0x1,%rbx
  cmp    %ebx,0x14(%rsp)
  jle    L27
L134:
  cmpl   $0x1,0x0(%r13,%rbx,4)
  jne    L4
  mov    (%r15,%rbx,4),%edx
  add    %edx,%ebp
  mov    0x8(%rsp),%rax
  mov    (%rax,%rbx,4),%ecx
  add    %ecx,%r12d
  lea    0x1(%rbx),%esi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L4
L27:
  test   %ebp,%ebp
  je     L45
  mov    %r12d,%edx
  mov    %ebp,%esi
  lea    D107(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L49
L45:
  lea    D41(%rip),%rdi
  call   <puts@plt>
L49:
  mov    %r15,%rdi
  call   <free@plt>
  mov    %r13,%rdi
  call   <free@plt>
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  mov    $0x0,%eax
L19:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L38
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L77:
  mov    $0x1,%eax
  jmp    L19
L38:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D109
type_guessed: string
name: disassemble_data
arguments: data_label: D26
type_guessed: string
name: disassemble_data
arguments: data_label: D28
type_guessed: string
name: disassemble_data
arguments: data_label: D31
type_guessed: string
name: disassemble_data
arguments: data_label: D86
type_guessed: string
name: disassemble_data
arguments: data_label: D33
type_guessed: string
name: disassemble_data
arguments: data_label: D99
type_guessed: string
name: disassemble_data
arguments: data_label: D5
type_guessed: string
name: disassemble_data
arguments: data_label: D29
type_guessed: string
name: disassemble_data
arguments: data_label: D125
type_guessed: string
name: disassemble_data
arguments: data_label: D107
type_guessed: string
name: disassemble_data
arguments: data_label: D41
type_guessed: string

tool: D109: Knapsack Greedy

tool: D26: ---------------


tool: D28: Give max size of sack:

tool: D31: %d

tool: D86: 
Give size of total elements:

tool: D33: Give weight for %d element:

tool: D99: 
Give value for %d element:

tool: D5: Elements inside sack:

tool: D29: 


tool: D125: Element %d is inside with weight %d and value %d


tool: D107: Finally our elements inside sack weight %d and we have earned %d


tool: D41: There aren't elements indise sack!!

assistant: ```c
int main(void) {
  int *weight, *value, *pick;
  int size_sack;
  int size_elem;
  int i, sum_w = 0, sum_v = 0;
  printf("Knapsack Greedy\n");
  printf("---------------\n\n");
  printf("Give max size of sack:");
  scanf("%d", &size_sack);
  printf("\nGive size of total elements:");
  scanf("%d", &size_elem);
  weight = malloc(size_elem * sizeof(int));
  if (weight == NULL)
    return 1;
  value = malloc(size_elem * sizeof(int));
  if (value == NULL)
    return 1;
  pick = malloc(size_elem * sizeof(int));
  if (pick == NULL)
    return 1;
  for (i = 0; i < size_elem; i++)
    pick[i] = 0;
  for (i = 0; i < size_elem; i++) {
    printf("Give weight for %d element:", i + 1);
    scanf("%d", &weight[i]);
    printf("\nGive value for %d element:", i + 1);
    scanf("%d", &value[i]);
  }
  printf("\n");
  knapsack_greedy(weight, pick, value, size_sack, size_elem);
  printf("Elements inside sack:");
  printf("\n\n");
  for (i = 0; i < size_elem; i++) {
    if (pick[i] == 1) {
      sum_w += weight[i];
      sum_v += value[i];
      printf("Element %d is inside with weight %d and value %d\n", i + 1, weight[i], value[i]);
    }
  }
  if (sum_w == 0)
    printf("There aren't elements indise sack!!\n");
  else
    printf("Finally our elements inside sack weight %d and we have earned %d\n", sum_w, sum_v);
  free(weight);
  free(pick);
  free(value);
  return 0;
}
```