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

```asm
<RunJob>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x5b8,%rsp
  mov    %rdi,%r12
  mov    %esi,%r13d
  mov    %edx,%ebp
  mov    %fs:0x28,%rax
  mov    %rax,0x5a8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rdi
  mov    %esi,%ecx
  mov    %r12,%rdx
  lea    D39(%rip),%rsi
  call   <sprintf@plt>
  test   %ebp,%ebp
  jne    L108
L165:
  mov    %rsp,%rdi
  lea    D84(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L112
  mov    %r13d,%esi
  mov    %r12,%rdi
  call   <GetOwner@plt>
  mov    %rax,%r12
  lea    0xf0(%rsp),%rdi
  mov    %rbx,%rdx
  mov    $0xf0,%esi
  call   <fgets@plt>
  test   %eax,%eax
  je     L67
  movzbl 0xf0(%rsp),%edx
  mov    $0x0,%eax
  test   %dl,%dl
  je     L90
L134:
  cmp    $0xa,%dl
  je     L34
  add    $0x1,%rax
  movzbl 0xf0(%rsp,%rax,1),%edx
  test   %dl,%dl
  jne    L134
  jmp    L90
L108:
  lea    0x4b0(%rsp),%rbx
  mov    %r13d,%edx
  lea    D51(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %rbx,%rdx
  mov    $0x0,%esi
  lea    D120(%rip),%rdi
  call   <Message@plt>
  jmp    L165
L67:
  lea    0x4b0(%rsp),%rbp
  mov    %r13d,%edx
  lea    D43(%rip),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %rbp,%rdx
  mov    $0x1,%esi
  lea    D120(%rip),%rdi
  call   <Message@plt>
  mov    %rbx,%rdi
  call   <fclose@plt>
  jmp    L112
L34:
  movslq %eax,%rcx
  movb   $0x0,0xf0(%rsp,%rcx,1)
L90:
  lea    0x1e0(%rsp),%rdi
  mov    %rbx,%rdx
  mov    $0xf0,%esi
  call   <fgets@plt>
  test   %eax,%eax
  je     L1
  movzbl 0x1e0(%rsp),%edx
  mov    $0x0,%eax
  test   %dl,%dl
  je     L168
L27:
  cmp    $0xa,%dl
  je     L40
  add    $0x1,%rax
  movzbl 0x1e0(%rsp,%rax,1),%edx
  test   %dl,%dl
  jne    L27
  jmp    L168
L1:
  lea    0x4b0(%rsp),%rbp
  mov    %r13d,%edx
  lea    D43(%rip),%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %rbp,%rdx
  mov    $0x1,%esi
  lea    D120(%rip),%rdi
  call   <Message@plt>
  mov    %rbx,%rdi
  call   <fclose@plt>
  jmp    L112
L40:
  movslq %eax,%rcx
  movb   $0x0,0x1e0(%rsp,%rcx,1)
L168:
  mov    %rbx,%rdi
  call   <fclose@plt>
  lea    0x1e0(%rsp),%rcx
  lea    0xf0(%rsp),%rdx
  lea    0x3c0(%rsp),%rbx
  lea    D137(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    0x2d0(%rsp),%rdi
  mov    %rbx,%rcx
  mov    %r12,%rdx
  lea    D90(%rip),%rsi
  mov    $0x0,%eax
  call   <sprintf@plt>
  cmp    $0x1,%ebp
  jg     L195
L178:
  cmp    $0x2,%ebp
  jg     L158
L148:
  lea    0x2d0(%rsp),%rdi
  call   <system@plt>
  mov    %rsp,%rdi
  call   <unlink@plt>
L112:
  mov    0x5a8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L166
  add    $0x5b8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L195:
  mov    %rbx,%rdx
  lea    0x4b0(%rsp),%rbx
  lea    D122(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %rbx,%rdx
  mov    $0x0,%esi
  lea    D120(%rip),%rdi
  call   <Message@plt>
  jmp    L178
L158:
  lea    0x2d0(%rsp),%rdx
  lea    0x4b0(%rsp),%rbx
  lea    D103(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %rbx,%rdx
  mov    $0x0,%esi
  lea    D120(%rip),%rdi
  call   <Message@plt>
  jmp    L148
L166:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: tag: D39
type_infered: string
name: read_data
arguments: tag: D84
type_infered: string
name: read_data
arguments: tag: D51
type_infered: string
name: read_data
arguments: tag: D120
type_infered: string
name: read_data
arguments: tag: D43
type_infered: string
name: read_data
arguments: tag: D137
type_infered: string
name: read_data
arguments: tag: D90
type_infered: string
name: read_data
arguments: tag: D122
type_infered: string
name: read_data
arguments: tag: D103
type_infered: string

tool: D39: %s/%d

tool: D84: r

tool: D51: Running job %d

tool: D120: simq

tool: D43: Invalid Job file (%d)

tool: D137: (cd %s; %s)

tool: D90: su - %s -c "%s"

tool: D122: Command is: %s

tool: D103: Expanded command is: %s

assistant: ```c
void RunJob(char *queueDir, int jobID, int verbose) {
  char jobFile[240], pwd[240], job[240], exe[240], cmd[240];
  FILE *fp;
  sprintf(jobFile, "%s/%d", queueDir, jobID);
  if (verbose) {
    char msg[240];
    sprintf(msg, "Running job %d", jobID);
    Message("simq", 0, msg);
  }
  if ((fp = fopen(jobFile, "r")) != NULL) {
    char *username;
    username = GetOwner(queueDir, jobID);
    if (!fgets(pwd, 240, fp)) {
      char car_msg[240];
      sprintf(car_msg, "Invalid Job file (%d)", jobID);
      Message("simq", 1, car_msg);
      fclose(fp);
      return;
    };
    do {
      int _terminate_macro_j;
      for (_terminate_macro_j = 0; (pwd)[_terminate_macro_j]; _terminate_macro_j++) {
        if ((pwd)[_terminate_macro_j] == '\n') {
          (pwd)[_terminate_macro_j] = '\0';
          break;
        }
      }
    } while (0);
    if (!fgets(job, 240, fp)) {
      char car_msg[240];
      sprintf(car_msg, "Invalid Job file (%d)", jobID);
      Message("simq", 1, car_msg);
      fclose(fp);
      return;
    };
    do {
      int _terminate_macro_j;
      for (_terminate_macro_j = 0; (job)[_terminate_macro_j]; _terminate_macro_j++) {
        if ((job)[_terminate_macro_j] == '\n') {
          (job)[_terminate_macro_j] = '\0';
          break;
        }
      }
    } while (0);
    fclose(fp);
    sprintf(cmd, "(cd %s; %s)", pwd, job);
    sprintf(exe, "su - %s -c \"%s\"", username, cmd);
    if (verbose >= 2) {
      char msg[240];
      sprintf(msg, "Command is: %s", cmd);
      Message("simq", 0, msg);
    }
    if (verbose >= 3) {
      char msg[240];
      sprintf(msg, "Expanded command is: %s", exe);
      Message("simq", 0, msg);
    }
    system(exe);
    unlink(jobFile);
  }
}
```