#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 */
int rand();
int /*<<< orphan*/ srand(int);
int main() {
  srand(1234);
  int r_five1 = rand() % 5;
  int r_five2 = rand() % 5;
  int r_five3 = rand() % 5;
  int r_five4 = rand() % 5;
  int r_five5 = rand() % 5;
  int r_five6 = rand() % 5;
  int r_five7 = rand() % 5;
  int out =
      (r_five1 + r_five2 + r_five3 + r_five4 + r_five5 + r_five6 + r_five7) % 7;
  if (5 * r_five1 + r_five2 < 21)
    return ((5 * r_five1 + r_five2 < 21) % 7);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4d2,%edi
call   1030 <srand@plt>
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x24(%rbp)
imul   $0x5,-0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    $0x15,%eax
jge    1204 <main+0xe4>
imul   $0x5,-0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    $0x15,%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x4d2,%edi
call   1030 <srand@plt>
xor    %eax,%eax
call   1040 <rand@plt>
movslq %eax,%r14
imul   $0x66666667,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%r14d
xor    %eax,%eax
call   1040 <rand@plt>
movslq %eax,%rbx
imul   $0x66666667,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
xor    %eax,%eax
call   1040 <rand@plt>
xor    %eax,%eax
call   1040 <rand@plt>
xor    %eax,%eax
call   1040 <rand@plt>
xor    %eax,%eax
call   1040 <rand@plt>
xor    %eax,%eax
call   1040 <rand@plt>
lea    (%r14,%r14,4),%ecx
add    %ebx,%ecx
xor    %eax,%eax
cmp    $0x15,%ecx
setl   %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = call i32 @srand(i32 1234)
%11 = call i32 (...) @rand()
%12 = srem i32 %11, 5
store i32 %12, i32* %2
%13 = call i32 (...) @rand()
%14 = srem i32 %13, 5
store i32 %14, i32* %3
%15 = call i32 (...) @rand()
%16 = srem i32 %15, 5
store i32 %16, i32* %4
%17 = call i32 (...) @rand()
%18 = srem i32 %17, 5
store i32 %18, i32* %5
%19 = call i32 (...) @rand()
%20 = srem i32 %19, 5
store i32 %20, i32* %6
%21 = call i32 (...) @rand()
%22 = srem i32 %21, 5
store i32 %22, i32* %7
%23 = call i32 (...) @rand()
%24 = srem i32 %23, 5
store i32 %24, i32* %8
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = add nsw i32 %25, %26
%28 = load i32, i32* %4
%29 = add nsw i32 %27, %28
%30 = load i32, i32* %5
%31 = add nsw i32 %29, %30
%32 = load i32, i32* %6
%33 = add nsw i32 %31, %32
%34 = load i32, i32* %7
%35 = add nsw i32 %33, %34
%36 = load i32, i32* %8
%37 = add nsw i32 %35, %36
%38 = srem i32 %37, 7
store i32 %38, i32* %9
%39 = load i32, i32* %2
%40 = mul nsw i32 5, %39
%41 = load i32, i32* %3
%42 = add nsw i32 %40, %41
%43 = icmp slt i32 %42, 21
br i1 %43, label %44, label %52
44: ; preds = %0
%45 = load i32, i32* %2
%46 = mul nsw i32 5, %45
%47 = load i32, i32* %3
%48 = add nsw i32 %46, %47
%49 = icmp slt i32 %48, 21
%50 = zext i1 %49 to i32
%51 = srem i32 %50, 7
store i32 %51, i32* %1
br label %52
52: ; preds = %44, %0
%53 = load i32, i32* %1
ret i32 %53
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @srand(i32 1234)
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, 5
%4 = tail call i32 (...) @rand()
%5 = srem i32 %4, 5
%6 = tail call i32 (...) @rand()
%7 = tail call i32 (...) @rand()
%8 = tail call i32 (...) @rand()
%9 = tail call i32 (...) @rand()
%10 = tail call i32 (...) @rand()
%11 = mul nsw i32 %3, 5
%12 = add nsw i32 %11, %5
%13 = icmp slt i32 %12, 21
%14 = zext i1 %13 to i32
ret i32 %14
}