#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct sn_context {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ sn_send_asoc_msg(struct sn_context *, int, int, int);
int sn_do_prio_sched_tests_y(struct sn_context *snc) {
  int stream, count, repeat;
  for (repeat = 0; repeat < 10000; repeat++)
    for (stream = 0; stream < 10; stream++)
      for (count = 0; count < 5; count++) {
        sn_send_asoc_msg(snc, 1024, stream, 0);
        sn_send_asoc_msg(snc, 1024, stream, 1);
      }
  sleep(10);
}


x86 assembly (clang, -O0):
<sn_do_prio_sched_tests_y>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2710,-0x1c(%rbp)
jge    11bf <sn_do_prio_sched_tests_y+0x9f>
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    11ac <sn_do_prio_sched_tests_y+0x8c>
movl   $0x0,-0x18(%rbp)
cmpl   $0x5,-0x18(%rbp)
jge    1199 <sn_do_prio_sched_tests_y+0x79>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    $0x400,%esi
xor    %ecx,%ecx
call   1030 <sn_send_asoc_msg@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    $0x400,%esi
mov    $0x1,%ecx
call   1030 <sn_send_asoc_msg@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1158 <sn_do_prio_sched_tests_y+0x38>
jmp    119e <sn_do_prio_sched_tests_y+0x7e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <sn_do_prio_sched_tests_y+0x27>
jmp    11b1 <sn_do_prio_sched_tests_y+0x91>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1133 <sn_do_prio_sched_tests_y+0x13>
mov    $0xa,%edi
call   1040 <sleep@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sn_do_prio_sched_tests_y>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1030 <sn_send_asoc_msg@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %ebp,%edx
mov    $0x1,%ecx
call   1030 <sn_send_asoc_msg@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1030 <sn_send_asoc_msg@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %ebp,%edx
mov    $0x1,%ecx
call   1030 <sn_send_asoc_msg@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1030 <sn_send_asoc_msg@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %ebp,%edx
mov    $0x1,%ecx
call   1030 <sn_send_asoc_msg@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1030 <sn_send_asoc_msg@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %ebp,%edx
mov    $0x1,%ecx
call   1030 <sn_send_asoc_msg@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1030 <sn_send_asoc_msg@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %ebp,%edx
mov    $0x1,%ecx
call   1030 <sn_send_asoc_msg@plt>
add    $0x1,%ebp
cmp    $0xa,%ebp
jne    1140 <sn_do_prio_sched_tests_y+0x20>
add    $0x1,%r14d
cmp    $0x2710,%r14d
jne    1130 <sn_do_prio_sched_tests_y+0x10>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <sleep@plt>

LLVM IR (-O0):
%struct.sn_context = type { i32 }
define i32 @sn_do_prio_sched_tests_y(%struct.sn_context* %0) {
%2 = alloca i32
%3 = alloca %struct.sn_context*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store %struct.sn_context* %0, %struct.sn_context** %3
store i32 0, i32* %6
br label %7
7: ; preds = %33, %1
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 10000
br i1 %9, label %10, label %36
10: ; preds = %7
store i32 0, i32* %4
br label %11
11: ; preds = %29, %10
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 10
br i1 %13, label %14, label %32
14: ; preds = %11
store i32 0, i32* %5
br label %15
15: ; preds = %25, %14
%16 = load i32, i32* %5
%17 = icmp slt i32 %16, 5
br i1 %17, label %18, label %28
18: ; preds = %15
%19 = load %struct.sn_context*, %struct.sn_context** %3
%20 = load i32, i32* %4
%21 = call i32 @sn_send_asoc_msg(%struct.sn_context* %19, i32 1024, i32 %20, i32 0)
%22 = load %struct.sn_context*, %struct.sn_context** %3
%23 = load i32, i32* %4
%24 = call i32 @sn_send_asoc_msg(%struct.sn_context* %22, i32 1024, i32 %23, i32 1)
br label %25
25: ; preds = %18
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %15
28: ; preds = %15
br label %29
29: ; preds = %28
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %11
32: ; preds = %11
br label %33
33: ; preds = %32
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
store i32 %35, i32* %6
br label %7
36: ; preds = %7
%37 = call i32 @sleep(i32 10)
%38 = load i32, i32* %2
ret i32 %38
}

LLVM IR (-O2):
%struct.sn_context = type { i32 }
define i32 @sn_do_prio_sched_tests_y(%struct.sn_context* %0) {
br label %2
2: ; preds = %1, %18
%3 = phi i32 [ 0, %1 ], [ %19, %18 ]
br label %4
4: ; preds = %2, %4
%5 = phi i32 [ 0, %2 ], [ %16, %4 ]
%6 = tail call i32 @sn_send_asoc_msg(%struct.sn_context* %0, i32 1024, i32 %5, i32 0)
%7 = tail call i32 @sn_send_asoc_msg(%struct.sn_context* %0, i32 1024, i32 %5, i32 1)
%8 = tail call i32 @sn_send_asoc_msg(%struct.sn_context* %0, i32 1024, i32 %5, i32 0)
%9 = tail call i32 @sn_send_asoc_msg(%struct.sn_context* %0, i32 1024, i32 %5, i32 1)
%10 = tail call i32 @sn_send_asoc_msg(%struct.sn_context* %0, i32 1024, i32 %5, i32 0)
%11 = tail call i32 @sn_send_asoc_msg(%struct.sn_context* %0, i32 1024, i32 %5, i32 1)
%12 = tail call i32 @sn_send_asoc_msg(%struct.sn_context* %0, i32 1024, i32 %5, i32 0)
%13 = tail call i32 @sn_send_asoc_msg(%struct.sn_context* %0, i32 1024, i32 %5, i32 1)
%14 = tail call i32 @sn_send_asoc_msg(%struct.sn_context* %0, i32 1024, i32 %5, i32 0)
%15 = tail call i32 @sn_send_asoc_msg(%struct.sn_context* %0, i32 1024, i32 %5, i32 1)
%16 = add nuw nsw i32 %5, 1
%17 = icmp eq i32 %16, 10
br i1 %17, label %18, label %4
18: ; preds = %4
%19 = add nuw nsw i32 %3, 1
%20 = icmp eq i32 %19, 10000
br i1 %20, label %21, label %2
21: ; preds = %18
%22 = tail call i32 @sleep(i32 10)
ret i32 undef
}