#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 rand();
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ sn_send_asoc_msg(struct sn_context *, int, int,
                                    int /*<<< orphan*/);
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int sn_do_prio_fuzz_sched_tests(struct sn_context *snc) {
  int stream, count, repeat;
  srand((unsigned int)time(NULL));
  for (repeat = 0; repeat < 10000; repeat++) {
    for (stream = 0; stream < 10; stream++) {
      for (count = 0; count < 10; count++) {
        int msg_len = rand() % 1500 + 20;
        sn_send_asoc_msg(snc, msg_len, stream, 0);
      }
    }
  }
  sleep(10);
}


x86 assembly (clang, -O0):
<sn_do_prio_fuzz_sched_tests>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2710,-0x1c(%rbp)
jge    11fc <sn_do_prio_fuzz_sched_tests+0xac>
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    11e9 <sn_do_prio_fuzz_sched_tests+0x99>
movl   $0x0,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jge    11d6 <sn_do_prio_fuzz_sched_tests+0x86>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x5dc,%ecx
cltd
idiv   %ecx
add    $0x14,%edx
mov    %edx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
call   1050 <sn_send_asoc_msg@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1198 <sn_do_prio_fuzz_sched_tests+0x48>
jmp    11db <sn_do_prio_fuzz_sched_tests+0x8b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1187 <sn_do_prio_fuzz_sched_tests+0x37>
jmp    11ee <sn_do_prio_fuzz_sched_tests+0x9e>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1173 <sn_do_prio_fuzz_sched_tests+0x23>
mov    $0xa,%edi
call   1060 <sleep@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sn_do_prio_fuzz_sched_tests>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %r14d,%r14d
nopl   0x0(%rax,%rax,1)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x57619f1,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x5dc,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x14,%esi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1050 <sn_send_asoc_msg@plt>
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x57619f1,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x5dc,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x14,%esi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1050 <sn_send_asoc_msg@plt>
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x57619f1,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x5dc,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x14,%esi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1050 <sn_send_asoc_msg@plt>
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x57619f1,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x5dc,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x14,%esi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1050 <sn_send_asoc_msg@plt>
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x57619f1,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x5dc,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x14,%esi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1050 <sn_send_asoc_msg@plt>
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x57619f1,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x5dc,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x14,%esi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1050 <sn_send_asoc_msg@plt>
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x57619f1,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x5dc,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x14,%esi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1050 <sn_send_asoc_msg@plt>
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x57619f1,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x5dc,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x14,%esi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1050 <sn_send_asoc_msg@plt>
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x57619f1,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x5dc,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x14,%esi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1050 <sn_send_asoc_msg@plt>
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x57619f1,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x5dc,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x14,%esi
mov    %rbx,%rdi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1050 <sn_send_asoc_msg@plt>
add    $0x1,%ebp
cmp    $0xa,%ebp
jne    1180 <sn_do_prio_fuzz_sched_tests+0x30>
add    $0x1,%r14d
cmp    $0x2710,%r14d
jne    1170 <sn_do_prio_fuzz_sched_tests+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <sleep@plt>

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

LLVM IR (-O2):
%struct.sn_context = type { i32 }
define i32 @sn_do_prio_fuzz_sched_tests(%struct.sn_context* %0) {
%2 = tail call i64 @time(i32* null)
%3 = trunc i64 %2 to i32
%4 = tail call i32 @srand(i32 %3)
br label %5
5: ; preds = %1, %51
%6 = phi i32 [ 0, %1 ], [ %52, %51 ]
br label %7
7: ; preds = %5, %7
%8 = phi i32 [ 0, %5 ], [ %49, %7 ]
%9 = tail call i32 (...) @rand()
%10 = srem i32 %9, 1500
%11 = add nsw i32 %10, 20
%12 = tail call i32 @sn_send_asoc_msg(%struct.sn_context* %0, i32 %11, i32 %8, i32 0)
%13 = tail call i32 (...) @rand()
%14 = srem i32 %13, 1500
%15 = add nsw i32 %14, 20
%16 = tail call i32 @sn_send_asoc_msg(%struct.sn_context* %0, i32 %15, i32 %8, i32 0)
%17 = tail call i32 (...) @rand()
%18 = srem i32 %17, 1500
%19 = add nsw i32 %18, 20
%20 = tail call i32 @sn_send_asoc_msg(%struct.sn_context* %0, i32 %19, i32 %8, i32 0)
%21 = tail call i32 (...) @rand()
%22 = srem i32 %21, 1500
%23 = add nsw i32 %22, 20
%24 = tail call i32 @sn_send_asoc_msg(%struct.sn_context* %0, i32 %23, i32 %8, i32 0)
%25 = tail call i32 (...) @rand()
%26 = srem i32 %25, 1500
%27 = add nsw i32 %26, 20
%28 = tail call i32 @sn_send_asoc_msg(%struct.sn_context* %0, i32 %27, i32 %8, i32 0)
%29 = tail call i32 (...) @rand()
%30 = srem i32 %29, 1500
%31 = add nsw i32 %30, 20
%32 = tail call i32 @sn_send_asoc_msg(%struct.sn_context* %0, i32 %31, i32 %8, i32 0)
%33 = tail call i32 (...) @rand()
%34 = srem i32 %33, 1500
%35 = add nsw i32 %34, 20
%36 = tail call i32 @sn_send_asoc_msg(%struct.sn_context* %0, i32 %35, i32 %8, i32 0)
%37 = tail call i32 (...) @rand()
%38 = srem i32 %37, 1500
%39 = add nsw i32 %38, 20
%40 = tail call i32 @sn_send_asoc_msg(%struct.sn_context* %0, i32 %39, i32 %8, i32 0)
%41 = tail call i32 (...) @rand()
%42 = srem i32 %41, 1500
%43 = add nsw i32 %42, 20
%44 = tail call i32 @sn_send_asoc_msg(%struct.sn_context* %0, i32 %43, i32 %8, i32 0)
%45 = tail call i32 (...) @rand()
%46 = srem i32 %45, 1500
%47 = add nsw i32 %46, 20
%48 = tail call i32 @sn_send_asoc_msg(%struct.sn_context* %0, i32 %47, i32 %8, i32 0)
%49 = add nuw nsw i32 %8, 1
%50 = icmp eq i32 %49, 10
br i1 %50, label %51, label %7
51: ; preds = %7
%52 = add nuw nsw i32 %6, 1
%53 = icmp eq i32 %52, 10000
br i1 %53, label %54, label %5
54: ; preds = %51
%55 = tail call i32 @sleep(i32 10)
ret i32 undef
}