// File: /workspace/github_c_makefile_star2_O2/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 0x1dc4
movq (%r14), %rsi
leaq 0x1277(%rip), %rdi      # 0x302d
xorl %eax, %eax
callq 0x1080
pushq $0x1
jmp 0x1f7f
movq 0x8(%r14), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x10c0
movq %rax, %rbx
callq 0x1050
cmpl $0x0, (%rax)
je 0x1df7
movq (%r14), %rsi
leaq 0x1244(%rip), %rdi      # 0x302d
xorl %eax, %eax
callq 0x1080
pushq $0x2
jmp 0x1f7f
movq %rax, %r15
movq 0x10(%r14), %rdi
pushq $0xa
popq %rdx
xorl %esi, %esi
callq 0x10c0
cmpl $0x0, (%r15)
je 0x1e26
movq (%r14), %rsi
leaq 0x1215(%rip), %rdi      # 0x302d
xorl %eax, %eax
callq 0x1080
pushq $0x3
jmp 0x1f7f
cmpl $0x2bcd, %ebx           # imm = 0x2BCD
je 0x1e50
cmpl $0xadd1, %ebx           # imm = 0xADD1
je 0x1e47
cmpl $0x5aa9, %ebx           # imm = 0x5AA9
jne 0x1eaf
leaq 0xa84b(%rip), %rbx      # 0xc690
jmp 0x1e57
leaq 0x11e42(%rip), %rbx     # 0x13c90
jmp 0x1e57
leaq 0x3239(%rip), %rbx      # 0x5090
testl $0xffffff80, %eax       # imm = 0xFFFFFF80
je 0x1e82
movq (%r14), %rsi
leaq 0x11c5(%rip), %rdi      # 0x302d
xorl %eax, %eax
callq 0x1080
leaq 0x1236(%rip), %rdi      # 0x30ac
callq 0x1060
pushq $0x5
jmp 0x1f7f
andl $0x7f, %eax
imulq $0xec, %rax, %rax
addq %rax, %rbx
leaq 0x8(%rsp), %rdi
pushq $0x1
popq %rdx
movq %rbx, %rsi
callq 0x11ec
testl %eax, %eax
je 0x1ed3
leaq 0x11eb(%rip), %rdi      # 0x3095
jmp 0x1f78
movq (%r14), %rsi
leaq 0x1174(%rip), %rdi      # 0x302d
xorl %eax, %eax
callq 0x1080
leaq 0x1202(%rip), %rdi      # 0x30c9
callq 0x1060
pushq $0x4
jmp 0x1f7f
movq 0x3106(%rip), %rax      # 0x4fe0
movq (%rax), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x18da
leaq 0x114a(%rip), %rdi      # 0x303b
callq 0x1060
movq %r14, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x193c
movq 0xf0(%r14), %rdi
callq 0x1030
leaq 0x11da(%rip), %rdx      # 0x30f0
pushq $0x4
popq %rcx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x131d
testl %eax, %eax
je 0x1f31
leaq 0x1146(%rip), %rdi      # 0x3075
jmp 0x1f78
leaq 0x1109(%rip), %rdi      # 0x3041
callq 0x1060
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x193c
movq 0xf0(%r14), %rdi
callq 0x1030
leaq 0x10c6(%rip), %rdx      # 0x3028
movq %r14, %rdi
movq %rbx, %rsi
callq 0x15f2
testl %eax, %eax
je 0x1f8d
leaq 0x10df(%rip), %rdi      # 0x3057
callq 0x1060
pushq $-0x1
popq %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %r15
retq
leaq 0x10b9(%rip), %rdi      # 0x304d
callq 0x1060
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x193c
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1a3a
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1b39
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1bd9
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1c7d
movq 0xf0(%rbx), %rdi
callq 0x1030
xorl %eax, %eax
jmp 0x1f80