// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x218, %rsp            # imm = 0x218
movl $0x0, 0x214(%rsp)
movl %edi, 0x210(%rsp)
movq %rsi, 0x208(%rsp)
movq $0x1, 0x1f8(%rsp)
movq 0x141c(%rip), %rax      # 0x4100
movq %rax, 0x1d0(%rsp)
movq 0x1415(%rip), %rax      # 0x4108
movq %rax, 0x1d8(%rsp)
movq 0x140e(%rip), %rax      # 0x4110
movq %rax, 0x1e0(%rsp)
movq 0x1407(%rip), %rax      # 0x4118
movq %rax, 0x1e8(%rsp)
movl 0x1318(%rip), %eax      # 0x4037
movl %eax, 0x1cb(%rsp)
movb 0x130f(%rip), %al       # 0x403b
movb %al, 0x1cf(%rsp)
cmpl $0x2, 0x210(%rsp)
jg 0x2d66
movq 0x208(%rsp), %rax
movq (%rax), %rsi
leaq 0x12ed(%rip), %rdi      # 0x403c
movb $0x0, %al
callq 0x1060
movl $0x1, 0x214(%rsp)
jmp 0x30b0
movq 0x208(%rsp), %rax
movq 0x8(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x1090
movl %eax, 0x204(%rsp)
callq 0x1040
cmpl $0x0, (%rax)
je 0x2dba
movq 0x208(%rsp), %rax
movq (%rax), %rsi
leaq 0x1299(%rip), %rdi      # 0x403c
movb $0x0, %al
callq 0x1060
movl $0x2, 0x214(%rsp)
jmp 0x30b0
movq 0x208(%rsp), %rax
movq 0x10(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x1090
movl %eax, 0x200(%rsp)
callq 0x1040
cmpl $0x0, (%rax)
je 0x2e0e
movq 0x208(%rsp), %rax
movq (%rax), %rsi
leaq 0x1245(%rip), %rdi      # 0x403c
movb $0x0, %al
callq 0x1060
movl $0x3, 0x214(%rsp)
jmp 0x30b0
movl 0x204(%rsp), %eax
movl %eax, (%rsp)
subl $0x5aa9, %eax           # imm = 0x5AA9
je 0x2e4a
jmp 0x2e21
movl (%rsp), %eax
subl $0xadd1, %eax           # imm = 0xADD1
je 0x2e39
jmp 0x2e2d
movl (%rsp), %eax
subl $0x1afa7, %eax          # imm = 0x1AFA7
je 0x2e5b
jmp 0x2e6c
leaq 0x10a30(%rip), %rax     # 0x13870
movq %rax, 0x1c0(%rsp)
jmp 0x2ea3
leaq 0x321f(%rip), %rax      # 0x6070
movq %rax, 0x1c0(%rsp)
jmp 0x2ea3
leaq 0x1e20e(%rip), %rax     # 0x21070
movq %rax, 0x1c0(%rsp)
jmp 0x2ea3
movq 0x208(%rsp), %rax
movq (%rax), %rsi
leaq 0x11be(%rip), %rdi      # 0x403c
movb $0x0, %al
callq 0x1060
leaq 0x11be(%rip), %rdi      # 0x404a
movb $0x0, %al
callq 0x1060
movl $0x4, 0x214(%rsp)
jmp 0x30b0
cmpl $0x80, 0x200(%rsp)
jge 0x2eba
cmpl $0x0, 0x200(%rsp)
jge 0x2ef1
movq 0x208(%rsp), %rax
movq (%rax), %rsi
leaq 0x1170(%rip), %rdi      # 0x403c
movb $0x0, %al
callq 0x1060
leaq 0x118f(%rip), %rdi      # 0x4069
movb $0x0, %al
callq 0x1060
movl $0x5, 0x214(%rsp)
jmp 0x30b0
movl 0x200(%rsp), %ecx
movq 0x1c0(%rsp), %rax
movslq %ecx, %rcx
imulq $0x1b0, %rcx, %rcx      # imm = 0x1B0
addq %rcx, %rax
movq %rax, 0x1c0(%rsp)
movq 0x1c0(%rsp), %rsi
movq 0x1f8(%rsp), %rdx
leaq 0x8(%rsp), %rdi
callq 0x11c0
movl %eax, 0x4(%rsp)
cmpl $0x0, 0x4(%rsp)
je 0x2f58
leaq 0x1146(%rip), %rdi      # 0x4087
movb $0x0, %al
callq 0x1060
movl $0xffffffff, 0x214(%rsp) # imm = 0xFFFFFFFF
jmp 0x30b0
movq 0x3081(%rip), %rax      # 0x5fe0
movq (%rax), %rsi
leaq 0x8(%rsp), %rdi
callq 0x26d0
leaq 0x112c(%rip), %rdi      # 0x409f
movb $0x0, %al
callq 0x1060
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2760
leaq 0x8(%rsp), %rdi
callq 0x26b0
movq 0x1c0(%rsp), %rsi
leaq 0x1d0(%rsp), %rdx
leaq 0x8(%rsp), %rdi
movl $0x4, %ecx
callq 0x1480
movl %eax, 0x4(%rsp)
cmpl $0x0, 0x4(%rsp)
je 0x2fdb
leaq 0x10e2(%rip), %rdi      # 0x40a6
movb $0x0, %al
callq 0x1060
movl $0xffffffff, 0x214(%rsp) # imm = 0xFFFFFFFF
jmp 0x30b0
leaq 0x10e5(%rip), %rdi      # 0x40c7
movb $0x0, %al
callq 0x1060
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2760
leaq 0x8(%rsp), %rdi
callq 0x26b0
movq 0x1c0(%rsp), %rsi
leaq 0x1cb(%rsp), %rdx
leaq 0x8(%rsp), %rdi
callq 0x1dc0
movl %eax, 0x4(%rsp)
cmpl $0x0, 0x4(%rsp)
je 0x3042
leaq 0x10a6(%rip), %rdi      # 0x40d4
movb $0x0, %al
callq 0x1060
movl $0xffffffff, 0x214(%rsp) # imm = 0xFFFFFFFF
jmp 0x30b0
leaq 0x10aa(%rip), %rdi      # 0x40f3
movb $0x0, %al
callq 0x1060
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2760
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x28b0
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2a00
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2aa0
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2b40
leaq 0x8(%rsp), %rdi
callq 0x26b0
movl $0x0, 0x214(%rsp)
movl 0x214(%rsp), %eax
addq $0x218, %rsp            # imm = 0x218
retq
nop