// File: /workspace/github_c_makefile_star2_O3/MersenneTwister-Lab[P]MTGP/mtgp32-ref.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_ref_t *params;
    mtgp32_ref_t mtgp32;
    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_ref_11213;
	break;
    case 23209:
	params = mtgp32_params_ref_23209;
	break;
    case 44497:
	params = mtgp32_params_ref_44497;
	break;
    default:
	printf("%s: mexp no.\n", argv[0]);
	printf("mexp should be 11213, 23209 or 44497 only\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;
    mtgp32_init(&mtgp32, params, seed);
    mtgp32_print_idstring(&mtgp32, stdout);
    printf("init:\n");
    print_uint32(&mtgp32, 1000);
    mtgp32_init_by_array(&mtgp32, params, seed_ar, 4);
    printf("init_array:\n");
    print_uint32(&mtgp32, 1000);
    mtgp32_init_by_str(&mtgp32, params, seed_str);
    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 $0x60, %rsp
movq %rsi, %rbx
cmpl $0x2, %edi
jg 0x1dd9
movq (%rbx), %rsi
leaq 0x265(%rip), %rdi       # 0x202d
xorl %eax, %eax
callq 0x1080
movl $0x1, %eax
jmp 0x1fb3
movq 0x8(%rbx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x10c0
movq %rax, %r14
callq 0x1050
cmpl $0x0, (%rax)
je 0x1e11
movq (%rbx), %rsi
leaq 0x22d(%rip), %rdi       # 0x202d
xorl %eax, %eax
callq 0x1080
movl $0x2, %eax
jmp 0x1fb3
movq %rax, %r15
movq 0x10(%rbx), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x10c0
cmpl $0x0, (%r15)
je 0x1e45
movq (%rbx), %rsi
leaq 0x1f9(%rip), %rdi       # 0x202d
xorl %eax, %eax
callq 0x1080
movl $0x3, %eax
jmp 0x1fb3
cmpl $0x2bcd, %r14d          # imm = 0x2BCD
je 0x1e76
cmpl $0xadd1, %r14d          # imm = 0xADD1
je 0x1e6d
cmpl $0x5aa9, %r14d          # imm = 0x5AA9
jne 0x1f91
leaq 0x4815(%rip), %r14      # 0x6680
jmp 0x1e7d
leaq 0x6e0c(%rip), %r14      # 0x8c80
jmp 0x1e7d
leaq 0x2203(%rip), %r14      # 0x4080
testl $0xffffff80, %eax       # imm = 0xFFFFFF80
je 0x1eab
movq (%rbx), %rsi
leaq 0x19f(%rip), %rdi       # 0x202d
xorl %eax, %eax
callq 0x1080
leaq 0x1bb(%rip), %rdi       # 0x2057
callq 0x1060
movl $0x5, %eax
jmp 0x1fb3
andl $0x7f, %eax
imulq $0x4c, %rax, %rax
addq %rax, %r14
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x11dc
movq 0x210f(%rip), %rax      # 0x3fe0
movq (%rax), %rsi
movq %rbx, %rdi
callq 0x18da
leaq 0x158(%rip), %rdi       # 0x203b
callq 0x1060
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1a6f
leaq 0x1a4(%rip), %rdx       # 0x20a0
movq %rbx, %rdi
movq %r14, %rsi
movl $0x4, %ecx
callq 0x12ca
leaq 0x12e(%rip), %rdi       # 0x2041
callq 0x1060
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1a6f
leaq 0xfc(%rip), %rdx        # 0x2028
movq %rbx, %rdi
movq %r14, %rsi
callq 0x15c2
leaq 0x10f(%rip), %rdi       # 0x204d
callq 0x1060
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1a6f
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1b02
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1bab
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1c54
movq %rbx, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1d04
movq 0x50(%rbx), %rdi
callq 0x1030
xorl %eax, %eax
jmp 0x1fb3
movq (%rbx), %rsi
leaq 0x92(%rip), %rdi        # 0x202d
xorl %eax, %eax
callq 0x1080
leaq 0xcb(%rip), %rdi        # 0x2074
callq 0x1060
movl $0x4, %eax
addq $0x60, %rsp
popq %rbx
popq %r14
popq %r15
retq
nopl (%rax)