// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x148, %rsp            # imm = 0x148
movl $0x0, 0x144(%rsp)
movl %edi, 0x140(%rsp)
movq %rsi, 0x138(%rsp)
movl $0x1, 0x12c(%rsp)
movq 0x14bd(%rip), %rax      # 0x4100
movq %rax, 0x110(%rsp)
movq 0x14b6(%rip), %rax      # 0x4108
movq %rax, 0x118(%rsp)
movl 0x13c8(%rip), %eax      # 0x4028
movl %eax, 0x10b(%rsp)
movb 0x13bf(%rip), %al       # 0x402c
movb %al, 0x10f(%rsp)
cmpl $0x2, 0x140(%rsp)
jg 0x2ca7
movq 0x138(%rsp), %rax
movq (%rax), %rsi
leaq 0x139d(%rip), %rdi      # 0x402d
movb $0x0, %al
callq 0x1060
movl $0x1, 0x144(%rsp)
jmp 0x2ff0
movq 0x138(%rsp), %rax
movq 0x8(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x1090
movl %eax, 0x134(%rsp)
callq 0x1040
cmpl $0x0, (%rax)
je 0x2cfb
movq 0x138(%rsp), %rax
movq (%rax), %rsi
leaq 0x1349(%rip), %rdi      # 0x402d
movb $0x0, %al
callq 0x1060
movl $0x2, 0x144(%rsp)
jmp 0x2ff0
movq 0x138(%rsp), %rax
movq 0x10(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x1090
movl %eax, 0x130(%rsp)
callq 0x1040
cmpl $0x0, (%rax)
je 0x2d4f
movq 0x138(%rsp), %rax
movq (%rax), %rsi
leaq 0x12f5(%rip), %rdi      # 0x402d
movb $0x0, %al
callq 0x1060
movl $0x3, 0x144(%rsp)
jmp 0x2ff0
movl 0x134(%rsp), %eax
movl %eax, (%rsp)
subl $0x2bcd, %eax           # imm = 0x2BCD
je 0x2d7a
jmp 0x2d62
movl (%rsp), %eax
subl $0x5aa9, %eax           # imm = 0x5AA9
je 0x2d8b
jmp 0x2d6e
movl (%rsp), %eax
subl $0xadd1, %eax           # imm = 0xADD1
je 0x2d9c
jmp 0x2dad
leaq 0x32ef(%rip), %rax      # 0x6070
movq %rax, 0x100(%rsp)
jmp 0x2de4
leaq 0xa8de(%rip), %rax      # 0xd670
movq %rax, 0x100(%rsp)
jmp 0x2de4
leaq 0x11ecd(%rip), %rax     # 0x14c70
movq %rax, 0x100(%rsp)
jmp 0x2de4
movq 0x138(%rsp), %rax
movq (%rax), %rsi
leaq 0x126e(%rip), %rdi      # 0x402d
movb $0x0, %al
callq 0x1060
leaq 0x126e(%rip), %rdi      # 0x403b
movb $0x0, %al
callq 0x1060
movl $0x4, 0x144(%rsp)
jmp 0x2ff0
cmpl $0x80, 0x130(%rsp)
jge 0x2dfb
cmpl $0x0, 0x130(%rsp)
jge 0x2e32
movq 0x138(%rsp), %rax
movq (%rax), %rsi
leaq 0x1220(%rip), %rdi      # 0x402d
movb $0x0, %al
callq 0x1060
leaq 0x1247(%rip), %rdi      # 0x4062
movb $0x0, %al
callq 0x1060
movl $0x5, 0x144(%rsp)
jmp 0x2ff0
movl 0x130(%rsp), %ecx
movq 0x100(%rsp), %rax
movslq %ecx, %rcx
imulq $0xec, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x100(%rsp)
movq 0x100(%rsp), %rsi
movl 0x12c(%rsp), %edx
leaq 0x8(%rsp), %rdi
callq 0x11c0
movl %eax, 0x4(%rsp)
cmpl $0x0, 0x4(%rsp)
je 0x2e98
leaq 0x11ff(%rip), %rdi      # 0x4080
movb $0x0, %al
callq 0x1060
movl $0xffffffff, 0x144(%rsp) # imm = 0xFFFFFFFF
jmp 0x2ff0
movq 0x3141(%rip), %rax      # 0x5fe0
movq (%rax), %rsi
leaq 0x8(%rsp), %rdi
callq 0x25d0
leaq 0x11e5(%rip), %rdi      # 0x4098
movb $0x0, %al
callq 0x1060
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2660
leaq 0x8(%rsp), %rdi
callq 0x25b0
movq 0x100(%rsp), %rsi
leaq 0x110(%rsp), %rdx
leaq 0x8(%rsp), %rdi
movl $0x4, %ecx
callq 0x1460
movl %eax, 0x4(%rsp)
cmpl $0x0, 0x4(%rsp)
je 0x2f1b
leaq 0x119b(%rip), %rdi      # 0x409f
movb $0x0, %al
callq 0x1060
movl $0xffffffff, 0x144(%rsp) # imm = 0xFFFFFFFF
jmp 0x2ff0
leaq 0x119e(%rip), %rdi      # 0x40c0
movb $0x0, %al
callq 0x1060
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2660
leaq 0x8(%rsp), %rdi
callq 0x25b0
movq 0x100(%rsp), %rsi
leaq 0x10b(%rsp), %rdx
leaq 0x8(%rsp), %rdi
callq 0x1d20
movl %eax, 0x4(%rsp)
cmpl $0x0, 0x4(%rsp)
je 0x2f82
leaq 0x115f(%rip), %rdi      # 0x40cd
movb $0x0, %al
callq 0x1060
movl $0xffffffff, 0x144(%rsp) # imm = 0xFFFFFFFF
jmp 0x2ff0
leaq 0x1163(%rip), %rdi      # 0x40ec
movb $0x0, %al
callq 0x1060
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2660
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x27c0
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2930
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x29e0
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2a90
leaq 0x8(%rsp), %rdi
callq 0x25b0
movl $0x0, 0x144(%rsp)
movl 0x144(%rsp), %eax
addq $0x148, %rsp            # imm = 0x148
retq
nop