I'm trying to convert x86-64 assembly into C code, but am still unsure about some of the lines. This is the assembly code:    ....  pushq %rbp   movq %rsp, %rbp   subq $20, %rsp  movl %edi, -20(%rbp)   movl $2, -4(%rbp)  jmp .L2  movl -20(%rbp), %eax //1 Lines 1-3 divide %eax / -4(%rbp)  cltd  //2 the quotient is stored in %eax  idivl -4(%rbp) //3 Remainder is stored in %edx  movl %edx, %eax   testl %eax, %eax  jne .L3   movl $0, %eax   jmp .L4 .L3:   addl $1, -4(%rbp).L2:   movl -4(%rbp), %eax   cmpl -20(%rbp), %eax  jl .L5   movl $1, %eax .L4:   leave   ret   .....In C, would it be:int function (int param) {   int var1= 2;    while (var1 < param) {       if (eax != 0) { // instead of eax, should it be var1?           eax = eax / var1; // unsure about the body   } return var1; }If anyone can help with guiding me to the right direction or showing me what I'm missing that would be nice.
Translating x86-64 assembly to C
assembly;x86;c