// File: /workspace/github_c_makefile_star2_O0/dpw[P]skinny-mutex/perf.c
// Function: contention
static void contention(struct test_results *res)
{
	struct contention_info info;
	struct contention_thread_info thread_infos[CONTENTION_THREAD_COUNT];
	pthread_t threads[CONTENTION_THREAD_COUNT];
	int i;

	for (i = 0; i < CONTENTION_MUTEX_COUNT; i++)
		assert(!mutex_init(&info.mutexes[i]));

	assert(!pthread_mutex_init(&info.ready_mutex, NULL));
	assert(!pthread_cond_init(&info.ready_cond, NULL));
	info.ready_count = 0;
	info.thread_reps = res->reps / CONTENTION_THREAD_COUNT;

	for (i = 0; i < CONTENTION_THREAD_COUNT; i++) {
		thread_infos[i].info = &info;
		thread_infos[i].thread_index = i;
		assert(!pthread_mutex_init(&thread_infos[i].start_mutex, NULL));
		assert(!pthread_mutex_lock(&thread_infos[i].start_mutex));
		assert(!pthread_create(&threads[i], NULL,
				       contention_thread, &thread_infos[i]));
	}

	assert(!pthread_mutex_lock(&info.ready_mutex));
	while (info.ready_count < CONTENTION_THREAD_COUNT)
		assert(!pthread_cond_wait(&info.ready_cond,
					  &info.ready_mutex));
	assert(!pthread_mutex_unlock(&info.ready_mutex));

	for (i = 0; i < CONTENTION_THREAD_COUNT; i++)
		assert(!pthread_mutex_unlock(&thread_infos[i].start_mutex));

	for (i = 0; i < CONTENTION_THREAD_COUNT; i++) {
		assert(!pthread_join(threads[i], NULL));
		assert(!pthread_mutex_destroy(&thread_infos[i].start_mutex));
	}

	for (i = 0; i < CONTENTION_MUTEX_COUNT; i++)
		assert(!mutex_destroy(&info.mutexes[i]));

	assert(!pthread_mutex_destroy(&info.ready_mutex));
	assert(!pthread_cond_destroy(&info.ready_cond));

	res->start = thread_infos[0].start;
	res->stop = thread_infos[0].stop;
	for (i = 1; i < CONTENTION_THREAD_COUNT; i++) {
		if (thread_infos[i].start < res->start)
			res->start = thread_infos[i].start;
		if (thread_infos[i].stop > res->stop)
			res->stop = thread_infos[i].stop;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1e0, %rsp            # imm = 0x1E0
movq %rdi, -0x8(%rbp)
movl $0x0, -0x1d4(%rbp)
cmpl $0x5, -0x1d4(%rbp)
jge 0x2095
leaq -0x90(%rbp), %rdi
movslq -0x1d4(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x2660
cmpl $0x0, %eax
jne 0x2063
jmp 0x2082
leaq 0x11f8(%rip), %rdi      # 0x3262
leaq 0x114e(%rip), %rsi      # 0x31bf
movl $0xb5, %edx
leaq 0x1203(%rip), %rcx      # 0x3280
callq 0x10c0
jmp 0x2084
movl -0x1d4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d4(%rbp)
jmp 0x2039
leaq -0x90(%rbp), %rdi
addq $0x28, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x11a0
cmpl $0x0, %eax
jne 0x20b0
jmp 0x20cf
leaq 0x11f0(%rip), %rdi      # 0x32a7
leaq 0x1101(%rip), %rsi      # 0x31bf
movl $0xb7, %edx
leaq 0x11b6(%rip), %rcx      # 0x3280
callq 0x10c0
leaq -0x90(%rbp), %rdi
addq $0x50, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x10f0
cmpl $0x0, %eax
jne 0x20ea
jmp 0x2109
leaq 0x11e3(%rip), %rdi      # 0x32d4
leaq 0x10c7(%rip), %rsi      # 0x31bf
movl $0xb8, %edx
leaq 0x117c(%rip), %rcx      # 0x3280
callq 0x10c0
movl $0x0, -0x10(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl $0x4, %ecx
cltd
idivl %ecx
movl %eax, -0xc(%rbp)
movl $0x0, -0x1d4(%rbp)
cmpl $0x4, -0x1d4(%rbp)
jge 0x2277
movslq -0x1d4(%rbp), %rcx
leaq -0x1b0(%rbp), %rax
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
leaq -0x90(%rbp), %rcx
movq %rcx, (%rax)
movl -0x1d4(%rbp), %ecx
movslq -0x1d4(%rbp), %rdx
leaq -0x1b0(%rbp), %rax
imulq $0x48, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x30(%rax)
movslq -0x1d4(%rbp), %rax
leaq -0x1b0(%rbp), %rdi
imulq $0x48, %rax, %rax
addq %rax, %rdi
addq $0x8, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x11a0
cmpl $0x0, %eax
jne 0x219e
jmp 0x21bd
leaq 0x115a(%rip), %rdi      # 0x32ff
leaq 0x1013(%rip), %rsi      # 0x31bf
movl $0xbf, %edx
leaq 0x10c8(%rip), %rcx      # 0x3280
callq 0x10c0
movslq -0x1d4(%rbp), %rax
leaq -0x1b0(%rbp), %rdi
imulq $0x48, %rax, %rax
addq %rax, %rdi
addq $0x8, %rdi
callq 0x11b0
cmpl $0x0, %eax
jne 0x21e2
jmp 0x2201
leaq 0x114e(%rip), %rdi      # 0x3337
leaq 0xfcf(%rip), %rsi       # 0x31bf
movl $0xc0, %edx
leaq 0x1084(%rip), %rcx      # 0x3280
callq 0x10c0
movslq -0x1d4(%rbp), %rax
leaq -0x1d0(%rbp), %rdi
shlq $0x3, %rax
addq %rax, %rdi
movslq -0x1d4(%rbp), %rax
leaq -0x1b0(%rbp), %rcx
imulq $0x48, %rax, %rax
addq %rax, %rcx
xorl %eax, %eax
movl %eax, %esi
leaq 0x56a(%rip), %rdx       # 0x27a0
callq 0x1140
cmpl $0x0, %eax
jne 0x2242
jmp 0x2261
leaq 0x1120(%rip), %rdi      # 0x3369
leaq 0xf6f(%rip), %rsi       # 0x31bf
movl $0xc2, %edx
leaq 0x1024(%rip), %rcx      # 0x3280
callq 0x10c0
jmp 0x2263
movl -0x1d4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d4(%rbp)
jmp 0x212b
leaq -0x90(%rbp), %rdi
addq $0x28, %rdi
callq 0x11b0
cmpl $0x0, %eax
jne 0x228e
jmp 0x22ad
leaq 0x111c(%rip), %rdi      # 0x33b1
leaq 0xf23(%rip), %rsi       # 0x31bf
movl $0xc5, %edx
leaq 0xfd8(%rip), %rcx       # 0x3280
callq 0x10c0
jmp 0x22af
cmpl $0x4, -0x10(%rbp)
jge 0x22f8
leaq -0x90(%rbp), %rdi
addq $0x50, %rdi
leaq -0x90(%rbp), %rsi
addq $0x28, %rsi
callq 0x1060
cmpl $0x0, %eax
jne 0x22d7
jmp 0x22f6
leaq 0x10fa(%rip), %rdi      # 0x33d8
leaq 0xeda(%rip), %rsi       # 0x31bf
movl $0xc8, %edx
leaq 0xf8f(%rip), %rcx       # 0x3280
callq 0x10c0
jmp 0x22af
leaq -0x90(%rbp), %rdi
addq $0x28, %rdi
callq 0x1100
cmpl $0x0, %eax
jne 0x230f
jmp 0x232e
leaq 0x10fa(%rip), %rdi      # 0x3410
leaq 0xea2(%rip), %rsi       # 0x31bf
movl $0xc9, %edx
leaq 0xf57(%rip), %rcx       # 0x3280
callq 0x10c0
movl $0x0, -0x1d4(%rbp)
cmpl $0x4, -0x1d4(%rbp)
jge 0x2398
movslq -0x1d4(%rbp), %rax
leaq -0x1b0(%rbp), %rdi
imulq $0x48, %rax, %rax
addq %rax, %rdi
addq $0x8, %rdi
callq 0x1100
cmpl $0x0, %eax
jne 0x2366
jmp 0x2385
leaq 0x10cc(%rip), %rdi      # 0x3439
leaq 0xe4b(%rip), %rsi       # 0x31bf
movl $0xcc, %edx
leaq 0xf00(%rip), %rcx       # 0x3280
callq 0x10c0
jmp 0x2387
movl -0x1d4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d4(%rbp)
jmp 0x2338
movl $0x0, -0x1d4(%rbp)
cmpl $0x4, -0x1d4(%rbp)
jge 0x2447
movslq -0x1d4(%rbp), %rax
movq -0x1d0(%rbp,%rax,8), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1180
cmpl $0x0, %eax
jne 0x23ce
jmp 0x23ed
leaq 0x1098(%rip), %rdi      # 0x346d
leaq 0xde3(%rip), %rsi       # 0x31bf
movl $0xcf, %edx
leaq 0xe98(%rip), %rcx       # 0x3280
callq 0x10c0
movslq -0x1d4(%rbp), %rax
leaq -0x1b0(%rbp), %rdi
imulq $0x48, %rax, %rax
addq %rax, %rdi
addq $0x8, %rdi
callq 0x1090
cmpl $0x0, %eax
jne 0x2412
jmp 0x2431
leaq 0x1074(%rip), %rdi      # 0x348d
leaq 0xd9f(%rip), %rsi       # 0x31bf
movl $0xd0, %edx
leaq 0xe54(%rip), %rcx       # 0x3280
callq 0x10c0
jmp 0x2433
movl -0x1d4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d4(%rbp)
jmp 0x23a2
movl $0x0, -0x1d4(%rbp)
cmpl $0x5, -0x1d4(%rbp)
jge 0x24ad
leaq -0x90(%rbp), %rdi
movslq -0x1d4(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x2770
cmpl $0x0, %eax
jne 0x247b
jmp 0x249a
leaq 0x1040(%rip), %rdi      # 0x34c2
leaq 0xd36(%rip), %rsi       # 0x31bf
movl $0xd4, %edx
leaq 0xdeb(%rip), %rcx       # 0x3280
callq 0x10c0
jmp 0x249c
movl -0x1d4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d4(%rbp)
jmp 0x2451
leaq -0x90(%rbp), %rdi
addq $0x28, %rdi
callq 0x1090
cmpl $0x0, %eax
jne 0x24c4
jmp 0x24e3
leaq 0x1018(%rip), %rdi      # 0x34e3
leaq 0xced(%rip), %rsi       # 0x31bf
movl $0xd6, %edx
leaq 0xda2(%rip), %rcx       # 0x3280
callq 0x10c0
leaq -0x90(%rbp), %rdi
addq $0x50, %rdi
callq 0x1160
cmpl $0x0, %eax
jne 0x24fa
jmp 0x2519
leaq 0x100c(%rip), %rdi      # 0x350d
leaq 0xcb7(%rip), %rsi       # 0x31bf
movl $0xd7, %edx
leaq 0xd6c(%rip), %rcx       # 0x3280
callq 0x10c0
movq -0x178(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x170(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x1, -0x1d4(%rbp)
cmpl $0x4, -0x1d4(%rbp)
jge 0x25ec
movslq -0x1d4(%rbp), %rcx
leaq -0x1b0(%rbp), %rax
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x38(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jge 0x2592
movslq -0x1d4(%rbp), %rcx
leaq -0x1b0(%rbp), %rax
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x38(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movslq -0x1d4(%rbp), %rcx
leaq -0x1b0(%rbp), %rax
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x40(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jle 0x25d6
movslq -0x1d4(%rbp), %rcx
leaq -0x1b0(%rbp), %rax
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq 0x40(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x25d8
movl -0x1d4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d4(%rbp)
jmp 0x2541
addq $0x1e0, %rsp            # imm = 0x1E0
popq %rbp
retq
nopw %cs:(%rax,%rax)