// File: /workspace/github_c_makefile_star2_O3/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:
pushq %r15
pushq %r14
pushq %rbx
subq $0x80, %rsp
movq %rsi, %rbx
cmpl $0x2, %edi
jg 0x1e4e
movq (%rbx), %rsi
leaq 0x11ff(%rip), %rdi      # 0x303c
xorl %eax, %eax
callq 0x1080
movl $0x1, %eax
jmp 0x2028
movq 0x8(%rbx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x10c0
movq %rax, %r14
callq 0x1050
cmpl $0x0, (%rax)
je 0x1e86
movq (%rbx), %rsi
leaq 0x11c7(%rip), %rdi      # 0x303c
xorl %eax, %eax
callq 0x1080
movl $0x2, %eax
jmp 0x2028
movq %rax, %r15
movq 0x10(%rbx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x10c0
cmpl $0x0, (%r15)
je 0x1eba
movq (%rbx), %rsi
leaq 0x1193(%rip), %rdi      # 0x303c
xorl %eax, %eax
callq 0x1080
movl $0x3, %eax
jmp 0x2028
cmpl $0x1afa7, %r14d         # imm = 0x1AFA7
je 0x1eeb
cmpl $0xadd1, %r14d          # imm = 0xADD1
je 0x1ee2
cmpl $0x5aa9, %r14d          # imm = 0x5AA9
jne 0x2006
leaq 0x31a0(%rip), %r14      # 0x5080
jmp 0x1ef2
leaq 0x6997(%rip), %r14      # 0x8880
jmp 0x1ef2
leaq 0xa18e(%rip), %r14      # 0xc080
testl $0xffffff80, %eax       # imm = 0xFFFFFF80
je 0x1f20
movq (%rbx), %rsi
leaq 0x1139(%rip), %rdi      # 0x303c
xorl %eax, %eax
callq 0x1080
leaq 0x1155(%rip), %rdi      # 0x3066
callq 0x1060
movl $0x5, %eax
jmp 0x2028
andl $0x7f, %eax
imulq $0x70, %rax, %rax
addq %rax, %r14
leaq 0x8(%rsp), %rbx
movl $0x1, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x11dc
movq 0x309a(%rip), %rax      # 0x4fe0
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x1956
leaq 0x10f2(%rip), %rdi      # 0x304a
callq 0x1060
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1b3f
leaq 0x113f(%rip), %rdx      # 0x30b0
movq %rbx, %rdi
movq %r14, %rsi
movl $0x4, %ecx
callq 0x12e5
leaq 0x10c8(%rip), %rdi      # 0x3050
callq 0x1060
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1b3f
leaq 0x1096(%rip), %rdx      # 0x3037
movq %rbx, %rdi
movq %r14, %rsi
callq 0x160e
leaq 0x10a9(%rip), %rdi      # 0x305c
callq 0x1060
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1b3f
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1bbb
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1c4d
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1ce7
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1d85
movq 0x70(%rbx), %rdi
callq 0x1030
xorl %eax, %eax
jmp 0x2028
movq (%rbx), %rsi
leaq 0x102c(%rip), %rdi      # 0x303c
xorl %eax, %eax
callq 0x1080
leaq 0x1065(%rip), %rdi      # 0x3083
callq 0x1060
movl $0x4, %eax
addq $0x80, %rsp
popq %rbx
popq %r14
popq %r15
retq
nopl (%rax)