// File: /workspace/github_c_makefile_star2_O1/MersenneTwister-Lab[P]MTGP/mtgp32-fast.c
// Function: main
int main(int argc, char *argv[]) {
    int mexp;
    int no;
    uint32_t seed = 1;
    uint32_t seed_ar[4] = {1, 2, 3, 4};
    char seed_str[] = "\01\02\03\04";
    mtgp32_params_fast_t *params;
    mtgp32_fast_t mtgp32;
    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 11213:
	params = mtgp32_params_fast_11213;
	break;
    case 23209:
	params = mtgp32_params_fast_23209;
	break;
    case 44497:
	params = mtgp32_params_fast_44497;
	break;
    default:
	printf("%s: mexp no.\n", argv[0]);
	printf("mexp shuould be 11213, 23209 or 44497\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 = mtgp32_init(&mtgp32, params, seed);
    if (rc) {
	printf("failure in mtgp32_init\n");
	return -1;
    }
    mtgp32_print_idstring(&mtgp32, stdout);
    printf("init:\n");
    print_uint32(&mtgp32, 1000);
    mtgp32_free(&mtgp32);

    rc = mtgp32_init_by_array(&mtgp32, params, seed_ar, 4);
    if (rc) {
	printf("failure in mtgp32_init_by_array\n");
	return -1;
    }
    printf("init_array:\n");
    print_uint32(&mtgp32, 1000);
    mtgp32_free(&mtgp32);

    rc = mtgp32_init_by_str(&mtgp32, params, seed_str);
    if (rc) {
	printf("failure in mtgp32_init_by_str\n");
	return -1;
    }
    printf("init_str:\n");
    print_uint32(&mtgp32, 1000);
    print_close1_open2(&mtgp32, 1000);
    print_close_open(&mtgp32, 1000);
    print_open_close(&mtgp32, 1000);
    print_open_open(&mtgp32, 1000);

    mtgp32_free(&mtgp32);
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movq %rsi, %r14
cmpl $0x2, %edi
jg 0x2091
movq (%r14), %rsi
leaq 0xfad(%rip), %rdi       # 0x302d
xorl %eax, %eax
callq 0x1080
movl $0x1, %eax
jmp 0x2263
movq 0x8(%r14), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x10c0
movq %rax, %rbx
callq 0x1050
cmpl $0x0, (%rax)
je 0x20c9
movq (%r14), %rsi
leaq 0xf75(%rip), %rdi       # 0x302d
xorl %eax, %eax
callq 0x1080
movl $0x2, %eax
jmp 0x2263
movq %rax, %r15
movq 0x10(%r14), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x10c0
cmpl $0x0, (%r15)
je 0x20fd
movq (%r14), %rsi
leaq 0xf41(%rip), %rdi       # 0x302d
xorl %eax, %eax
callq 0x1080
movl $0x3, %eax
jmp 0x2263
cmpl $0x2bcd, %ebx           # imm = 0x2BCD
je 0x2127
cmpl $0xadd1, %ebx           # imm = 0xADD1
je 0x211e
cmpl $0x5aa9, %ebx           # imm = 0x5AA9
jne 0x218b
leaq 0xa574(%rip), %rbx      # 0xc690
jmp 0x212e
leaq 0x11b6b(%rip), %rbx     # 0x13c90
jmp 0x212e
leaq 0x2f62(%rip), %rbx      # 0x5090
testl $0xffffff80, %eax       # imm = 0xFFFFFF80
je 0x215c
movq (%r14), %rsi
leaq 0xeee(%rip), %rdi       # 0x302d
xorl %eax, %eax
callq 0x1080
leaq 0xf5f(%rip), %rdi       # 0x30ac
callq 0x1060
movl $0x5, %eax
jmp 0x2263
andl $0x7f, %eax
imulq $0xec, %rax, %rax
addq %rax, %rbx
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x11ec
testl %eax, %eax
je 0x21b2
leaq 0xf0f(%rip), %rdi       # 0x3095
jmp 0x2259
movq (%r14), %rsi
leaq 0xe98(%rip), %rdi       # 0x302d
xorl %eax, %eax
callq 0x1080
leaq 0xf26(%rip), %rdi       # 0x30c9
callq 0x1060
movl $0x4, %eax
jmp 0x2263
movq 0x2e27(%rip), %rax      # 0x4fe0
movq (%rax), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x196e
leaq 0xe6b(%rip), %rdi       # 0x303b
callq 0x1060
movq %r14, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x19d0
movq 0xf0(%r14), %rdi
callq 0x1030
leaq 0xefb(%rip), %rdx       # 0x30f0
movq %r14, %rdi
movq %rbx, %rsi
movl $0x4, %ecx
callq 0x1341
testl %eax, %eax
je 0x2212
leaq 0xe65(%rip), %rdi       # 0x3075
jmp 0x2259
leaq 0xe28(%rip), %rdi       # 0x3041
callq 0x1060
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x19d0
movq 0xf0(%r14), %rdi
callq 0x1030
leaq 0xde5(%rip), %rdx       # 0x3028
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1635
testl %eax, %eax
je 0x2270
leaq 0xdfe(%rip), %rdi       # 0x3057
callq 0x1060
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %r15
retq
leaq 0xdd6(%rip), %rdi       # 0x304d
callq 0x1060
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x19d0
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1b0c
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1c60
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1db4
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1f0d
movq 0xf0(%rbx), %rdi
callq 0x1030
xorl %eax, %eax
jmp 0x2263
nop