user: 请将以下的汇编代码转换成C语言代码:

```asm
<grtm_test>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x38,%rsp
  mov    %edi,%r13d
  mov    %esi,%r14d
  mov    %edx,-0x48(%rbp)
  mov    %ecx,-0x54(%rbp)
  mov    %r8d,%r12d
  mov    %r9d,-0x44(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    $0x1030000,%edi
  call   <report_device@plt>
  movslq %r13d,%rbx
  sub    $0xffffff80,%r13d
  movslq %r13d,%r13
  lea    -0x1(%r12),%r15d
  mov    0x30(%rbp),%eax
  shl    $0x9,%eax
  mov    0x38(%rbp),%esi
  shl    $0x8,%esi
  or     %esi,%eax
  mov    0x20(%rbp),%esi
  shl    $0xa,%esi
  or     %esi,%eax
  mov    0x28(%rbp),%esi
  shl    $0xb,%esi
  or     %esi,%eax
  mov    0x18(%rbp),%edi
  shl    $0xc,%edi
  or     %edi,%eax
  mov    0x10(%rbp),%esi
  shl    $0xd,%esi
  or     %esi,%eax
  mov    -0x44(%rbp),%edx
  shl    $0xe,%edx
  or     %edx,%eax
  mov    %r15d,%edx
  shl    $0xf,%edx
  or     %edx,%eax
  cltq
  mov    %rax,-0x50(%rbp)
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <report_subtest@plt>
  mov    0x28(%rbx),%rax
  cmp    $0x1,%al
  jne    L8
L85:
  movq   $0xc,(%rbx)
  movq   $0x0,(%rbx)
  mov    0x10(%rbp),%eax
  shl    $0x4,%eax
  add    $0xdf,%eax
  imul   %eax,%r12d
  lea    -0x1(%r12),%edx
  or     $0x3f0000,%edx
  movslq %edx,%rdx
  mov    %rdx,0x10(%rbx)
  movq   $0xffffffff80010001,0x20(%r13)
  mov    0x30(%rbp),%eax
  add    %eax,%eax
  or     0x38(%rbp),%eax
  mov    0x20(%rbp),%ecx
  shl    $0x5,%ecx
  or     %ecx,%eax
  mov    0x28(%rbp),%ecx
  shl    $0x6,%ecx
  or     %ecx,%eax
  mov    0x18(%rbp),%ecx
  shl    $0x7,%ecx
  or     %ecx,%eax
  mov    0x10(%rbp),%ecx
  shl    $0xb,%ecx
  or     %ecx,%eax
  mov    -0x44(%rbp),%ecx
  shl    $0xf,%ecx
  or     %ecx,%eax
  shl    $0xc,%r15d
  or     %eax,%r15d
  movslq %r15d,%r15
  mov    %r15,0x28(%r13)
  movq   $0x352ef853,0x30(%r13)
  movq   $0x8000,0x40(%r13)
  movq   $0xb,0x48(%r13)
  movq   $0x301d23,0x50(%r13)
  mov    $0xfeedbacc,%eax
  mov    %rax,0xa0(%r13)
  movq   $0x1,0x0(%r13)
L0:
  mov    0x8(%rbx),%rax
  test   $0x40,%al
  je     L0
  movq   $0xc,(%rbx)
  movq   $0x0,(%rbx)
  mov    %rdx,0x10(%rbx)
  movq   $0xffffffff80010001,0x20(%r13)
  mov    %r15,0x28(%r13)
  movq   $0x352ef853,0x30(%r13)
  movq   $0x8000,0x40(%r13)
  movq   $0xb,0x48(%r13)
  movq   $0x301d23,0x50(%r13)
  mov    $0xfeedbacc,%eax
  mov    %rax,0xa0(%r13)
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <report_subtest@plt>
  movq   $0x1,0x0(%r13)
L13:
  mov    0x8(%rbx),%rax
  test   $0x40,%al
  je     L13
  lea    0x3(%r14),%eax
  test   %r14d,%r14d
  cmovns %r14d,%eax
  sar    $0x2,%eax
  cltq
  lea    0xf(,%rax,8),%rax
  mov    %rax,%rcx
  and    $0xfffffffffffffff0,%rcx
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rdx
  sub    %rax,%rdx
L29:
  cmp    %rdx,%rsp
  je     L35
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L29
L8:
  mov    $0x1,%edi
  mov    $0x0,%eax
  call   <fail@plt>
  jmp    L85
L35:
  mov    %rcx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L101
  orq    $0x0,-0x8(%rsp,%rax,1)
L101:
  mov    %rsp,%r15
  and    $0xfffffc00,%r15d
  lea    0x400(%r15),%r14
  mov    -0x54(%rbp),%eax
  imul   -0x48(%rbp),%eax
  lea    0x3(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x2,%eax
  cltq
  lea    0xf(,%rax,8),%rax
  mov    %rax,%rcx
  and    $0xfffffffffffffff0,%rcx
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rdx
  sub    %rax,%rdx
L136:
  cmp    %rdx,%rsp
  je     L17
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L136
L17:
  mov    %rcx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L125
  orq    $0x0,-0x8(%rsp,%rax,1)
L125:
  mov    %rsp,%r13
  and    $0xfffffc00,%r13d
  add    $0x400,%r13
  movslq %r14d,%rax
  mov    %rax,0x18(%rbx)
  mov    $0x2,%edi
  mov    $0x0,%eax
  call   <report_subtest@plt>
  movl   $0x1,0x400(%r15)
  mov    %r13d,0x4(%r14)
  movl   $0x1,0x8(%r14)
  mov    -0x48(%rbp),%r15d
  lea    (%r15,%r13,1),%eax
  mov    %eax,0xc(%r14)
  movl   $0x1,0x10(%r14)
  lea    (%r15,%r15,1),%eax
  lea    (%rax,%r13,1),%edx
  mov    %edx,0x14(%r14)
  movl   $0x3,0x18(%r14)
  add    %r15d,%eax
  add    %r13d,%eax
  mov    %eax,0x1c(%r14)
  sub    $0x8,%rsp
  push   %r13
  push   %r12
  push   $0x0
  push   $0x1
  push   $0xffffffffbaadcaad
  push   $0x0
  push   $0x3
  push   $0x0
  push   $0x0
  mov    $0x0,%r9d
  mov    $0x0,%r8d
  mov    $0x0,%ecx
  mov    $0x1,%edx
  mov    $0x6,%esi
  mov    $0x123,%edi
  mov    $0x0,%eax
  call   <TMTF@plt>
  movslq %r15d,%r14
  add    %r14,%r13
  add    $0x48,%rsp
  push   %r13
  push   %r12
  push   $0x1
  push   $0x1
  push   $0xffffffffbaadcaad
  push   $0x0
  push   $0x3
  push   $0x0
  push   $0x0
  mov    $0x0,%r9d
  mov    $0x1,%r8d
  mov    $0x1,%ecx
  mov    $0x1,%edx
  mov    $0x6,%esi
  mov    $0x123,%edi
  mov    $0x0,%eax
  call   <TMTF@plt>
  add    %r14,%r13
  add    $0x48,%rsp
  push   %r13
  push   %r12
  push   $0x2
  push   $0x1
  push   $0xffffffffbaadcaad
  push   $0x0
  push   $0x3
  push   $0x0
  push   $0x0
  mov    $0x0,%r9d
  mov    $0x2,%r8d
  mov    $0x2,%ecx
  mov    $0x1,%edx
  mov    $0x6,%esi
  mov    $0x123,%edi
  mov    $0x0,%eax
  call   <TMTF@plt>
  add    $0x48,%rsp
  add    %r13,%r14
  push   %r14
  push   %r12
  push   $0x3
  push   $0x1
  push   $0xffffffffbaadcaad
  push   $0x0
  push   $0x3
  push   $0x0
  push   $0x0
  mov    $0x0,%r9d
  mov    $0x3,%r8d
  mov    $0x3,%ecx
  mov    $0x1,%edx
  mov    $0x6,%esi
  mov    $0x123,%edi
  mov    $0x0,%eax
  call   <TMTF@plt>
  add    $0x50,%rsp
  mov    $0x3,%edi
  mov    $0x0,%eax
  call   <report_subtest@plt>
  movq   $0x1,(%rbx)
L78:
  mov    (%rbx),%rax
  test   $0x1,%al
  jne    L78
  mov    $0x4,%edi
  mov    $0x0,%eax
  call   <report_subtest@plt>
L42:
  mov    0x8(%rbx),%rax
  test   $0x20,%al
  je     L42
  mov    $0x5,%edi
  mov    $0x0,%eax
  call   <report_subtest@plt>
  movq   $0x1f,0x8(%rbx)
L9:
  mov    0x8(%rbx),%rax
  test   $0x10,%al
  je     L9
  mov    $0x6,%edi
  mov    $0x0,%eax
  call   <report_subtest@plt>
  movq   $0x1f,0x8(%rbx)
L18:
  mov    0x8(%rbx),%rax
  test   $0x10,%al
  je     L18
  mov    -0x50(%rbp),%rdi
  mov    $0x0,%eax
  call   <report_subtest@plt>
  mov    $0x7,%edi
  mov    $0x0,%eax
  call   <report_subtest@plt>
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L93
  mov    $0x0,%eax
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L93:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
grtm_test(int paddr, int descsize, int buffersize, int buffers, int rsdepth, int reed, int reed8, int pseudo, int conv, int mark, int split, int sub) {
  report_device(0x01030000);
  struct grtm_dma {
    volatile unsigned long ctrl;
    volatile unsigned long stat;
    volatile unsigned long len;
    volatile unsigned long descr;
    volatile unsigned long conf;
    volatile unsigned long rev;
  };
  struct grtm_tx {
    volatile unsigned long ctrl;
    volatile unsigned long stat;
    volatile unsigned long conf;
    volatile unsigned long dummy0;
    volatile unsigned long phy;
    volatile unsigned long code;
    volatile unsigned long aasm;
    volatile unsigned long dummy1;
    volatile unsigned long all;
    volatile unsigned long master;
    volatile unsigned long idle;
    volatile unsigned long dummy2;
    volatile unsigned long dummy3;
    volatile unsigned long dummy4;
    volatile unsigned long dummy5;
    volatile unsigned long dummy6;
    volatile unsigned long fsh0;
    volatile unsigned long fsh1;
    volatile unsigned long fsh2;
    volatile unsigned long fsh3;
    volatile unsigned long ocf;
  };
  struct grtm_dma *ldma = (struct grtm_dma *)(paddr);
  struct grtm_tx *ltx = (struct grtm_tx *)(paddr + 0x80);
  long int subtst = ((rsdepth - 1) << 15) | (reed << 14) | (reed8 << 13) | (pseudo << 12) | (mark << 11) | (conv << 10) | (split << 9) | (sub << 8);
  report_subtest(subtst);
  if ((ldma->rev & 0xff) != 1)
    fail(1);
  int TFIE = 0;
  int RST = 1;
  int TXRST = 1;
  int IE = 0;
  int EN = 0;
  ldma->ctrl = (TFIE << 4) | (RST << 3) | (TXRST << 2) | (IE << 1) | (EN);
  RST = 0;
  TXRST = 0;
  EN = 0;
  ldma->ctrl = (TFIE << 4) | (RST << 3) | (TXRST << 2) | (IE << 1) | (EN);
  int LIMIT = 32 * 2;
  int LENGTH = rsdepth * (223 + 16 * reed8);
  ldma->len = ((LIMIT - 1) << 16) | (LENGTH - 1);
  int SF = 1;
  int SYMBOLRATE = 1;
  int SCF = 0;
  int SUBRATE = 1;
  ltx->phy = (SF << 31) | (SYMBOLRATE << 16) | (SCF << 15) | (SUBRATE);
  int CIF = 0;
  int CSEL = 0;
  int AASM = 0;
  int RS = reed;
  int RSDEPTH = rsdepth - 1;
  int RS8 = reed8;
  int PSR = pseudo;
  int NRZ = mark;
  int CE = conv;
  int CERATE = 0;
  int SP = split;
  int SC = sub;
  ltx->code = (CIF << 19) | (CSEL << 17) | (AASM << 16) | (RS << 15) | (RSDEPTH << 12) | (RS8 << 11) | (PSR << 7) | (NRZ << 6) | (CE << 5) | (CERATE << 2) | (SP << 1) | (SC);
  long int SYNC = 0x352EF853;
  ltx->aasm = SYNC;
  int FSHLENGTH = 0;
  int IZ = 0;
  int FECF = 1;
  int FHEC = 0;
  int VER = 0x0;
  ltx->all = (FSHLENGTH << 17) | (IZ << 16) | (FECF << 15) | (FHEC << 14) | (VER << 12);
  int MC = 1;
  int FSH = 0;
  int OCF = 1;
  int OW = 1;
  ltx->master = (MC << 3) | (FSH << 2) | (OCF << 1) | (OW);
  int IDLE = 1;
  int IDLE_OCF = 1;
  int EVC = 0;
  int IDLE_FSH = 0;
  int VCC = 0;
  int IDLE_MC = 0;
  int VCID = 0x7;
  int SCID = 0x123;
  ltx->idle = (IDLE << 21) | (IDLE_OCF << 20) | (EVC << 19) | (IDLE_FSH << 18) | (VCC << 17) | (IDLE_MC << 16) | (VCID << 10) | (SCID);
  long int CLCW = 0xFEEDBACC;
  ltx->ocf = CLCW;
  int TXTE = 1;
  ltx->ctrl = (TXTE);
  while ((ldma->stat & 0x40) != 0x40)
    ;
  TFIE = 0;
  RST = 1;
  TXRST = 1;
  IE = 0;
  EN = 0;
  ldma->ctrl = (TFIE << 4) | (RST << 3) | (TXRST << 2) | (IE << 1) | (EN);
  RST = 0;
  TXRST = 0;
  EN = 0;
  ldma->ctrl = (TFIE << 4) | (RST << 3) | (TXRST << 2) | (IE << 1) | (EN);
  LIMIT = 32 * 2;
  LENGTH = rsdepth * (223 + 16 * reed8);
  ldma->len = ((LIMIT - 1) << 16) | (LENGTH - 1);
  SF = 1;
  SYMBOLRATE = 1;
  SCF = 0;
  SUBRATE = 1;
  ltx->phy = (SF << 31) | (SYMBOLRATE << 16) | (SCF << 15) | (SUBRATE);
  CIF = 0;
  CSEL = 0;
  AASM = 0;
  RS = reed;
  RSDEPTH = rsdepth - 1;
  RS8 = reed8;
  PSR = pseudo;
  NRZ = mark;
  CE = conv;
  CERATE = 0;
  SP = split;
  SC = sub;
  ltx->code = (CIF << 19) | (CSEL << 17) | (AASM << 16) | (RS << 15) | (RSDEPTH << 12) | (RS8 << 11) | (PSR << 7) | (NRZ << 6) | (CE << 5) | (CERATE << 2) | (SP << 1) | (SC);
  SYNC = 0x352EF853;
  ltx->aasm = SYNC;
  FSHLENGTH = 0;
  IZ = 0;
  FECF = 1;
  FHEC = 0;
  VER = 0x0;
  ltx->all = (FSHLENGTH << 17) | (IZ << 16) | (FECF << 15) | (FHEC << 14) | (VER << 12);
  MC = 1;
  FSH = 0;
  OCF = 1;
  OW = 1;
  ltx->master = (MC << 3) | (FSH << 2) | (OCF << 1) | (OW);
  IDLE = 1;
  IDLE_OCF = 1;
  EVC = 0;
  IDLE_FSH = 0;
  VCC = 0;
  IDLE_MC = 0;
  VCID = 0x7;
  SCID = 0x123;
  ltx->idle = (IDLE << 21) | (IDLE_OCF << 20) | (EVC << 19) | (IDLE_FSH << 18) | (VCC << 17) | (IDLE_MC << 16) | (VCID << 10) | (SCID);
  CLCW = 0xFEEDBACC;
  ltx->ocf = CLCW;
  report_subtest(0x1);
  TXTE = 1;
  ltx->ctrl = (TXTE);
  while ((ldma->stat & 0x40) != 0x40)
    ;
  volatile long int descmemory[descsize / 4];
  long int descmemorybase;
  descmemorybase = (long int)&descmemory[0];
  descmemorybase = descmemorybase & 0xFFFFFC00;
  descmemorybase = descmemorybase + 0x400;
  volatile long int framememory[buffersize * buffers / 4];
  long int framememorybase;
  framememorybase = (long int)&framememory[0];
  framememorybase = framememorybase & 0xFFFFFC00;
  framememorybase = framememorybase + 0x400;
  int BASE = descmemorybase >> 10;
  int INDEX = 0;
  ldma->descr = (BASE << 10) | (INDEX << 3);
  report_subtest(0x2);
  int UE = 0;
  int TS = 0;
  int VCE = 0;
  int MCB = 0;
  int FSHB = 0;
  int OCFB = 0;
  int FHECB = 0;
  int IZB = 0;
  int FECFB = 0;
  int DESC_IE = 0;
  int WR = 0;
  int DESC_EN = 1;
  int DESCRIPTOR = (UE << 15) | (TS << 14) | (VCE << 9) | (MCB << 8) | (FSHB << 7) | (OCFB << 6) | (FHECB << 5) | (IZB << 4) | (FECFB << 3) | (DESC_IE << 2) | (WR << 1) | (DESC_EN);
  volatile int *memorytx;
  memorytx = (int *)descmemorybase;
  int i;
  for (i = 0; i < 4; i++) {
    if (i == 3) {
      WR = 1;
      DESCRIPTOR = (UE << 15) | (TS << 14) | (VCE << 9) | (MCB << 8) | (FSHB << 7) | (OCFB << 6) | (FHECB << 5) | (IZB << 4) | (FECFB << 3) | (DESC_IE << 2) | (WR << 1) | (DESC_EN);
      *memorytx = DESCRIPTOR;
    } else
      *memorytx = DESCRIPTOR;
    memorytx++;
    *memorytx = framememorybase + i * buffersize;
    memorytx++;
  };
  int VCFrameCntr = 0;
  int MCFrameCntr = 0;
  long int SequenceCount = 0;
  memorytx = (int *)framememorybase;
  TMTF(SCID, 6, OCF, MCFrameCntr, VCFrameCntr, 0, 0, 0, 3, 0, 0xBAADCAAD, 1, SequenceCount, rsdepth * (223 + 16 * reed8), memorytx);
  MCFrameCntr++;
  VCFrameCntr++;
  SequenceCount++;
  memorytx = (int *)(framememorybase + buffersize);
  TMTF(SCID, 6, OCF, MCFrameCntr, VCFrameCntr, 0, 0, 0, 3, 0, 0xBAADCAAD, 1, SequenceCount, rsdepth * (223 + 16 * reed8), memorytx);
  MCFrameCntr++;
  VCFrameCntr++;
  SequenceCount++;
  memorytx = (int *)(framememorybase + buffersize * 2);
  TMTF(SCID, 6, OCF, MCFrameCntr, VCFrameCntr, 0, 0, 0, 3, 0, 0xBAADCAAD, 1, SequenceCount, rsdepth * (223 + 16 * reed8), memorytx);
  MCFrameCntr++;
  VCFrameCntr++;
  SequenceCount++;
  memorytx = (int *)(framememorybase + buffersize * 3);
  TMTF(SCID, 6, OCF, MCFrameCntr, VCFrameCntr, 0, 0, 0, 3, 0, 0xBAADCAAD, 1, SequenceCount, rsdepth * (223 + 16 * reed8), memorytx);
  MCFrameCntr++;
  VCFrameCntr++;
  SequenceCount++;
  report_subtest(0x3);
  EN = 1;
  ldma->ctrl = (TFIE << 4) | (RST << 3) | (TXRST << 2) | (IE << 1) | (EN);
  while ((ldma->ctrl & 0x1) != 0x0)
    ;
  report_subtest(0x4);
  while ((ldma->stat & 0x20) != 0x20)
    ;
  report_subtest(0x5);
  int TFO = 0;
  int TFS = 1;
  int TFF = 1;
  int TA = 1;
  int TI = 1;
  int TERROR = 1;
  ldma->stat = (TFO << 5) | (TFS << 4) | (TFF << 3) | (TA << 2) | (TI << 1) | (TERROR);
  while ((ldma->stat & 0x10) != 0x10)
    ;
  report_subtest(0x6);
  TFO = 0;
  TFS = 1;
  TFF = 1;
  TA = 1;
  TI = 1;
  TERROR = 1;
  ldma->stat = (TFO << 5) | (TFS << 4) | (TFF << 3) | (TA << 2) | (TI << 1) | (TERROR);
  while ((ldma->stat & 0x10) != 0x10)
    ;
  report_subtest(subtst);
  report_subtest(0x7);
}
```