#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 */

/* Variables and functions */
unsigned long getnum(char const *);
int /*<<< orphan*/ op_sync();
int /*<<< orphan*/ prep(unsigned int, unsigned int *, unsigned int,
                        int /*<<< orphan*/, int /*<<< orphan*/ *);
int random();
scalar_t__ randop(unsigned int, unsigned int *, unsigned int,
                  int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ srandom(unsigned long);
void wl_diropseq(const char *seed) {
  unsigned testcode = 357;
  unsigned numfiles = 27;
  unsigned exists[27];
  unsigned ct, numops;
  unsigned long seednum = getnum(seed);
  srandom(seednum);
  prep(testcode, exists, numfiles, 0, NULL);
  op_sync();
  numops = random() % 100 + 100;
  ct = 0;
  while (ct < numops) {
    if (randop(testcode, exists, numfiles, 0, NULL)) {
      ct++;
    }
  }
}


x86 assembly (clang, -O0):
<wl_diropseq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x165,-0xc(%rbp)
movl   $0x1b,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getnum@plt>
mov    %rax,-0x90(%rbp)
mov    -0x90(%rbp),%rdi
call   1050 <srandom@plt>
mov    -0xc(%rbp),%edi
lea    -0x80(%rbp),%rsi
mov    -0x10(%rbp),%edx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1060 <prep@plt>
mov    $0x0,%al
call   1070 <op_sync@plt>
mov    $0x0,%al
call   1080 <random@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
add    $0x64,%edx
mov    %edx,-0x88(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x88(%rbp),%eax
jae    121e <wl_diropseq+0xbe>
mov    -0xc(%rbp),%edi
lea    -0x80(%rbp),%rsi
mov    -0x10(%rbp),%edx
xor    %ecx,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1040 <randop@plt>
cmp    $0x0,%rax
je     1219 <wl_diropseq+0xb9>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    11d8 <wl_diropseq+0x78>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wl_diropseq>:
push   %rbp
push   %r14
push   %rbx
sub    $0x70,%rsp
call   1030 <getnum@plt>
mov    %rax,%rdi
call   1050 <srandom@plt>
xor    %ebx,%ebx
mov    %rsp,%r14
mov    $0x165,%edi
mov    %r14,%rsi
mov    $0x1b,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <prep@plt>
xor    %eax,%eax
call   1070 <op_sync@plt>
xor    %eax,%eax
call   1080 <random@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
neg    %ecx
lea    (%rax,%rcx,1),%ebp
add    $0x64,%ebp
mov    $0x165,%edi
mov    %r14,%rsi
mov    $0x1b,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <randop@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebx
cmp    %ebp,%ebx
jb     11c0 <wl_diropseq+0x60>
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @wl_diropseq(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca [27 x i32]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
store i8* %0, i8** %2
store i32 357, i32* %3
store i32 27, i32* %4
%9 = load i8*, i8** %2
%10 = call i64 @getnum(i8* %9)
store i64 %10, i64* %8
%11 = load i64, i64* %8
%12 = call i32 @srandom(i64 %11)
%13 = load i32, i32* %3
%14 = getelementptr inbounds [27 x i32], [27 x i32]* %5, i64 0, i64 0
%15 = load i32, i32* %4
%16 = call i32 @prep(i32 %13, i32* %14, i32 %15, i32 0, i32* null)
%17 = call i32 (...) @op_sync()
%18 = call i32 (...) @random()
%19 = srem i32 %18, 100
%20 = add nsw i32 %19, 100
store i32 %20, i32* %7
store i32 0, i32* %6
br label %21
21: ; preds = %34, %1
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = icmp ult i32 %22, %23
br i1 %24, label %25, label %35
25: ; preds = %21
%26 = load i32, i32* %3
%27 = getelementptr inbounds [27 x i32], [27 x i32]* %5, i64 0, i64 0
%28 = load i32, i32* %4
%29 = call i64 @randop(i32 %26, i32* %27, i32 %28, i32 0, i32* null)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %25
%32 = load i32, i32* %6
%33 = add i32 %32, 1
store i32 %33, i32* %6
br label %34
34: ; preds = %31, %25
br label %21
35: ; preds = %21
ret void
}

LLVM IR (-O2):
define void @wl_diropseq(i8* %0) {
%2 = alloca [27 x i32]
%3 = bitcast [27 x i32]* %2 to i8*
%4 = tail call i64 @getnum(i8* %0)
%5 = tail call i32 @srandom(i64 %4)
%6 = getelementptr inbounds [27 x i32], [27 x i32]* %2, i64 0, i64 0
%7 = call i32 @prep(i32 357, i32* %6, i32 27, i32 0, i32* null)
%8 = call i32 (...) @op_sync()
%9 = call i32 (...) @random()
%10 = srem i32 %9, 100
%11 = add nsw i32 %10, 100
br label %12
12: ; preds = %1, %12
%13 = phi i32 [ %17, %12 ], [ 0, %1 ]
%14 = call i64 @randop(i32 357, i32* %6, i32 27, i32 0, i32* null)
%15 = icmp ne i64 %14, 0
%16 = zext i1 %15 to i32
%17 = add nuw i32 %13, %16
%18 = icmp ult i32 %17, %11
br i1 %18, label %12, label %19
19: ; preds = %12
ret void
}