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

```asm
<grtm_test>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  movslq %edi,%r14
  mov    $0x1030000,%edi
  push   %r13
  mov    %r8d,%r13d
  push   %r12
  lea    -0x1(%r13),%r15d
  push   %rbx
  mov    %r9d,%ebx
  sub    $0x38,%rsp
  mov    %esi,-0x48(%rbp)
  mov    %edx,-0x54(%rbp)
  mov    %ecx,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  call   <report_device@plt>
  mov    0x30(%rbp),%r12d
  mov    0x38(%rbp),%eax
  lea    0x80(%r14),%edx
  movslq %edx,%rdx
  shl    $0x8,%eax
  shl    $0x9,%r12d
  mov    %rdx,-0x50(%rbp)
  or     %eax,%r12d
  mov    0x20(%rbp),%eax
  shl    $0xa,%eax
  or     %eax,%r12d
  mov    0x28(%rbp),%eax
  shl    $0xb,%eax
  or     %eax,%r12d
  mov    0x18(%rbp),%eax
  shl    $0xc,%eax
  or     %eax,%r12d
  mov    0x10(%rbp),%eax
  shl    $0xd,%eax
  or     %eax,%r12d
  mov    %ebx,%eax
  shl    $0xe,%eax
  or     %eax,%r12d
  mov    %r15d,%eax
  shl    $0xf,%eax
  or     %eax,%r12d
  xor    %eax,%eax
  movslq %r12d,%r12
  mov    %r12,%rdi
  call   <report_subtest@plt>
  mov    0x28(%r14),%rax
  mov    -0x50(%rbp),%rdx
  cmp    $0x1,%al
  je     L70
  mov    $0x1,%edi
  xor    %eax,%eax
  call   <fail@plt>
  mov    -0x50(%rbp),%rdx
L70:
  mov    0x10(%rbp),%eax
  mov    0x20(%rbp),%esi
  shl    $0xf,%ebx
  shl    $0xc,%r15d
  movq   $0xc,(%r14)
  shl    $0x4,%eax
  shl    $0x5,%esi
  movq   $0x0,(%r14)
  add    $0xdf,%eax
  imul   %eax,%r13d
  mov    0x30(%rbp),%eax
  add    %eax,%eax
  or     0x38(%rbp),%eax
  or     %esi,%eax
  mov    0x28(%rbp),%esi
  lea    -0x1(%r13),%ecx
  or     $0x3f0000,%ecx
  shl    $0x6,%esi
  movslq %ecx,%rcx
  or     %esi,%eax
  mov    0x18(%rbp),%esi
  mov    %rcx,0x10(%r14)
  movq   $0xffffffff80010001,0x20(%rdx)
  shl    $0x7,%esi
  or     %esi,%eax
  mov    0x10(%rbp),%esi
  shl    $0xb,%esi
  or     %esi,%eax
  or     %eax,%ebx
  mov    $0xfeedbacc,%eax
  or     %ebx,%r15d
  movslq %r15d,%r15
  mov    %r15,0x28(%rdx)
  movq   $0x352ef853,0x30(%rdx)
  movq   $0x8000,0x40(%rdx)
  movq   $0xb,0x48(%rdx)
  movq   $0x301d23,0x50(%rdx)
  mov    %rax,0xa0(%rdx)
  movq   $0x1,(%rdx)
  nopl   (%rax)
L50:
  mov    0x8(%r14),%rax
  test   $0x40,%al
  je     L50
  mov    $0xfeedbacc,%eax
  movq   $0xc,(%r14)
  mov    $0x1,%edi
  movq   $0x0,(%r14)
  mov    %rcx,0x10(%r14)
  movq   $0xffffffff80010001,0x20(%rdx)
  mov    %r15,0x28(%rdx)
  movq   $0x352ef853,0x30(%rdx)
  movq   $0x8000,0x40(%rdx)
  movq   $0xb,0x48(%rdx)
  movq   $0x301d23,0x50(%rdx)
  mov    %rax,0xa0(%rdx)
  xor    %eax,%eax
  mov    %rdx,-0x50(%rbp)
  call   <report_subtest@plt>
  mov    -0x50(%rbp),%rdx
  movq   $0x1,(%rdx)
  nopl   (%rax)
L32:
  mov    0x8(%r14),%rax
  test   $0x40,%al
  je     L32
  mov    -0x48(%rbp),%ebx
  mov    %rsp,%rcx
  test   %ebx,%ebx
  lea    0x3(%rbx),%eax
  cmovns %ebx,%eax
  sar    $0x2,%eax
  cltq
  lea    0xf(,%rax,8),%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L144
L129:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L129
L144:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L46
L58:
  mov    -0x58(%rbp),%eax
  imul   -0x54(%rbp),%eax
  mov    %rsp,%rsi
  mov    %rsp,%rcx
  and    $0xfffffc00,%esi
  lea    0x400(%rsi),%rbx
  test   %eax,%eax
  lea    0x3(%rax),%edx
  cmovs  %edx,%eax
  sar    $0x2,%eax
  cltq
  lea    0xf(,%rax,8),%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L36
L11:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L11
L36:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L130
L98:
  movslq %ebx,%rax
  mov    %rsp,%r15
  mov    $0x2,%edi
  mov    %rsi,-0x48(%rbp)
  mov    %rax,0x18(%r14)
  xor    %eax,%eax
  and    $0xfffffc00,%r15d
  add    $0x400,%r15
  call   <report_subtest@plt>
  mov    -0x54(%rbp),%edi
  mov    -0x48(%rbp),%rsi
  sub    $0x8,%rsp
  xor    %r9d,%r9d
  xor    %r8d,%r8d
  xor    %ecx,%ecx
  movl   $0x1,0x400(%rsi)
  lea    (%rdi,%r15,1),%eax
  mov    $0x6,%esi
  mov    %r15d,0x4(%rbx)
  movl   $0x1,0x8(%rbx)
  mov    %eax,0xc(%rbx)
  lea    (%rdi,%rdi,1),%eax
  lea    (%rax,%r15,1),%edx
  add    %edi,%eax
  movl   $0x1,0x10(%rbx)
  mov    $0x123,%edi
  add    %r15d,%eax
  mov    %edx,0x14(%rbx)
  mov    $0x1,%edx
  movl   $0x3,0x18(%rbx)
  mov    %eax,0x1c(%rbx)
  xor    %eax,%eax
  push   %r15
  push   %r13
  push   $0x0
  push   $0x1
  push   $0xffffffffbaadcaad
  push   $0x0
  push   $0x3
  push   $0x0
  push   $0x0
  call   <TMTF@plt>
  movslq -0x54(%rbp),%rbx
  add    $0x48,%rsp
  xor    %r9d,%r9d
  mov    $0x1,%r8d
  mov    $0x1,%ecx
  mov    $0x1,%edx
  xor    %eax,%eax
  add    %rbx,%r15
  mov    $0x6,%esi
  mov    $0x123,%edi
  push   %r15
  add    %rbx,%r15
  push   %r13
  add    %r15,%rbx
  push   $0x1
  push   $0x1
  push   $0xffffffffbaadcaad
  push   $0x0
  push   $0x3
  push   $0x0
  push   $0x0
  call   <TMTF@plt>
  add    $0x48,%rsp
  xor    %r9d,%r9d
  xor    %eax,%eax
  push   %r15
  mov    $0x2,%r8d
  mov    $0x2,%ecx
  mov    $0x1,%edx
  push   %r13
  mov    $0x6,%esi
  mov    $0x123,%edi
  push   $0x2
  push   $0x1
  push   $0xffffffffbaadcaad
  push   $0x0
  push   $0x3
  push   $0x0
  push   $0x0
  call   <TMTF@plt>
  add    $0x48,%rsp
  xor    %r9d,%r9d
  xor    %eax,%eax
  push   %rbx
  mov    $0x3,%ecx
  mov    $0x1,%edx
  mov    $0x6,%esi
  push   %r13
  mov    $0x3,%r8d
  mov    $0x123,%edi
  push   $0x3
  push   $0x1
  push   $0xffffffffbaadcaad
  push   $0x0
  push   $0x3
  push   $0x0
  push   $0x0
  call   <TMTF@plt>
  add    $0x50,%rsp
  mov    $0x3,%edi
  xor    %eax,%eax
  call   <report_subtest@plt>
  movq   $0x1,(%r14)
  xchg   %ax,%ax
L92:
  mov    (%r14),%rax
  test   $0x1,%al
  jne    L92
  mov    $0x4,%edi
  xor    %eax,%eax
  call   <report_subtest@plt>
  nopl   0x0(%rax,%rax,1)
L106:
  mov    0x8(%r14),%rax
  test   $0x20,%al
  je     L106
  mov    $0x5,%edi
  xor    %eax,%eax
  call   <report_subtest@plt>
  movq   $0x1f,0x8(%r14)
  nopl   0x0(%rax)
L81:
  mov    0x8(%r14),%rax
  test   $0x10,%al
  je     L81
  mov    $0x6,%edi
  xor    %eax,%eax
  call   <report_subtest@plt>
  movq   $0x1f,0x8(%r14)
  nopl   0x0(%rax)
L16:
  mov    0x8(%r14),%rax
  test   $0x10,%al
  je     L16
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <report_subtest@plt>
  xor    %eax,%eax
  mov    $0x7,%edi
  call   <report_subtest@plt>
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L86
  lea    -0x28(%rbp),%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  cs nopw 0x0(%rax,%rax,1)
L46:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L58
L130:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L98
L86:
  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);
}
```