// File: /workspace/github_c_makefile_star2_O0/igaw[P]jitterdebugger/jitterdebugger.c
// Function: start_measuring
static void start_measuring(struct stats *s, struct record_data *rec)
{
	struct sched_param sched;
	pthread_attr_t attr;
	cpu_set_t mask;
	unsigned int i, t;
	int err;

	pthread_attr_init(&attr);

	for (i = 0, t = 0; i < num_threads; i++) {
		CPU_ZERO(&mask);

		/*
		 * Skip unset cores. will not crash as long as
		 * num_threads <= CPU_COUNT(&affinity)
		 */
		while (!CPU_ISSET(t, &affinity))
			t++;

		CPU_SET(t, &mask);

		/* Don't stay on the same core in next loop */
		s[i].affinity = t++;
		s[i].min = UINT64_MAX;
		s[i].hist_size = NSEC_PER_SEC / interval_resolution / 1000;
		s[i].hist = calloc(s[i].hist_size, sizeof(uint64_t));
		if (!s[i].hist)
			err_handler(errno, "calloc()");

		if (rec) {
			s[i].rb = ringbuffer_create(1024 * 1024);
			if (!s[i].rb)
				err_handler(ENOMEM, "ringbuffer_create()");
		}

		err = pthread_attr_setaffinity_np(&attr, sizeof(mask), &mask);
		if (err)
			err_handler(err, "pthread_attr_setaffinity_np()");

		err = pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
		if (err)
			err_handler(err, "pthread_attr_setschedpolicy()");

		sched.sched_priority = priority;
		err = pthread_attr_setschedparam(&attr, &sched);
		if (err)
			err_handler(err, "pthread_attr_setschedparam()");

		err = pthread_attr_setinheritsched(&attr,
						PTHREAD_EXPLICIT_SCHED);
		if (err)
			err_handler(err, "pthread_attr_setinheritsched()");

		err = pthread_create(&s[i].pid, &attr, &worker, &s[i]);
		if (err) {
			if (err == EPERM)
				fprintf(stderr, "No permission to set the "
					"scheduling policy and/or priority\n");
			else if (err == EINVAL)
				fprintf(stderr, "Invalid settings in thread attributes. "
					"Check your affinity mask\n");
			err_handler(err, "pthread_create()");
		}
	}

	pthread_attr_destroy(&attr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x21f0
movl $0x0, -0xd4(%rbp)
movl $0x0, -0xd8(%rbp)
movl -0xd4(%rbp), %eax
cmpl 0x5d14(%rip), %eax      # 0x94a0
jae 0x3bdf
jmp 0x3794
leaq -0xd0(%rbp), %rdi
xorl %esi, %esi
movl $0x80, %edx
callq 0x2180
jmp 0x37a9
movl -0xd8(%rbp), %eax
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
shrq $0x3, %rax
cmpq $0x80, %rax
jae 0x380c
movq -0xe8(%rbp), %rcx
shrq $0x6, %rcx
leaq 0x5c45(%rip), %rax      # 0x9420
movq (%rax,%rcx,8), %rax
movq -0xe8(%rbp), %rcx
andq $0x3f, %rcx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x104(%rbp)
jmp 0x3816
xorl %eax, %eax
movl %eax, -0x104(%rbp)
jmp 0x3816
movl -0x104(%rbp), %eax
movl %eax, -0xec(%rbp)
cmpl $0x0, -0xec(%rbp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3834
jmp 0x3848
movl -0xd8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd8(%rbp)
jmp 0x37a9
movl -0xd8(%rbp), %eax
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
shrq $0x3, %rax
cmpq $0x80, %rax
jae 0x389f
movq -0xf8(%rbp), %rcx
andq $0x3f, %rcx
movl $0x1, %eax
shlq %cl, %rax
movq -0xf8(%rbp), %rcx
shrq $0x6, %rcx
orq -0xd0(%rbp,%rcx,8), %rax
movq %rax, -0xd0(%rbp,%rcx,8)
movq %rax, -0x110(%rbp)
jmp 0x38aa
xorl %eax, %eax
movq %rax, -0x110(%rbp)
jmp 0x38aa
movq -0x110(%rbp), %rax
movq %rax, -0x100(%rbp)
movl -0xd8(%rbp), %ecx
movl %ecx, %eax
addl $0x1, %eax
movl %eax, -0xd8(%rbp)
movq -0x8(%rbp), %rax
movl -0xd4(%rbp), %edx
imulq $0x50, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
movq -0x8(%rbp), %rax
movl -0xd4(%rbp), %ecx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movq $-0x1, 0x18(%rax)
movl $0x3b9aca00, %eax       # imm = 0x3B9ACA00
xorl %edx, %edx
divl 0x5afd(%rip)            # 0x9400
movl $0x3e8, %ecx            # imm = 0x3E8
xorl %edx, %edx
divl %ecx
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl -0xd4(%rbp), %edx
imulq $0x50, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x28(%rax)
movq -0x8(%rbp), %rax
movl -0xd4(%rbp), %ecx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movl 0x28(%rax), %eax
movl %eax, %edi
movl $0x8, %esi
callq 0x2200
movq %rax, %rcx
movq -0x8(%rbp), %rax
movl -0xd4(%rbp), %edx
imulq $0x50, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x30(%rax)
movq -0x8(%rbp), %rax
movl -0xd4(%rbp), %ecx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x30(%rax)
jne 0x3999
jmp 0x3974
callq 0x2060
movl (%rax), %edi
leaq 0x2c1f(%rip), %rsi      # 0x65a1
leaq 0x2a57(%rip), %rdx      # 0x63e0
leaq 0x3285(%rip), %rcx      # 0x6c15
movb $0x0, %al
callq 0x4d50
jmp 0x3999
cmpq $0x0, -0x10(%rbp)
je 0x3a01
movl $0x100000, %edi         # imm = 0x100000
callq 0x4a60
movq %rax, %rcx
movq -0x8(%rbp), %rax
movl -0xd4(%rbp), %edx
imulq $0x50, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x48(%rax)
movq -0x8(%rbp), %rax
movl -0xd4(%rbp), %ecx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x48(%rax)
jne 0x39ff
jmp 0x39dc
movl $0xc, %edi
leaq 0x323d(%rip), %rsi      # 0x6c25
leaq 0x29f1(%rip), %rdx      # 0x63e0
leaq 0x321f(%rip), %rcx      # 0x6c15
movb $0x0, %al
callq 0x4d50
jmp 0x39ff
jmp 0x3a01
leaq -0x50(%rbp), %rdi
movl $0x80, %esi
leaq -0xd0(%rbp), %rdx
callq 0x2050
movl %eax, -0xdc(%rbp)
cmpl $0x0, -0xdc(%rbp)
je 0x3a4b
jmp 0x3a27
movl -0xdc(%rbp), %edi
leaq 0x320e(%rip), %rsi      # 0x6c42
leaq 0x29a5(%rip), %rdx      # 0x63e0
leaq 0x31d3(%rip), %rcx      # 0x6c15
movb $0x0, %al
callq 0x4d50
jmp 0x3a4b
leaq -0x50(%rbp), %rdi
movl $0x1, %esi
callq 0x2170
movl %eax, -0xdc(%rbp)
cmpl $0x0, -0xdc(%rbp)
je 0x3a8e
jmp 0x3a6a
movl -0xdc(%rbp), %edi
leaq 0x31f2(%rip), %rsi      # 0x6c69
leaq 0x2962(%rip), %rdx      # 0x63e0
leaq 0x3190(%rip), %rcx      # 0x6c15
movb $0x0, %al
callq 0x4d50
jmp 0x3a8e
movl 0x595c(%rip), %eax      # 0x93f0
movl %eax, -0x14(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x14(%rbp), %rsi
callq 0x2380
movl %eax, -0xdc(%rbp)
cmpl $0x0, -0xdc(%rbp)
je 0x3ad9
jmp 0x3ab5
movl -0xdc(%rbp), %edi
leaq 0x31ce(%rip), %rsi      # 0x6c90
leaq 0x2917(%rip), %rdx      # 0x63e0
leaq 0x3145(%rip), %rcx      # 0x6c15
movb $0x0, %al
callq 0x4d50
jmp 0x3ad9
leaq -0x50(%rbp), %rdi
movl $0x1, %esi
callq 0x2090
movl %eax, -0xdc(%rbp)
cmpl $0x0, -0xdc(%rbp)
je 0x3b1c
jmp 0x3af8
movl -0xdc(%rbp), %edi
leaq 0x31b1(%rip), %rsi      # 0x6cb6
leaq 0x28d4(%rip), %rdx      # 0x63e0
leaq 0x3102(%rip), %rcx      # 0x6c15
movb $0x0, %al
callq 0x4d50
jmp 0x3b1c
movq -0x8(%rbp), %rdi
movl -0xd4(%rbp), %eax
imulq $0x50, %rax, %rax
addq %rax, %rdi
movq -0x8(%rbp), %rcx
movl -0xd4(%rbp), %eax
imulq $0x50, %rax, %rax
addq %rax, %rcx
leaq -0x50(%rbp), %rsi
leaq 0x627(%rip), %rdx       # 0x4170
callq 0x22f0
movl %eax, -0xdc(%rbp)
cmpl $0x0, -0xdc(%rbp)
je 0x3bc9
cmpl $0x1, -0xdc(%rbp)
jne 0x3b80
movq 0x548b(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
leaq 0x3167(%rip), %rsi      # 0x6cde
movb $0x0, %al
callq 0x2220
jmp 0x3ba3
cmpl $0x16, -0xdc(%rbp)
jne 0x3ba1
movq 0x5468(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
leaq 0x3180(%rip), %rsi      # 0x6d1a
movb $0x0, %al
callq 0x2220
jmp 0x3ba3
jmp 0x3ba5
movl -0xdc(%rbp), %edi
leaq 0x2a23(%rip), %rsi      # 0x65d5
leaq 0x2827(%rip), %rdx      # 0x63e0
leaq 0x3055(%rip), %rcx      # 0x6c15
movb $0x0, %al
callq 0x4d50
jmp 0x3bc9
jmp 0x3bcb
movl -0xd4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd4(%rbp)
jmp 0x3780
leaq -0x50(%rbp), %rdi
callq 0x2370
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopw %cs:(%rax,%rax)