// File: /workspace/github_c_makefile_star2_O3/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 0x207e
movq (%r14), %rsi
leaq 0xfc0(%rip), %rdi       # 0x302d
xorl %eax, %eax
callq 0x1080
movl $0x1, %eax
jmp 0x2250
movq 0x8(%r14), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x10c0
movq %rax, %rbx
callq 0x1050
cmpl $0x0, (%rax)
je 0x20b6
movq (%r14), %rsi
leaq 0xf88(%rip), %rdi       # 0x302d
xorl %eax, %eax
callq 0x1080
movl $0x2, %eax
jmp 0x2250
movq %rax, %r15
movq 0x10(%r14), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x10c0
cmpl $0x0, (%r15)
je 0x20ea
movq (%r14), %rsi
leaq 0xf54(%rip), %rdi       # 0x302d
xorl %eax, %eax
callq 0x1080
movl $0x3, %eax
jmp 0x2250
cmpl $0x2bcd, %ebx           # imm = 0x2BCD
je 0x2114
cmpl $0xadd1, %ebx           # imm = 0xADD1
je 0x210b
cmpl $0x5aa9, %ebx           # imm = 0x5AA9
jne 0x2178
leaq 0xa587(%rip), %rbx      # 0xc690
jmp 0x211b
leaq 0x11b7e(%rip), %rbx     # 0x13c90
jmp 0x211b
leaq 0x2f75(%rip), %rbx      # 0x5090
testl $0xffffff80, %eax       # imm = 0xFFFFFF80
je 0x2149
movq (%r14), %rsi
leaq 0xf01(%rip), %rdi       # 0x302d
xorl %eax, %eax
callq 0x1080
leaq 0xf72(%rip), %rdi       # 0x30ac
callq 0x1060
movl $0x5, %eax
jmp 0x2250
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 0x219f
leaq 0xf22(%rip), %rdi       # 0x3095
jmp 0x2246
movq (%r14), %rsi
leaq 0xeab(%rip), %rdi       # 0x302d
xorl %eax, %eax
callq 0x1080
leaq 0xf39(%rip), %rdi       # 0x30c9
callq 0x1060
movl $0x4, %eax
jmp 0x2250
movq 0x2e3a(%rip), %rax      # 0x4fe0
movq (%rax), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x195b
leaq 0xe7e(%rip), %rdi       # 0x303b
callq 0x1060
movq %r14, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x19bd
movq 0xf0(%r14), %rdi
callq 0x1030
leaq 0xf0e(%rip), %rdx       # 0x30f0
movq %r14, %rdi
movq %rbx, %rsi
movl $0x4, %ecx
callq 0x1344
testl %eax, %eax
je 0x21ff
leaq 0xe78(%rip), %rdi       # 0x3075
jmp 0x2246
leaq 0xe3b(%rip), %rdi       # 0x3041
callq 0x1060
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x19bd
movq 0xf0(%r14), %rdi
callq 0x1030
leaq 0xdf8(%rip), %rdx       # 0x3028
movq %r14, %rdi
movq %rbx, %rsi
callq 0x163a
testl %eax, %eax
je 0x225d
leaq 0xe11(%rip), %rdi       # 0x3057
callq 0x1060
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %r15
retq
leaq 0xde9(%rip), %rdi       # 0x304d
callq 0x1060
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x19bd
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1af9
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1c4d
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1da1
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1efa
movq 0xf0(%rbx), %rdi
callq 0x1030
xorl %eax, %eax
jmp 0x2250
nop