#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ mpz_t;

/* Variables and functions */
int /*<<< orphan*/ gmp_printf(char *, ...);
int /*<<< orphan*/ mpz_add(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpz_add_ui(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/);
int /*<<< orphan*/ mpz_cdiv_q(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/);
int /*<<< orphan*/ mpz_clear(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_invert(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/);
int /*<<< orphan*/ mpz_mod(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpz_mul(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ mpz_set(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mpz_sub(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/);
void montgomery_ladder(mpz_t Xp, mpz_t Zp, mpz_t Xq, mpz_t Zq, mpz_t P, mpz_t a,
                       mpz_t b, mpz_t xd, int R) {
  mpz_t R0, R1, R2, R3, R4, R5, R6, R7;
  mpz_init(R0);
  mpz_init(R1);
  mpz_init(R2);
  mpz_init(R3);
  mpz_init(R4);
  mpz_init(R5);
  mpz_init(R6);
  mpz_init(R7);
  mpz_set(R0, Xp);
  mpz_set(R1, Zp);
  mpz_set(R2, Xq);
  mpz_set(R3, Zq);
  mpz_mul(R6, R2, R1);
  mpz_mul(R7, R3, R0);
  mpz_add(R4, R7, R6);
  mpz_sub(R5, R7, R6);
  mpz_mul(R5, R5, R5);
  mpz_mul(R7, R1, R3);
  mpz_mul(R1, a, R7);
  mpz_mul(R6, R7, R7);
  mpz_mul(R0, R0, R2);
  mpz_mul(R6, b, R6);
  mpz_add(R0, R0, R1);
  mpz_add(R6, R6, R6);
  mpz_mul(R0, R0, R4);
  mpz_mul(R1, xd, R5);
  mpz_add(R4, R0, R6);
  mpz_add(R4, R4, R4);
  mpz_add(R6, R2, R2);
  mpz_sub(R4, R4, R1);
  mpz_add(R7, R3, R3);
  mpz_mul(R0, R6, R7);
  mpz_mul(R1, R3, R3);
  mpz_mul(R2, R2, R2);
  mpz_mul(R3, a, R1);
  mpz_sub(R6, R2, R3);
  mpz_add(R7, R2, R3);
  mpz_add(R1, R1, R1);
  mpz_mul(R2, b, R1);
  mpz_mul(R7, R7, R0);
  mpz_mul(R1, R2, R1);
  mpz_mul(R0, R0, R2);
  mpz_mul(R6, R6, R6);
  mpz_sub(R6, R6, R0);
  mpz_add(R7, R7, R1);
  mpz_mod(R4, R4, P);
  mpz_mod(R5, R5, P);
  mpz_mod(R6, R6, P);
  mpz_mod(R7, R7, P);
  gmp_printf("\n VALORES con Reduccion\n");
  gmp_printf(" Xp = %Zd\n", Xp);
  gmp_printf(" Zp = %Zd\n", Zp);
  gmp_printf(" Xq = %Zd\n", Xq);
  gmp_printf(" Zq = %Zd\n", Zp);
  if (R == 1) {
    mpz_add_ui(Xp, R4, 0);
    mpz_add_ui(Zp, R5, 0);
    mpz_add_ui(Xq, R6, 0);
    mpz_add_ui(Zq, R7, 0);
  }
  if (R == 2) {
    mpz_add_ui(Xp, R6, 0);
    mpz_add_ui(Zp, R7, 0);
    mpz_add_ui(Xq, R4, 0);
    mpz_add_ui(Zq, R5, 0);
  }
  mpz_invert(Zp, Zp, P);
  mpz_mul(Xp, Xp, Zp);
  mpz_mod(Xp, Xp, P);
  mpz_cdiv_q(Zp, Zp, Zp);
  mpz_invert(Zq, Zq, P);
  mpz_mul(Xq, Xq, Zq);
  mpz_mod(Xq, Xq, P);
  mpz_cdiv_q(Zq, Zq, Zq);
  gmp_printf("\n VALORES en Coordenadas Afines\n");
  gmp_printf(" Xp = %Zd\n", Xp);
  gmp_printf(" Zp = %Zd\n", Zp);
  gmp_printf(" Xq = %Zd\n", Xq);
  gmp_printf(" Zq = %Zd\n", Zp);
  mpz_clear(R0);
  mpz_clear(R1);
  mpz_clear(R2);
  mpz_clear(R3);
  mpz_clear(R4);
  mpz_clear(R5);
  mpz_clear(R6);
  mpz_clear(R7);
}


x86 assembly (clang, -O0):
<montgomery_ladder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x1c(%rbp),%edi
call   1070 <mpz_init@plt>
mov    -0x20(%rbp),%edi
call   1070 <mpz_init@plt>
mov    -0x24(%rbp),%edi
call   1070 <mpz_init@plt>
mov    -0x28(%rbp),%edi
call   1070 <mpz_init@plt>
mov    -0x2c(%rbp),%edi
call   1070 <mpz_init@plt>
mov    -0x30(%rbp),%edi
call   1070 <mpz_init@plt>
mov    -0x34(%rbp),%edi
call   1070 <mpz_init@plt>
mov    -0x38(%rbp),%edi
call   1070 <mpz_init@plt>
mov    -0x1c(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1030 <mpz_set@plt>
mov    -0x20(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <mpz_set@plt>
mov    -0x24(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <mpz_set@plt>
mov    -0x28(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <mpz_set@plt>
mov    -0x34(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0x38(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0x2c(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    -0x34(%rbp),%edx
call   1080 <mpz_add@plt>
mov    -0x30(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    -0x34(%rbp),%edx
call   1040 <mpz_sub@plt>
mov    -0x30(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    -0x30(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0x38(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x28(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0x20(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x38(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0x34(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    -0x38(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0x1c(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0x34(%rbp),%edi
mov    0x10(%rbp),%esi
mov    -0x34(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0x1c(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1080 <mpz_add@plt>
mov    -0x34(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    -0x34(%rbp),%edx
call   1080 <mpz_add@plt>
mov    -0x1c(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x2c(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0x20(%rbp),%edi
mov    0x18(%rbp),%esi
mov    -0x30(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0x2c(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x34(%rbp),%edx
call   1080 <mpz_add@plt>
mov    -0x2c(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    -0x2c(%rbp),%edx
call   1080 <mpz_add@plt>
mov    -0x34(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1080 <mpz_add@plt>
mov    -0x2c(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1040 <mpz_sub@plt>
mov    -0x38(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x28(%rbp),%edx
call   1080 <mpz_add@plt>
mov    -0x1c(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    -0x38(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0x20(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x28(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0x24(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0x28(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0x34(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
call   1040 <mpz_sub@plt>
mov    -0x38(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
call   1080 <mpz_add@plt>
mov    -0x20(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1080 <mpz_add@plt>
mov    -0x24(%rbp),%edi
mov    0x10(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0x38(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0x20(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0x1c(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0x34(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    -0x34(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0x34(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1040 <mpz_sub@plt>
mov    -0x38(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1080 <mpz_add@plt>
mov    -0x2c(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    -0x14(%rbp),%edx
call   10a0 <mpz_mod@plt>
mov    -0x30(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    -0x14(%rbp),%edx
call   10a0 <mpz_mod@plt>
mov    -0x34(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    -0x14(%rbp),%edx
call   10a0 <mpz_mod@plt>
mov    -0x38(%rbp),%edi
mov    -0x38(%rbp),%esi
mov    -0x14(%rbp),%edx
call   10a0 <mpz_mod@plt>
lea    0xbb2(%rip),%rdi
mov    $0x0,%al
call   10c0 <gmp_printf@plt>
mov    -0x4(%rbp),%esi
lea    0xbba(%rip),%rdi
mov    $0x0,%al
call   10c0 <gmp_printf@plt>
mov    -0x8(%rbp),%esi
lea    0xbb4(%rip),%rdi
mov    $0x0,%al
call   10c0 <gmp_printf@plt>
mov    -0xc(%rbp),%esi
lea    0xbae(%rip),%rdi
mov    $0x0,%al
call   10c0 <gmp_printf@plt>
mov    -0x8(%rbp),%esi
lea    0xba8(%rip),%rdi
mov    $0x0,%al
call   10c0 <gmp_printf@plt>
cmpl   $0x1,0x20(%rbp)
jne    14d7 <montgomery_ladder+0x327>
mov    -0x4(%rbp),%edi
mov    -0x2c(%rbp),%esi
xor    %edx,%edx
call   1050 <mpz_add_ui@plt>
mov    -0x8(%rbp),%edi
mov    -0x30(%rbp),%esi
xor    %edx,%edx
call   1050 <mpz_add_ui@plt>
mov    -0xc(%rbp),%edi
mov    -0x34(%rbp),%esi
xor    %edx,%edx
call   1050 <mpz_add_ui@plt>
mov    -0x10(%rbp),%edi
mov    -0x38(%rbp),%esi
xor    %edx,%edx
call   1050 <mpz_add_ui@plt>
cmpl   $0x2,0x20(%rbp)
jne    1515 <montgomery_ladder+0x365>
mov    -0x4(%rbp),%edi
mov    -0x34(%rbp),%esi
xor    %edx,%edx
call   1050 <mpz_add_ui@plt>
mov    -0x8(%rbp),%edi
mov    -0x38(%rbp),%esi
xor    %edx,%edx
call   1050 <mpz_add_ui@plt>
mov    -0xc(%rbp),%edi
mov    -0x2c(%rbp),%esi
xor    %edx,%edx
call   1050 <mpz_add_ui@plt>
mov    -0x10(%rbp),%edi
mov    -0x30(%rbp),%esi
xor    %edx,%edx
call   1050 <mpz_add_ui@plt>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1060 <mpz_invert@plt>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x14(%rbp),%edx
call   10a0 <mpz_mod@plt>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
call   10d0 <mpz_cdiv_q@plt>
mov    -0x10(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1060 <mpz_invert@plt>
mov    -0xc(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1090 <mpz_mul@plt>
mov    -0xc(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
call   10a0 <mpz_mod@plt>
mov    -0x10(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    -0x10(%rbp),%edx
call   10d0 <mpz_cdiv_q@plt>
lea    0xab9(%rip),%rdi
mov    $0x0,%al
call   10c0 <gmp_printf@plt>
mov    -0x4(%rbp),%esi
lea    0xa7c(%rip),%rdi
mov    $0x0,%al
call   10c0 <gmp_printf@plt>
mov    -0x8(%rbp),%esi
lea    0xa76(%rip),%rdi
mov    $0x0,%al
call   10c0 <gmp_printf@plt>
mov    -0xc(%rbp),%esi
lea    0xa70(%rip),%rdi
mov    $0x0,%al
call   10c0 <gmp_printf@plt>
mov    -0x8(%rbp),%esi
lea    0xa6a(%rip),%rdi
mov    $0x0,%al
call   10c0 <gmp_printf@plt>
mov    -0x1c(%rbp),%edi
call   10b0 <mpz_clear@plt>
mov    -0x20(%rbp),%edi
call   10b0 <mpz_clear@plt>
mov    -0x24(%rbp),%edi
call   10b0 <mpz_clear@plt>
mov    -0x28(%rbp),%edi
call   10b0 <mpz_clear@plt>
mov    -0x2c(%rbp),%edi
call   10b0 <mpz_clear@plt>
mov    -0x30(%rbp),%edi
call   10b0 <mpz_clear@plt>
mov    -0x34(%rbp),%edi
call   10b0 <mpz_clear@plt>
mov    -0x38(%rbp),%edi
call   10b0 <mpz_clear@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<montgomery_ladder>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,0x4(%rsp)
mov    %r8d,%r15d
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %edx,0x8(%rsp)
mov    %esi,%r12d
mov    %edi,%ebx
mov    %edi,0x10(%rsp)
mov    0x60(%rsp),%eax
mov    %eax,0x14(%rsp)
mov    0x58(%rsp),%eax
mov    %eax,0xc(%rsp)
mov    0x50(%rsp),%r13d
call   1070 <mpz_init@plt>
call   1070 <mpz_init@plt>
call   1070 <mpz_init@plt>
call   1070 <mpz_init@plt>
call   1070 <mpz_init@plt>
call   1070 <mpz_init@plt>
call   1070 <mpz_init@plt>
call   1070 <mpz_init@plt>
mov    %ebx,%esi
mov    %r14d,%ebx
call   1030 <mpz_set@plt>
mov    %r12d,%esi
call   1030 <mpz_set@plt>
mov    %ebp,%esi
call   1030 <mpz_set@plt>
mov    %r14d,%esi
call   1030 <mpz_set@plt>
call   1090 <mpz_mul@plt>
call   1090 <mpz_mul@plt>
call   1080 <mpz_add@plt>
call   1040 <mpz_sub@plt>
call   1090 <mpz_mul@plt>
call   1090 <mpz_mul@plt>
mov    0x4(%rsp),%r14d
mov    %r14d,%esi
call   1090 <mpz_mul@plt>
call   1090 <mpz_mul@plt>
call   1090 <mpz_mul@plt>
mov    %r13d,%esi
call   1090 <mpz_mul@plt>
call   1080 <mpz_add@plt>
call   1080 <mpz_add@plt>
call   1090 <mpz_mul@plt>
mov    0xc(%rsp),%esi
call   1090 <mpz_mul@plt>
call   1080 <mpz_add@plt>
call   1080 <mpz_add@plt>
call   1080 <mpz_add@plt>
call   1040 <mpz_sub@plt>
call   1080 <mpz_add@plt>
call   1090 <mpz_mul@plt>
call   1090 <mpz_mul@plt>
call   1090 <mpz_mul@plt>
mov    %r14d,%esi
mov    0x10(%rsp),%ebp
mov    0x8(%rsp),%r14d
call   1090 <mpz_mul@plt>
call   1040 <mpz_sub@plt>
call   1080 <mpz_add@plt>
call   1080 <mpz_add@plt>
mov    %r13d,%esi
call   1090 <mpz_mul@plt>
call   1090 <mpz_mul@plt>
call   1090 <mpz_mul@plt>
call   1090 <mpz_mul@plt>
call   1090 <mpz_mul@plt>
call   1040 <mpz_sub@plt>
call   1080 <mpz_add@plt>
mov    %r15d,%edx
call   10a0 <mpz_mod@plt>
mov    %r15d,%edx
call   10a0 <mpz_mod@plt>
mov    %r15d,%edx
call   10a0 <mpz_mod@plt>
mov    %r15d,%edx
call   10a0 <mpz_mod@plt>
lea    0xce0(%rip),%rdi
xor    %eax,%eax
call   10c0 <gmp_printf@plt>
lea    0xceb(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   10c0 <gmp_printf@plt>
lea    0xce6(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   10c0 <gmp_printf@plt>
lea    0xce0(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   10c0 <gmp_printf@plt>
lea    0xcda(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   10c0 <gmp_printf@plt>
mov    0x14(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x1,%eax
ja     139c <montgomery_ladder+0x1ec>
mov    %ebp,%edi
xor    %edx,%edx
call   1050 <mpz_add_ui@plt>
mov    %r12d,%edi
xor    %edx,%edx
call   1050 <mpz_add_ui@plt>
mov    %r14d,%edi
xor    %edx,%edx
call   1050 <mpz_add_ui@plt>
mov    %ebx,%edi
xor    %edx,%edx
call   1050 <mpz_add_ui@plt>
mov    %r12d,%edi
mov    %r12d,%esi
mov    %r15d,%edx
call   1060 <mpz_invert@plt>
mov    %ebp,%edi
mov    %ebp,%esi
mov    %r12d,%edx
call   1090 <mpz_mul@plt>
mov    %ebp,%edi
mov    %ebp,%esi
mov    %r15d,%edx
call   10a0 <mpz_mod@plt>
mov    %r12d,%edi
mov    %r12d,%esi
mov    %r12d,%edx
call   10d0 <mpz_cdiv_q@plt>
mov    %ebx,%edi
mov    %ebx,%esi
mov    %r15d,%edx
call   1060 <mpz_invert@plt>
mov    %r14d,%edi
mov    %r14d,%esi
mov    %ebx,%edx
call   1090 <mpz_mul@plt>
mov    %r14d,%edi
mov    %r14d,%esi
mov    %r15d,%edx
call   10a0 <mpz_mod@plt>
mov    %ebx,%edi
mov    %ebx,%esi
mov    %ebx,%edx
call   10d0 <mpz_cdiv_q@plt>
lea    0xc3c(%rip),%rdi
xor    %eax,%eax
call   10c0 <gmp_printf@plt>
lea    0xc02(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   10c0 <gmp_printf@plt>
lea    0xbfd(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   10c0 <gmp_printf@plt>
lea    0xbf7(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   10c0 <gmp_printf@plt>
lea    0xbf1(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   10c0 <gmp_printf@plt>
call   10b0 <mpz_clear@plt>
call   10b0 <mpz_clear@plt>
call   10b0 <mpz_clear@plt>
call   10b0 <mpz_clear@plt>
call   10b0 <mpz_clear@plt>
call   10b0 <mpz_clear@plt>
call   10b0 <mpz_clear@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10b0 <mpz_clear@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"\0A VALORES con Reduccion\0A\00"
@.str.1 = [11 x i8] c" Xp = %Zd\0A\00"
@.str.2 = [11 x i8] c" Zp = %Zd\0A\00"
@.str.3 = [11 x i8] c" Xq = %Zd\0A\00"
@.str.4 = [11 x i8] c" Zq = %Zd\0A\00"
@.str.5 = [33 x i8] c"\0A VALORES en Coordenadas Afines\0A\00"
define void @montgomery_ladder(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8) {
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
store i32 %0, i32* %10
store i32 %1, i32* %11
store i32 %2, i32* %12
store i32 %3, i32* %13
store i32 %4, i32* %14
store i32 %5, i32* %15
store i32 %6, i32* %16
store i32 %7, i32* %17
store i32 %8, i32* %18
%27 = load i32, i32* %19
%28 = call i32 @mpz_init(i32 %27)
%29 = load i32, i32* %20
%30 = call i32 @mpz_init(i32 %29)
%31 = load i32, i32* %21
%32 = call i32 @mpz_init(i32 %31)
%33 = load i32, i32* %22
%34 = call i32 @mpz_init(i32 %33)
%35 = load i32, i32* %23
%36 = call i32 @mpz_init(i32 %35)
%37 = load i32, i32* %24
%38 = call i32 @mpz_init(i32 %37)
%39 = load i32, i32* %25
%40 = call i32 @mpz_init(i32 %39)
%41 = load i32, i32* %26
%42 = call i32 @mpz_init(i32 %41)
%43 = load i32, i32* %19
%44 = load i32, i32* %10
%45 = call i32 @mpz_set(i32 %43, i32 %44)
%46 = load i32, i32* %20
%47 = load i32, i32* %11
%48 = call i32 @mpz_set(i32 %46, i32 %47)
%49 = load i32, i32* %21
%50 = load i32, i32* %12
%51 = call i32 @mpz_set(i32 %49, i32 %50)
%52 = load i32, i32* %22
%53 = load i32, i32* %13
%54 = call i32 @mpz_set(i32 %52, i32 %53)
%55 = load i32, i32* %25
%56 = load i32, i32* %21
%57 = load i32, i32* %20
%58 = call i32 @mpz_mul(i32 %55, i32 %56, i32 %57)
%59 = load i32, i32* %26
%60 = load i32, i32* %22
%61 = load i32, i32* %19
%62 = call i32 @mpz_mul(i32 %59, i32 %60, i32 %61)
%63 = load i32, i32* %23
%64 = load i32, i32* %26
%65 = load i32, i32* %25
%66 = call i32 @mpz_add(i32 %63, i32 %64, i32 %65)
%67 = load i32, i32* %24
%68 = load i32, i32* %26
%69 = load i32, i32* %25
%70 = call i32 @mpz_sub(i32 %67, i32 %68, i32 %69)
%71 = load i32, i32* %24
%72 = load i32, i32* %24
%73 = load i32, i32* %24
%74 = call i32 @mpz_mul(i32 %71, i32 %72, i32 %73)
%75 = load i32, i32* %26
%76 = load i32, i32* %20
%77 = load i32, i32* %22
%78 = call i32 @mpz_mul(i32 %75, i32 %76, i32 %77)
%79 = load i32, i32* %20
%80 = load i32, i32* %15
%81 = load i32, i32* %26
%82 = call i32 @mpz_mul(i32 %79, i32 %80, i32 %81)
%83 = load i32, i32* %25
%84 = load i32, i32* %26
%85 = load i32, i32* %26
%86 = call i32 @mpz_mul(i32 %83, i32 %84, i32 %85)
%87 = load i32, i32* %19
%88 = load i32, i32* %19
%89 = load i32, i32* %21
%90 = call i32 @mpz_mul(i32 %87, i32 %88, i32 %89)
%91 = load i32, i32* %25
%92 = load i32, i32* %16
%93 = load i32, i32* %25
%94 = call i32 @mpz_mul(i32 %91, i32 %92, i32 %93)
%95 = load i32, i32* %19
%96 = load i32, i32* %19
%97 = load i32, i32* %20
%98 = call i32 @mpz_add(i32 %95, i32 %96, i32 %97)
%99 = load i32, i32* %25
%100 = load i32, i32* %25
%101 = load i32, i32* %25
%102 = call i32 @mpz_add(i32 %99, i32 %100, i32 %101)
%103 = load i32, i32* %19
%104 = load i32, i32* %19
%105 = load i32, i32* %23
%106 = call i32 @mpz_mul(i32 %103, i32 %104, i32 %105)
%107 = load i32, i32* %20
%108 = load i32, i32* %17
%109 = load i32, i32* %24
%110 = call i32 @mpz_mul(i32 %107, i32 %108, i32 %109)
%111 = load i32, i32* %23
%112 = load i32, i32* %19
%113 = load i32, i32* %25
%114 = call i32 @mpz_add(i32 %111, i32 %112, i32 %113)
%115 = load i32, i32* %23
%116 = load i32, i32* %23
%117 = load i32, i32* %23
%118 = call i32 @mpz_add(i32 %115, i32 %116, i32 %117)
%119 = load i32, i32* %25
%120 = load i32, i32* %21
%121 = load i32, i32* %21
%122 = call i32 @mpz_add(i32 %119, i32 %120, i32 %121)
%123 = load i32, i32* %23
%124 = load i32, i32* %23
%125 = load i32, i32* %20
%126 = call i32 @mpz_sub(i32 %123, i32 %124, i32 %125)
%127 = load i32, i32* %26
%128 = load i32, i32* %22
%129 = load i32, i32* %22
%130 = call i32 @mpz_add(i32 %127, i32 %128, i32 %129)
%131 = load i32, i32* %19
%132 = load i32, i32* %25
%133 = load i32, i32* %26
%134 = call i32 @mpz_mul(i32 %131, i32 %132, i32 %133)
%135 = load i32, i32* %20
%136 = load i32, i32* %22
%137 = load i32, i32* %22
%138 = call i32 @mpz_mul(i32 %135, i32 %136, i32 %137)
%139 = load i32, i32* %21
%140 = load i32, i32* %21
%141 = load i32, i32* %21
%142 = call i32 @mpz_mul(i32 %139, i32 %140, i32 %141)
%143 = load i32, i32* %22
%144 = load i32, i32* %15
%145 = load i32, i32* %20
%146 = call i32 @mpz_mul(i32 %143, i32 %144, i32 %145)
%147 = load i32, i32* %25
%148 = load i32, i32* %21
%149 = load i32, i32* %22
%150 = call i32 @mpz_sub(i32 %147, i32 %148, i32 %149)
%151 = load i32, i32* %26
%152 = load i32, i32* %21
%153 = load i32, i32* %22
%154 = call i32 @mpz_add(i32 %151, i32 %152, i32 %153)
%155 = load i32, i32* %20
%156 = load i32, i32* %20
%157 = load i32, i32* %20
%158 = call i32 @mpz_add(i32 %155, i32 %156, i32 %157)
%159 = load i32, i32* %21
%160 = load i32, i32* %16
%161 = load i32, i32* %20
%162 = call i32 @mpz_mul(i32 %159, i32 %160, i32 %161)
%163 = load i32, i32* %26
%164 = load i32, i32* %26
%165 = load i32, i32* %19
%166 = call i32 @mpz_mul(i32 %163, i32 %164, i32 %165)
%167 = load i32, i32* %20
%168 = load i32, i32* %21
%169 = load i32, i32* %20
%170 = call i32 @mpz_mul(i32 %167, i32 %168, i32 %169)
%171 = load i32, i32* %19
%172 = load i32, i32* %19
%173 = load i32, i32* %21
%174 = call i32 @mpz_mul(i32 %171, i32 %172, i32 %173)
%175 = load i32, i32* %25
%176 = load i32, i32* %25
%177 = load i32, i32* %25
%178 = call i32 @mpz_mul(i32 %175, i32 %176, i32 %177)
%179 = load i32, i32* %25
%180 = load i32, i32* %25
%181 = load i32, i32* %19
%182 = call i32 @mpz_sub(i32 %179, i32 %180, i32 %181)
%183 = load i32, i32* %26
%184 = load i32, i32* %26
%185 = load i32, i32* %20
%186 = call i32 @mpz_add(i32 %183, i32 %184, i32 %185)
%187 = load i32, i32* %23
%188 = load i32, i32* %23
%189 = load i32, i32* %14
%190 = call i32 @mpz_mod(i32 %187, i32 %188, i32 %189)
%191 = load i32, i32* %24
%192 = load i32, i32* %24
%193 = load i32, i32* %14
%194 = call i32 @mpz_mod(i32 %191, i32 %192, i32 %193)
%195 = load i32, i32* %25
%196 = load i32, i32* %25
%197 = load i32, i32* %14
%198 = call i32 @mpz_mod(i32 %195, i32 %196, i32 %197)
%199 = load i32, i32* %26
%200 = load i32, i32* %26
%201 = load i32, i32* %14
%202 = call i32 @mpz_mod(i32 %199, i32 %200, i32 %201)
%203 = call i32 (i8*, ...) @gmp_printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%204 = load i32, i32* %10
%205 = call i32 (i8*, ...) @gmp_printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %204)
%206 = load i32, i32* %11
%207 = call i32 (i8*, ...) @gmp_printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %206)
%208 = load i32, i32* %12
%209 = call i32 (i8*, ...) @gmp_printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %208)
%210 = load i32, i32* %11
%211 = call i32 (i8*, ...) @gmp_printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %210)
%212 = load i32, i32* %18
%213 = icmp eq i32 %212, 1
br i1 %213, label %214, label %227
214: ; preds = %9
%215 = load i32, i32* %10
%216 = load i32, i32* %23
%217 = call i32 @mpz_add_ui(i32 %215, i32 %216, i32 0)
%218 = load i32, i32* %11
%219 = load i32, i32* %24
%220 = call i32 @mpz_add_ui(i32 %218, i32 %219, i32 0)
%221 = load i32, i32* %12
%222 = load i32, i32* %25
%223 = call i32 @mpz_add_ui(i32 %221, i32 %222, i32 0)
%224 = load i32, i32* %13
%225 = load i32, i32* %26
%226 = call i32 @mpz_add_ui(i32 %224, i32 %225, i32 0)
br label %227
227: ; preds = %214, %9
%228 = load i32, i32* %18
%229 = icmp eq i32 %228, 2
br i1 %229, label %230, label %243
230: ; preds = %227
%231 = load i32, i32* %10
%232 = load i32, i32* %25
%233 = call i32 @mpz_add_ui(i32 %231, i32 %232, i32 0)
%234 = load i32, i32* %11
%235 = load i32, i32* %26
%236 = call i32 @mpz_add_ui(i32 %234, i32 %235, i32 0)
%237 = load i32, i32* %12
%238 = load i32, i32* %23
%239 = call i32 @mpz_add_ui(i32 %237, i32 %238, i32 0)
%240 = load i32, i32* %13
%241 = load i32, i32* %24
%242 = call i32 @mpz_add_ui(i32 %240, i32 %241, i32 0)
br label %243
243: ; preds = %230, %227
%244 = load i32, i32* %11
%245 = load i32, i32* %11
%246 = load i32, i32* %14
%247 = call i32 @mpz_invert(i32 %244, i32 %245, i32 %246)
%248 = load i32, i32* %10
%249 = load i32, i32* %10
%250 = load i32, i32* %11
%251 = call i32 @mpz_mul(i32 %248, i32 %249, i32 %250)
%252 = load i32, i32* %10
%253 = load i32, i32* %10
%254 = load i32, i32* %14
%255 = call i32 @mpz_mod(i32 %252, i32 %253, i32 %254)
%256 = load i32, i32* %11
%257 = load i32, i32* %11
%258 = load i32, i32* %11
%259 = call i32 @mpz_cdiv_q(i32 %256, i32 %257, i32 %258)
%260 = load i32, i32* %13
%261 = load i32, i32* %13
%262 = load i32, i32* %14
%263 = call i32 @mpz_invert(i32 %260, i32 %261, i32 %262)
%264 = load i32, i32* %12
%265 = load i32, i32* %12
%266 = load i32, i32* %13
%267 = call i32 @mpz_mul(i32 %264, i32 %265, i32 %266)
%268 = load i32, i32* %12
%269 = load i32, i32* %12
%270 = load i32, i32* %14
%271 = call i32 @mpz_mod(i32 %268, i32 %269, i32 %270)
%272 = load i32, i32* %13
%273 = load i32, i32* %13
%274 = load i32, i32* %13
%275 = call i32 @mpz_cdiv_q(i32 %272, i32 %273, i32 %274)
%276 = call i32 (i8*, ...) @gmp_printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
%277 = load i32, i32* %10
%278 = call i32 (i8*, ...) @gmp_printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %277)
%279 = load i32, i32* %11
%280 = call i32 (i8*, ...) @gmp_printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %279)
%281 = load i32, i32* %12
%282 = call i32 (i8*, ...) @gmp_printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %281)
%283 = load i32, i32* %11
%284 = call i32 (i8*, ...) @gmp_printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %283)
%285 = load i32, i32* %19
%286 = call i32 @mpz_clear(i32 %285)
%287 = load i32, i32* %20
%288 = call i32 @mpz_clear(i32 %287)
%289 = load i32, i32* %21
%290 = call i32 @mpz_clear(i32 %289)
%291 = load i32, i32* %22
%292 = call i32 @mpz_clear(i32 %291)
%293 = load i32, i32* %23
%294 = call i32 @mpz_clear(i32 %293)
%295 = load i32, i32* %24
%296 = call i32 @mpz_clear(i32 %295)
%297 = load i32, i32* %25
%298 = call i32 @mpz_clear(i32 %297)
%299 = load i32, i32* %26
%300 = call i32 @mpz_clear(i32 %299)
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"\0A VALORES con Reduccion\0A\00"
@.str.1 = [11 x i8] c" Xp = %Zd\0A\00"
@.str.2 = [11 x i8] c" Zp = %Zd\0A\00"
@.str.3 = [11 x i8] c" Xq = %Zd\0A\00"
@.str.4 = [11 x i8] c" Zq = %Zd\0A\00"
@.str.5 = [33 x i8] c"\0A VALORES en Coordenadas Afines\0A\00"
define void @montgomery_ladder(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8) {
%10 = tail call i32 @mpz_init(i32 undef)
%11 = tail call i32 @mpz_init(i32 undef)
%12 = tail call i32 @mpz_init(i32 undef)
%13 = tail call i32 @mpz_init(i32 undef)
%14 = tail call i32 @mpz_init(i32 undef)
%15 = tail call i32 @mpz_init(i32 undef)
%16 = tail call i32 @mpz_init(i32 undef)
%17 = tail call i32 @mpz_init(i32 undef)
%18 = tail call i32 @mpz_set(i32 undef, i32 %0)
%19 = tail call i32 @mpz_set(i32 undef, i32 %1)
%20 = tail call i32 @mpz_set(i32 undef, i32 %2)
%21 = tail call i32 @mpz_set(i32 undef, i32 %3)
%22 = tail call i32 @mpz_mul(i32 undef, i32 undef, i32 undef)
%23 = tail call i32 @mpz_mul(i32 undef, i32 undef, i32 undef)
%24 = tail call i32 @mpz_add(i32 undef, i32 undef, i32 undef)
%25 = tail call i32 @mpz_sub(i32 undef, i32 undef, i32 undef)
%26 = tail call i32 @mpz_mul(i32 undef, i32 undef, i32 undef)
%27 = tail call i32 @mpz_mul(i32 undef, i32 undef, i32 undef)
%28 = tail call i32 @mpz_mul(i32 undef, i32 %5, i32 undef)
%29 = tail call i32 @mpz_mul(i32 undef, i32 undef, i32 undef)
%30 = tail call i32 @mpz_mul(i32 undef, i32 undef, i32 undef)
%31 = tail call i32 @mpz_mul(i32 undef, i32 %6, i32 undef)
%32 = tail call i32 @mpz_add(i32 undef, i32 undef, i32 undef)
%33 = tail call i32 @mpz_add(i32 undef, i32 undef, i32 undef)
%34 = tail call i32 @mpz_mul(i32 undef, i32 undef, i32 undef)
%35 = tail call i32 @mpz_mul(i32 undef, i32 %7, i32 undef)
%36 = tail call i32 @mpz_add(i32 undef, i32 undef, i32 undef)
%37 = tail call i32 @mpz_add(i32 undef, i32 undef, i32 undef)
%38 = tail call i32 @mpz_add(i32 undef, i32 undef, i32 undef)
%39 = tail call i32 @mpz_sub(i32 undef, i32 undef, i32 undef)
%40 = tail call i32 @mpz_add(i32 undef, i32 undef, i32 undef)
%41 = tail call i32 @mpz_mul(i32 undef, i32 undef, i32 undef)
%42 = tail call i32 @mpz_mul(i32 undef, i32 undef, i32 undef)
%43 = tail call i32 @mpz_mul(i32 undef, i32 undef, i32 undef)
%44 = tail call i32 @mpz_mul(i32 undef, i32 %5, i32 undef)
%45 = tail call i32 @mpz_sub(i32 undef, i32 undef, i32 undef)
%46 = tail call i32 @mpz_add(i32 undef, i32 undef, i32 undef)
%47 = tail call i32 @mpz_add(i32 undef, i32 undef, i32 undef)
%48 = tail call i32 @mpz_mul(i32 undef, i32 %6, i32 undef)
%49 = tail call i32 @mpz_mul(i32 undef, i32 undef, i32 undef)
%50 = tail call i32 @mpz_mul(i32 undef, i32 undef, i32 undef)
%51 = tail call i32 @mpz_mul(i32 undef, i32 undef, i32 undef)
%52 = tail call i32 @mpz_mul(i32 undef, i32 undef, i32 undef)
%53 = tail call i32 @mpz_sub(i32 undef, i32 undef, i32 undef)
%54 = tail call i32 @mpz_add(i32 undef, i32 undef, i32 undef)
%55 = tail call i32 @mpz_mod(i32 undef, i32 undef, i32 %4)
%56 = tail call i32 @mpz_mod(i32 undef, i32 undef, i32 %4)
%57 = tail call i32 @mpz_mod(i32 undef, i32 undef, i32 %4)
%58 = tail call i32 @mpz_mod(i32 undef, i32 undef, i32 %4)
%59 = tail call i32 (i8*, ...) @gmp_printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%60 = tail call i32 (i8*, ...) @gmp_printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%61 = tail call i32 (i8*, ...) @gmp_printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %1)
%62 = tail call i32 (i8*, ...) @gmp_printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %2)
%63 = tail call i32 (i8*, ...) @gmp_printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %1)
%64 = add i32 %8, -1
%65 = icmp ult i32 %64, 2
br i1 %65, label %66, label %71
66: ; preds = %9
%67 = tail call i32 @mpz_add_ui(i32 %0, i32 undef, i32 0)
%68 = tail call i32 @mpz_add_ui(i32 %1, i32 undef, i32 0)
%69 = tail call i32 @mpz_add_ui(i32 %2, i32 undef, i32 0)
%70 = tail call i32 @mpz_add_ui(i32 %3, i32 undef, i32 0)
br label %71
71: ; preds = %9, %66
%72 = tail call i32 @mpz_invert(i32 %1, i32 %1, i32 %4)
%73 = tail call i32 @mpz_mul(i32 %0, i32 %0, i32 %1)
%74 = tail call i32 @mpz_mod(i32 %0, i32 %0, i32 %4)
%75 = tail call i32 @mpz_cdiv_q(i32 %1, i32 %1, i32 %1)
%76 = tail call i32 @mpz_invert(i32 %3, i32 %3, i32 %4)
%77 = tail call i32 @mpz_mul(i32 %2, i32 %2, i32 %3)
%78 = tail call i32 @mpz_mod(i32 %2, i32 %2, i32 %4)
%79 = tail call i32 @mpz_cdiv_q(i32 %3, i32 %3, i32 %3)
%80 = tail call i32 (i8*, ...) @gmp_printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
%81 = tail call i32 (i8*, ...) @gmp_printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%82 = tail call i32 (i8*, ...) @gmp_printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %1)
%83 = tail call i32 (i8*, ...) @gmp_printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %2)
%84 = tail call i32 (i8*, ...) @gmp_printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %1)
%85 = tail call i32 @mpz_clear(i32 undef)
%86 = tail call i32 @mpz_clear(i32 undef)
%87 = tail call i32 @mpz_clear(i32 undef)
%88 = tail call i32 @mpz_clear(i32 undef)
%89 = tail call i32 @mpz_clear(i32 undef)
%90 = tail call i32 @mpz_clear(i32 undef)
%91 = tail call i32 @mpz_clear(i32 undef)
%92 = tail call i32 @mpz_clear(i32 undef)
ret void
}