// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/system/backends/posix/timerposix.cpp
// Function: smooth::System::TimerPOSIX::Start(int)
S::Int S::System::TimerPOSIX::Start(Int nInterval)
{
	if (timer != NIL) return Error();

	if (nInterval <= 0) nInterval = 1;

	timer = new timer_t;

	/* Set handler function.
	 */
	struct sigaction	 sa;

	memset(&sa, 0, sizeof(sa));

	sa.sa_sigaction = TimerProc;
	sa.sa_flags	= SA_SIGINFO;

	sigaction(SIGALRM, &sa, NIL);

	/* Create timer.
	 */
	struct sigevent		 se;

	memset(&se, 0, sizeof(se));

	se.sigev_notify		 = SIGEV_SIGNAL;
	se.sigev_signo		 = SIGALRM;
	se.sigev_value.sival_int = thisTimer->GetHandle();

	timer_create(CLOCK_REALTIME, &se, timer);

	/* Start timer.
	 */
	struct itimerspec	 ts;

	ts.it_value.tv_sec     = nInterval / 1000;
	ts.it_value.tv_nsec    = nInterval % 1000 * 1000000;
	ts.it_interval.tv_sec  = nInterval / 1000;
	ts.it_interval.tv_nsec = nInterval % 1000 * 1000000;

	timer_settime(*timer, 0, &ts, NIL);

	return Success();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x148(%rbp)
cmpq $0x0, 0x18(%rax)
je 0x13010e
leaq -0x28(%rbp), %rdi
movq %rdi, -0x158(%rbp)
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5a9c0
movq -0x158(%rbp), %rdi
callq 0x59680
movl %eax, -0x14c(%rbp)
jmp 0x1300dd
movl -0x14c(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x5b5b0
jmp 0x130344
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x5b5b0
jmp 0x130350
cmpl $0x0, -0x14(%rbp)
jg 0x13011b
movl $0x1, -0x14(%rbp)
movl $0x8, %edi
callq 0x59820
movq %rax, %rcx
movq -0x148(%rbp), %rax
movq %rcx, 0x18(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, -0x190(%rbp)
movaps %xmm0, -0x50(%rbp)
movaps %xmm0, -0x60(%rbp)
movaps %xmm0, -0x70(%rbp)
movaps %xmm0, -0x80(%rbp)
movaps %xmm0, -0x90(%rbp)
movaps %xmm0, -0xa0(%rbp)
movaps %xmm0, -0xb0(%rbp)
movaps %xmm0, -0xc0(%rbp)
movaps %xmm0, -0xd0(%rbp)
movq $0x0, -0x40(%rbp)
leaq 0x1e1(%rip), %rax       # 0x130360
movq %rax, -0xd0(%rbp)
movl $0x4, -0x48(%rbp)
xorl %eax, %eax
movl %eax, -0x174(%rbp)
movl %eax, %edx
movq %rdx, -0x170(%rbp)
movl $0xe, %edi
leaq -0xd0(%rbp), %rsi
callq 0x5c170
movaps -0x190(%rbp), %xmm0
movq -0x148(%rbp), %rax
movaps %xmm0, -0xe0(%rbp)
movaps %xmm0, -0xf0(%rbp)
movaps %xmm0, -0x100(%rbp)
movaps %xmm0, -0x110(%rbp)
movl $0x0, -0x104(%rbp)
movl $0xe, -0x108(%rbp)
movq 0x10(%rax), %rdi
callq 0x5d050
movl -0x174(%rbp), %edi
movl %eax, %ecx
movq -0x148(%rbp), %rax
movl %ecx, -0x110(%rbp)
movq 0x18(%rax), %rdx
leaq -0x110(%rbp), %rsi
callq 0x5d0f0
movl -0x174(%rbp), %esi
movq -0x170(%rbp), %rcx
movq -0x148(%rbp), %rax
movslq -0x14(%rbp), %rdx
imulq $0x10624dd3, %rdx, %rdx # imm = 0x10624DD3
movq %rdx, %rdi
shrq $0x3f, %rdi
sarq $0x26, %rdx
addl %edi, %edx
movslq %edx, %rdx
movq %rdx, -0x120(%rbp)
movslq -0x14(%rbp), %rdi
movl %edi, %edx
imulq $0x10624dd3, %rdi, %rdi # imm = 0x10624DD3
movq %rdi, %r8
shrq $0x3f, %r8
shrq $0x26, %rdi
addl %r8d, %edi
imull $0x3e8, %edi, %edi      # imm = 0x3E8
subl %edi, %edx
imull $0xf4240, %edx, %edx    # imm = 0xF4240
movslq %edx, %rdx
movq %rdx, -0x118(%rbp)
movslq -0x14(%rbp), %rdx
imulq $0x10624dd3, %rdx, %rdx # imm = 0x10624DD3
movq %rdx, %rdi
shrq $0x3f, %rdi
sarq $0x26, %rdx
addl %edi, %edx
movslq %edx, %rdx
movq %rdx, -0x130(%rbp)
movslq -0x14(%rbp), %rdi
movl %edi, %edx
imulq $0x10624dd3, %rdi, %rdi # imm = 0x10624DD3
movq %rdi, %r8
shrq $0x3f, %r8
shrq $0x26, %rdi
addl %r8d, %edi
imull $0x3e8, %edi, %edi      # imm = 0x3E8
subl %edi, %edx
imull $0xf4240, %edx, %edx    # imm = 0xF4240
movslq %edx, %rdx
movq %rdx, -0x128(%rbp)
movq 0x18(%rax), %rax
movq (%rax), %rdi
leaq -0x130(%rbp), %rdx
callq 0x5c690
leaq -0x140(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0x5ca80
movq -0x168(%rbp), %rdi
callq 0x59680
movl %eax, -0x15c(%rbp)
jmp 0x130313
movl -0x15c(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x5a410
jmp 0x130344
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x5a410
jmp 0x130350
movl -0x4(%rbp), %eax
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x5b6b0
nopl (%rax)