// File: /workspace/github_c_makefile_star2_O0/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:
subq $0xa8, %rsp
movl $0x0, 0xa4(%rsp)
movl %edi, 0xa0(%rsp)
movq %rsi, 0x98(%rsp)
movl $0x1, 0x8c(%rsp)
movq 0x53d(%rip), %rax       # 0x30b0
movq %rax, 0x70(%rsp)
movq 0x539(%rip), %rax       # 0x30b8
movq %rax, 0x78(%rsp)
movl 0x49e(%rip), %eax       # 0x3028
movl %eax, 0x6b(%rsp)
movb 0x498(%rip), %al        # 0x302c
movb %al, 0x6f(%rsp)
cmpl $0x2, 0xa0(%rsp)
jg 0x2bcb
movq 0x98(%rsp), %rax
movq (%rax), %rsi
leaq 0x479(%rip), %rdi       # 0x302d
movb $0x0, %al
callq 0x1060
movl $0x1, 0xa4(%rsp)
jmp 0x2e6a
movq 0x98(%rsp), %rax
movq 0x8(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x1090
movl %eax, 0x94(%rsp)
callq 0x1040
cmpl $0x0, (%rax)
je 0x2c1f
movq 0x98(%rsp), %rax
movq (%rax), %rsi
leaq 0x425(%rip), %rdi       # 0x302d
movb $0x0, %al
callq 0x1060
movl $0x2, 0xa4(%rsp)
jmp 0x2e6a
movq 0x98(%rsp), %rax
movq 0x10(%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x1090
movl %eax, 0x90(%rsp)
callq 0x1040
cmpl $0x0, (%rax)
je 0x2c73
movq 0x98(%rsp), %rax
movq (%rax), %rsi
leaq 0x3d1(%rip), %rdi       # 0x302d
movb $0x0, %al
callq 0x1060
movl $0x3, 0xa4(%rsp)
jmp 0x2e6a
movl 0x94(%rsp), %eax
movl %eax, 0x4(%rsp)
subl $0x2bcd, %eax           # imm = 0x2BCD
je 0x2ca1
jmp 0x2c87
movl 0x4(%rsp), %eax
subl $0x5aa9, %eax           # imm = 0x5AA9
je 0x2caf
jmp 0x2c94
movl 0x4(%rsp), %eax
subl $0xadd1, %eax           # imm = 0xADD1
je 0x2cbd
jmp 0x2ccb
leaq 0x23c8(%rip), %rax      # 0x5070
movq %rax, 0x60(%rsp)
jmp 0x2d02
leaq 0x49ba(%rip), %rax      # 0x7670
movq %rax, 0x60(%rsp)
jmp 0x2d02
leaq 0x6fac(%rip), %rax      # 0x9c70
movq %rax, 0x60(%rsp)
jmp 0x2d02
movq 0x98(%rsp), %rax
movq (%rax), %rsi
leaq 0x350(%rip), %rdi       # 0x302d
movb $0x0, %al
callq 0x1060
leaq 0x350(%rip), %rdi       # 0x303b
movb $0x0, %al
callq 0x1060
movl $0x4, 0xa4(%rsp)
jmp 0x2e6a
cmpl $0x80, 0x90(%rsp)
jge 0x2d19
cmpl $0x0, 0x90(%rsp)
jge 0x2d50
movq 0x98(%rsp), %rax
movq (%rax), %rsi
leaq 0x302(%rip), %rdi       # 0x302d
movb $0x0, %al
callq 0x1060
leaq 0x32d(%rip), %rdi       # 0x3066
movb $0x0, %al
callq 0x1060
movl $0x5, 0xa4(%rsp)
jmp 0x2e6a
movl 0x90(%rsp), %ecx
movq 0x60(%rsp), %rax
movslq %ecx, %rcx
imulq $0x4c, %rcx, %rcx
addq %rcx, %rax
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rsi
movl 0x8c(%rsp), %edx
leaq 0x8(%rsp), %rdi
callq 0x11c0
movq 0x2258(%rip), %rax      # 0x4fe0
movq (%rax), %rsi
leaq 0x8(%rsp), %rdi
callq 0x2470
leaq 0x2e8(%rip), %rdi       # 0x3084
movb $0x0, %al
callq 0x1060
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2860
movq 0x60(%rsp), %rsi
leaq 0x70(%rsp), %rdx
leaq 0x8(%rsp), %rdi
movl $0x4, %ecx
callq 0x1340
leaq 0x2b9(%rip), %rdi       # 0x308b
movb $0x0, %al
callq 0x1060
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2860
movq 0x60(%rsp), %rsi
leaq 0x6b(%rsp), %rdx
leaq 0x8(%rsp), %rdi
callq 0x1be0
leaq 0x295(%rip), %rdi       # 0x3098
movb $0x0, %al
callq 0x1060
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2860
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x28f0
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2990
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2a20
leaq 0x8(%rsp), %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x2ab0
leaq 0x8(%rsp), %rdi
callq 0x2450
movl $0x0, 0xa4(%rsp)
movl 0xa4(%rsp), %eax
addq $0xa8, %rsp
retq
nopl (%rax)