user: 提供的汇编代码用C语言表示会是什么样子：

```asm
<position_near>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %edi,%r12d
  mov    %esi,%ebx
  mov    %edx,%ebp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  lea    0xc(%rsp),%rdx
  push   $0x0
  lea    0x1c(%rsp),%rax
  push   %rax
  mov    D13(%rip),%rax
  mov    (%rax),%r9d
  lea    0x20(%rsp),%r8
  mov    D50(%rip),%rax
  mov    (%rax),%ecx
  mov    D47(%rip),%rax
  mov    (%rax),%esi
  call   <XtVaGetValues@plt>
  mov    0x24(%rsp),%eax
  add    %eax,%eax
  add    %eax,0x1c(%rsp)
  add    %eax,0x20(%rsp)
  mov    %r12d,%edi
  call   <XtScreen@plt>
  mov    %eax,%edi
  call   <WidthOfScreen@plt>
  mov    %eax,%r13d
  mov    %r12d,%edi
  call   <XtScreen@plt>
  mov    %eax,%edi
  call   <HeightOfScreen@plt>
  movslq %r13d,%rdx
  imul   $0x55555556,%rdx,%rdx
  shr    $0x20,%rdx
  mov    %r13d,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  add    $0x10,%rsp
  cmp    %ebx,%edx
  setl   %cl
  movzbl %cl,%ecx
  lea    0x0(%r13,%r13,1),%esi
  movslq %esi,%rdx
  imul   $0x55555556,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x1f,%esi
  sub    %esi,%edx
  cmp    %ebx,%edx
  setl   %dl
  movzbl %dl,%edx
  lea    0x1(%rcx,%rdx,1),%ecx
  movslq %eax,%rdx
  imul   $0x55555556,%rdx,%rdx
  shr    $0x20,%rdx
  mov    %eax,%esi
  sar    $0x1f,%esi
  sub    %esi,%edx
  lea    0x3(%rcx),%esi
  cmp    %ebp,%edx
  cmovl  %esi,%ecx
  lea    (%rax,%rax,1),%esi
  movslq %esi,%rdx
  imul   $0x55555556,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x1f,%esi
  sub    %esi,%edx
  lea    0x3(%rcx),%esi
  cmp    %ebp,%edx
  cmovl  %esi,%ecx
  mov    0xc(%rsp),%edi
  mov    0x10(%rsp),%esi
  mov    %esi,%edx
  shr    $0x1f,%edx
  add    %esi,%edx
  sar    %edx
  sub    %edx,%ebp
  mov    $0x0,%edx
  cmovs  %edx,%ebp
  sub    %esi,%eax
  mov    %edi,%esi
  shr    $0x1f,%esi
  add    %edi,%esi
  sar    %esi
  sub    %esi,%ebx
  mov    %ebx,%edx
  mov    $0x0,%esi
  cmovs  %esi,%edx
  sub    %edi,%r13d
  cmp    %r13d,%edx
  cmovg  %r13d,%edx
  push   $0x0
  push   %rcx
  mov    D24(%rip),%rcx
  mov    (%rcx),%r9d
  cmp    %eax,%ebp
  cmovle %ebp,%eax
  mov    %eax,%r8d
  mov    D14(%rip),%rax
  mov    (%rax),%ecx
  mov    D48(%rip),%rax
  mov    (%rax),%esi
  mov    %r12d,%edi
  call   <XtVaSetValues@plt>
  add    $0x10,%rsp
  mov    0x18(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L4:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void position_near(Widget shell, int x, int y) {
  int max_x, max_y;
  Dimension width, height, border;
  int gravity;
  XtVaGetValues(shell, XtNwidth, &width, XtNheight, &height, XtNborderWidth, &border, NULL);
  width += 2 * border;
  height += 2 * border;
  max_x = WidthOfScreen(XtScreen(shell));
  max_y = HeightOfScreen(XtScreen(shell));
  gravity = 1;
  if (x > max_x / 3)
    gravity += 1;
  if (x > max_x * 2 / 3)
    gravity += 1;
  if (y > max_y / 3)
    gravity += 3;
  if (y > max_y * 2 / 3)
    gravity += 3;
  max_x -= width;
  max_y -= height;
  x -= ((Position)width / 2);
  if (x < 0)
    x = 0;
  if (x > max_x)
    x = max_x;
  y -= ((Position)height / 2);
  if (y < 0)
    y = 0;
  if (y > max_y)
    y = max_y;
  XtVaSetValues(shell, XtNx, (Position)x, XtNy, (Position)y, XtNwinGravity, gravity, NULL);
}
```