// File: /workspace/github_c_makefile_star2_O0/MersenneTwister-Lab[P]MTGP/mtgp64-ref.c
// Function: main
int main(int argc, char *argv[]) {
    int mexp;
    int no;
    uint64_t seed = 1;
    uint64_t seed_ar[4] = {1, 2, 3, 4};
    char seed_str[] = "\01\02\03\04";
    mtgp64_params_ref_t *params;
    mtgp64_ref_t mtgp64;
    if (argc <= 2) {
	printf("%s: mexp no.\n", argv[0]);
	return 1;
    }
    mexp = strtol(argv[1], NULL, 10);
    if (errno) {
	printf("%s: mexp no.\n", argv[0]);
	return 2;
    }
    no = strtol(argv[2], NULL, 10);
    if (errno) {
	printf("%s: mexp no.\n", argv[0]);
	return 3;
    }
    switch (mexp) {
    case 44497:
	params = mtgp64_params_ref_44497;
	break;
    case 23209:
	params = mtgp64_params_ref_23209;
	break;
    case 110503:
	params = mtgp64_params_ref_110503;
	break;
    default:
	printf("%s: mexp no.\n", argv[0]);
	printf("mexp = 23209, 44497 or 110503 only\n");
	return 4;
    }
    if (no >= 128 || no < 0) {
	printf("%s: mexp no.\n", argv[0]);
	printf("no must be between 0 and 127\n");
	return 5;
    }
    params += no;
    mtgp64_init(&mtgp64, params, seed);
    mtgp64_print_idstring(&mtgp64, stdout);
    printf("init:\n");
    print_uint64(&mtgp64, 1000);
    mtgp64_init_by_array(&mtgp64, params, seed_ar, 4);
    printf("init_array:\n");
    print_uint64(&mtgp64, 1000);
    mtgp64_init_by_str(&mtgp64, params, seed_str);
    printf("init_str:\n");
    print_uint64(&mtgp64, 1000);
    print_close1_open2(&mtgp64, 1000);
    print_close_open(&mtgp64, 1000);
    print_open_close(&mtgp64, 1000);
    print_open_open(&mtgp64, 1000);

    mtgp64_free(&mtgp64);
    return 0;
}

// Assembly:
subq $0xd8, %rsp
movl $0x0, 0xd4(%rsp)
movl %edi, 0xd0(%rsp)
movq %rsi, 0xc8(%rsp)
movq $0x1, 0xb8(%rsp)
movq 0x13bc(%rip), %rax      # 0x40b0
movq %rax, 0x90(%rsp)
movq 0x13b5(%rip), %rax      # 0x40b8
movq %rax, 0x98(%rsp)
movq 0x13ae(%rip), %rax      # 0x40c0
movq %rax, 0xa0(%rsp)
movq 0x13a7(%rip), %rax      # 0x40c8
movq %rax, 0xa8(%rsp)
movl 0x1308(%rip), %eax      # 0x4037
movl %eax, 0x8b(%rsp)
movb 0x12ff(%rip), %al       # 0x403b
movb %al, 0x8f(%rsp)
cmpl $0x2, 0xd0(%rsp)
jg 0x2d76
movq 0xc8(%rsp), %rax
movq (%rax), %rsi
leaq 0x12dd(%rip), %rdi      # 0x403c
movb $0x0, %al
callq 0x1060
movl $0x1, 0xd4(%rsp)
jmp 0x3034
movq 0xc8(%rsp), %rax
movq 0x8(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x1090
movl %eax, 0xc4(%rsp)
callq 0x1040
cmpl $0x0, (%rax)
je 0x2dca
movq 0xc8(%rsp), %rax
movq (%rax), %rsi
leaq 0x1289(%rip), %rdi      # 0x403c
movb $0x0, %al
callq 0x1060
movl $0x2, 0xd4(%rsp)
jmp 0x3034
movq 0xc8(%rsp), %rax
movq 0x10(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x1090
movl %eax, 0xc0(%rsp)
callq 0x1040
cmpl $0x0, (%rax)
je 0x2e1e
movq 0xc8(%rsp), %rax
movq (%rax), %rsi
leaq 0x1235(%rip), %rdi      # 0x403c
movb $0x0, %al
callq 0x1060
movl $0x3, 0xd4(%rsp)
jmp 0x3034
movl 0xc4(%rsp), %eax
movl %eax, 0x4(%rsp)
subl $0x5aa9, %eax           # imm = 0x5AA9
je 0x2e5d
jmp 0x2e32
movl 0x4(%rsp), %eax
subl $0xadd1, %eax           # imm = 0xADD1
je 0x2e4c
jmp 0x2e3f
movl 0x4(%rsp), %eax
subl $0x1afa7, %eax          # imm = 0x1AFA7
je 0x2e6e
jmp 0x2e7f
leaq 0x6a1d(%rip), %rax      # 0x9870
movq %rax, 0x80(%rsp)
jmp 0x2eb6
leaq 0x320c(%rip), %rax      # 0x6070
movq %rax, 0x80(%rsp)
jmp 0x2eb6
leaq 0xa1fb(%rip), %rax      # 0xd070
movq %rax, 0x80(%rsp)
jmp 0x2eb6
movq 0xc8(%rsp), %rax
movq (%rax), %rsi
leaq 0x11ab(%rip), %rdi      # 0x403c
movb $0x0, %al
callq 0x1060
leaq 0x11ab(%rip), %rdi      # 0x404a
movb $0x0, %al
callq 0x1060
movl $0x4, 0xd4(%rsp)
jmp 0x3034
cmpl $0x80, 0xc0(%rsp)
jge 0x2ecd
cmpl $0x0, 0xc0(%rsp)
jge 0x2f04
movq 0xc8(%rsp), %rax
movq (%rax), %rsi
leaq 0x115d(%rip), %rdi      # 0x403c
movb $0x0, %al
callq 0x1060
leaq 0x1181(%rip), %rdi      # 0x406e
movb $0x0, %al
callq 0x1060
movl $0x5, 0xd4(%rsp)
jmp 0x3034
movl 0xc0(%rsp), %ecx
movq 0x80(%rsp), %rax
movslq %ecx, %rcx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rsi
movq 0xb8(%rsp), %rdx
leaq 0x8(%rsp), %rdi
callq 0x11c0
movq 0x309a(%rip), %rax      # 0x5fe0
movq (%rax), %rsi
leaq 0x8(%rsp), %rdi
callq 0x2580
leaq 0x1132(%rip), %rdi      # 0x408c
movb $0x0, %al
callq 0x1060
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2a40
movq 0x80(%rsp), %rsi
leaq 0x90(%rsp), %rdx
leaq 0x8(%rsp), %rdi
movl $0x4, %ecx
callq 0x1370
leaq 0x10fd(%rip), %rdi      # 0x4093
movb $0x0, %al
callq 0x1060
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2a40
movq 0x80(%rsp), %rsi
leaq 0x8b(%rsp), %rdx
leaq 0x8(%rsp), %rdi
callq 0x1c90
leaq 0x10d3(%rip), %rdi      # 0x40a0
movb $0x0, %al
callq 0x1060
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2a40
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2ac0
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2b40
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2bc0
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2c40
leaq 0x8(%rsp), %rdi
callq 0x2560
movl $0x0, 0xd4(%rsp)
movl 0xd4(%rsp), %eax
addq $0xd8, %rsp
retq
nop