user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x24(%rbp)
  movl   $0x0,-0x20(%rbp)
  movl   $0x0,-0x1c(%rbp)
  movl   $0x0,-0x18(%rbp)
  movl   $0x0,-0x14(%rbp)
  movl   $0x1,-0x10(%rbp)
  movl   $0x1,-0xc(%rbp)
  jmp    L268
L176:
  cmpl   $0x1,-0x10(%rbp)
  je     L21
  cmpl   $0x2,-0x10(%rbp)
  je     L220
  jmp    L188
L21:
  lea    D90(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  movl   $0x1,-0x2c(%rbp)
  movl   $0x0,-0x28(%rbp)
  movl   $0x0,-0x24(%rbp)
  movl   $0x0,-0x20(%rbp)
  movl   $0x0,-0x1c(%rbp)
  mov    $0x0,%edi
  call   <time@plt>
  mov    %eax,%edi
  call   <srand@plt>
  mov    $0x0,%eax
  call   <rand@plt>
  cltd
  shr    $0x18,%edx
  add    %edx,%eax
  movzbl %al,%eax
  sub    %edx,%eax
  mov    %eax,-0x14(%rbp)
  movl   $0x2,-0x10(%rbp)
  jmp    L268
L220:
  lea    -0x28(%rbp),%rax
  mov    %rax,%rsi
  lea    D118(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0x28(%rbp),%eax
  cmp    %eax,-0x14(%rbp)
  jne    L102
  mov    -0x24(%rbp),%eax
  mov    %eax,%esi
  lea    D8(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  cmpl   $0x0,-0x18(%rbp)
  jne    L239
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  jmp    L77
L239:
  mov    -0x18(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jle    L77
  lea    D104(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x18(%rbp)
L77:
  mov    -0x18(%rbp),%eax
  mov    %eax,%esi
  lea    D96(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  lea    D5(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  lea    -0x2c(%rbp),%rax
  mov    %rax,%rsi
  lea    D118(%rip),%rax
  mov    %rax,%rdi
  call   <scanf@plt>
  mov    -0x2c(%rbp),%eax
  cmp    $0x1,%eax
  jne    L184
  movl   $0x1,-0x10(%rbp)
  jmp    L268
L184:
  mov    -0x2c(%rbp),%eax
  test   %eax,%eax
  jne    L168
  movl   $0x0,-0xc(%rbp)
  mov    $0x1,%eax
  jmp    L91
L168:
  lea    D50(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  movl   $0x0,-0xc(%rbp)
  mov    $0x1,%eax
  jmp    L91
L102:
  mov    -0x28(%rbp),%eax
  cmp    %eax,-0x14(%rbp)
  jge    L141
  mov    -0x28(%rbp),%eax
  sub    -0x14(%rbp),%eax
  cmp    %eax,-0x20(%rbp)
  jg     L149
  cmpl   $0x0,-0x20(%rbp)
  je     L74
  mov    -0x14(%rbp),%edx
  mov    -0x20(%rbp),%eax
  add    %edx,%eax
  mov    %eax,%esi
  lea    D116(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L82
L74:
  mov    -0x28(%rbp),%eax
  sub    -0x14(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  jmp    L82
L149:
  mov    -0x28(%rbp),%eax
  sub    -0x14(%rbp),%eax
  mov    %eax,-0x20(%rbp)
L82:
  lea    D97(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  addl   $0x1,-0x24(%rbp)
  jmp    L188
L141:
  mov    -0x28(%rbp),%eax
  cmp    %eax,-0x14(%rbp)
  jle    L188
  mov    -0x28(%rbp),%edx
  mov    -0x14(%rbp),%eax
  sub    %edx,%eax
  cmp    %eax,-0x1c(%rbp)
  jg     L216
  cmpl   $0x0,-0x1c(%rbp)
  je     L44
  mov    -0x14(%rbp),%eax
  sub    -0x1c(%rbp),%eax
  mov    %eax,%esi
  lea    D38(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L99
L44:
  mov    -0x28(%rbp),%edx
  mov    -0x14(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  jmp    L99
L216:
  mov    -0x28(%rbp),%edx
  mov    -0x14(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,-0x1c(%rbp)
L99:
  lea    D71(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  addl   $0x1,-0x24(%rbp)
L188:
  nop
L268:
  cmpl   $0x0,-0xc(%rbp)
  jne    L176
  mov    $0x0,%eax
L91:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L32
  call   <__stack_chk_fail@plt>
L32:
  leave
  ret
```

tool_calls: name: read_data
arguments: data_tag: D90
type_guessed: string
name: read_data
arguments: data_tag: D118
type_guessed: string
name: read_data
arguments: data_tag: D8
type_guessed: string
name: read_data
arguments: data_tag: D104
type_guessed: string
name: read_data
arguments: data_tag: D96
type_guessed: string
name: read_data
arguments: data_tag: D5
type_guessed: string
name: read_data
arguments: data_tag: D50
type_guessed: string
name: read_data
arguments: data_tag: D116
type_guessed: string
name: read_data
arguments: data_tag: D97
type_guessed: string
name: read_data
arguments: data_tag: D38
type_guessed: string
name: read_data
arguments: data_tag: D71
type_guessed: string

tool: D90: GUESS A VALUE BETWEEN 0 AND 255

tool: D118: %d

tool: D8: CORRECT. IT TOOK YOU %d ATTEMPTS


tool: D104: < < NEW HIGH SCORE > >

tool: D96: HIGH SCORE :: %d


tool: D5: PLAY AGAIN? (0 = N/1 = Y)

tool: D50: INVALID RESPONSE.

tool: D116: ANSWER IS NOT HIGHER THAN %d


tool: D97: TOO HIGH. GUESS AGAIN.

tool: D38: ANSWER IS NOT LOWER THAN %d


tool: D71: TOO LOW. GUESS AGAIN.

assistant: ```c
int main(int argc, char **argv) {
  int guess_count = 0, upper_threshold = 0, lower_threshold = 0, high_score = 0, answer = 0;
  int location = 1, active = 1;
  while (active != 0) {
    switch (location) {
    case 1:
      printf("GUESS A VALUE BETWEEN 0 AND 255\n");
      int play_again = 1;
      int guess = 0;
      guess_count = 0;
      upper_threshold = 0;
      lower_threshold = 0;
      srand(time(NULL));
      answer = rand() % 256;
      location = 2;
      break;
    case 2:
      scanf("%d", &guess);
      if (guess == answer) {
        printf("CORRECT. IT TOOK YOU %d ATTEMPTS\n", guess_count);
        if (high_score == 0) {
          high_score = guess_count;
        } else if (high_score > guess_count) {
          printf("< < NEW HIGH SCORE > >\n");
          high_score = guess_count;
        }
        printf("HIGH SCORE :: %d\n", high_score);
        printf("PLAY AGAIN? (0 = N/1 = Y)\n");
        scanf("%d", &play_again);
        if (play_again == 1) {
          location = 1;
          break;
        } else if (play_again == 0) {
          active = 0;
          return 1;
        } else {
          printf("INVALID RESPONSE.\n");
          active = 0;
          return 1;
        }
      } else {
        if (guess > answer) {
          if ((guess - answer) >= upper_threshold) {
            if (upper_threshold != 0) {
              printf("ANSWER IS NOT HIGHER THAN %d\n", (answer + upper_threshold));
            } else {
              upper_threshold = (guess - answer);
            }
          } else {
            upper_threshold = (guess - answer);
          }
          printf("TOO HIGH. GUESS AGAIN.\n");
          guess_count++;
        } else if (guess < answer) {
          if ((answer - guess) >= lower_threshold) {
            if (lower_threshold != 0) {
              printf("ANSWER IS NOT LOWER THAN %d\n", (answer - lower_threshold));
            } else {
              lower_threshold = (answer - guess);
            }
          } else {
            lower_threshold = (answer - guess);
          }
          printf("TOO LOW. GUESS AGAIN.\n");
          guess_count++;
        }
      }
    default:
      break;
    }
  }
}
```