// File: /workspace/github_c_makefile_star2_O1/MersenneTwister-Lab[P]MTGP/mtgp64-fast.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_fast_t *params;
    mtgp64_fast_t mtgp64;
    int rc;

    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_fast_44497;
	break;
    case 23209:
	params = mtgp64_params_fast_23209;
	break;
    case 110503:
	params = mtgp64_params_fast_110503;
	break;
    default:
	printf("%s: mexp no.\n", argv[0]);
	printf("mexp = 23209, 44497 or 110503\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;
    rc = mtgp64_init(&mtgp64, params, seed);
    if (rc) {
	printf("failure in mtgp64_init\n");
	return -1;
    }
    mtgp64_print_idstring(&mtgp64, stdout);
    printf("init:\n");
    print_uint64(&mtgp64, 1000);
    mtgp64_free(&mtgp64);

    rc = mtgp64_init_by_array(&mtgp64, params, seed_ar, 4);
    if (rc) {
	printf("failure in mtgp64_init_by_array\n");
	return -1;
    }
    printf("init_array:\n");
    print_uint64(&mtgp64, 1000);
    mtgp64_free(&mtgp64);

    rc = mtgp64_init_by_str(&mtgp64, params, seed_str);
    if (rc) {
	printf("failure in mtgp64_init_by_str\n");
	return -1;
    }
    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 $0x1c0, %rsp            # imm = 0x1C0
movq %rsi, %r14
cmpl $0x2, %edi
jg 0x21c8
movq (%r14), %rsi
leaq 0xe85(%rip), %rdi       # 0x303c
xorl %eax, %eax
callq 0x1080
movl $0x1, %eax
jmp 0x239a
movq 0x8(%r14), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x10c0
movq %rax, %rbx
callq 0x1050
cmpl $0x0, (%rax)
je 0x2200
movq (%r14), %rsi
leaq 0xe4d(%rip), %rdi       # 0x303c
xorl %eax, %eax
callq 0x1080
movl $0x2, %eax
jmp 0x239a
movq %rax, %r15
movq 0x10(%r14), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x10c0
cmpl $0x0, (%r15)
je 0x2234
movq (%r14), %rsi
leaq 0xe19(%rip), %rdi       # 0x303c
xorl %eax, %eax
callq 0x1080
movl $0x3, %eax
jmp 0x239a
cmpl $0x1afa7, %ebx          # imm = 0x1AFA7
je 0x225e
cmpl $0xadd1, %ebx           # imm = 0xADD1
je 0x2255
cmpl $0x5aa9, %ebx           # imm = 0x5AA9
jne 0x22c2
leaq 0x2e3d(%rip), %rbx      # 0x5090
jmp 0x2265
leaq 0x10634(%rip), %rbx     # 0x12890
jmp 0x2265
leaq 0x1de2b(%rip), %rbx     # 0x20090
testl $0xffffff80, %eax       # imm = 0xFFFFFF80
je 0x2293
movq (%r14), %rsi
leaq 0xdc6(%rip), %rdi       # 0x303c
xorl %eax, %eax
callq 0x1080
leaq 0xe37(%rip), %rdi       # 0x30bb
callq 0x1060
movl $0x5, %eax
jmp 0x239a
andl $0x7f, %eax
imulq $0x1b0, %rax, %rax      # imm = 0x1B0
addq %rax, %rbx
leaq 0x8(%rsp), %rdi
movl $0x1, %edx
movq %rbx, %rsi
callq 0x11ec
testl %eax, %eax
je 0x22e9
leaq 0xde7(%rip), %rdi       # 0x30a4
jmp 0x2390
movq (%r14), %rsi
leaq 0xd70(%rip), %rdi       # 0x303c
xorl %eax, %eax
callq 0x1080
leaq 0xdfe(%rip), %rdi       # 0x30d8
callq 0x1060
movl $0x4, %eax
jmp 0x239a
movq 0x2cf0(%rip), %rax      # 0x4fe0
movq (%rax), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x19f9
leaq 0xd43(%rip), %rdi       # 0x304a
callq 0x1060
movq %r14, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1a5b
movq 0x1b0(%r14), %rdi
callq 0x1030
leaq 0xdd4(%rip), %rdx       # 0x3100
movq %r14, %rdi
movq %rbx, %rsi
movl $0x4, %ecx
callq 0x1364
testl %eax, %eax
je 0x2349
leaq 0xd3d(%rip), %rdi       # 0x3084
jmp 0x2390
leaq 0xd00(%rip), %rdi       # 0x3050
callq 0x1060
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1a5b
movq 0x1b0(%r14), %rdi
callq 0x1030
leaq 0xcbd(%rip), %rdx       # 0x3037
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1693
testl %eax, %eax
je 0x23a7
leaq 0xcd6(%rip), %rdi       # 0x3066
callq 0x1060
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x1c0, %rsp            # imm = 0x1C0
popq %rbx
popq %r14
popq %r15
retq
leaq 0xcae(%rip), %rdi       # 0x305c
callq 0x1060
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1a5b
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1bc1
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1d2f
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1ea5
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x201f
movq 0x1b0(%rbx), %rdi
callq 0x1030
xorl %eax, %eax
jmp 0x239a
nopl (%rax)