#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);
scalar_t__ time(int /*<<< orphan*/ *);
void setRandNum(int *ptr) {
  srand((int)time(NULL));
  (*ptr) = rand() % 10;
  do {
    (*(ptr + 1)) = rand() % 10;
  } while (*(ptr + 1) == *ptr);
  do {
    (*(ptr + 2)) = rand() % 10;
  } while (*(ptr + 2) == *ptr || *(ptr + 2) == *(ptr + 1));
  return;
}


x86 assembly (clang, -O0):
<setRandNum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
mov    %edx,(%rax)
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
mov    %edx,0x4(%rax)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    -0x8(%rbp),%rcx
cmp    (%rcx),%eax
je     1161 <setRandNum+0x31>
jmp    118f <setRandNum+0x5f>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
mov    %edx,0x8(%rax)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x8(%rbp),%rdx
mov    $0x1,%al
cmp    (%rdx),%ecx
mov    %al,-0x9(%rbp)
je     11d1 <setRandNum+0xa1>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    -0x8(%rbp),%rcx
cmp    0x4(%rcx),%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    118f <setRandNum+0x5f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setRandNum>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,(%rbx)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,0x4(%rbx)
cmp    (%rbx),%eax
je     1170 <setRandNum+0x40>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,0x8(%rbx)
cmp    (%rbx),%eax
je     11a0 <setRandNum+0x70>
cmp    0x4(%rbx),%eax
je     11a0 <setRandNum+0x70>
pop    %rbx
ret

LLVM IR (-O0):
define void @setRandNum(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i64 @time(i32* null)
%4 = trunc i64 %3 to i32
%5 = call i32 @srand(i32 %4)
%6 = call i32 (...) @rand()
%7 = srem i32 %6, 10
%8 = load i32*, i32** %2
store i32 %7, i32* %8
br label %9
9: ; preds = %14, %1
%10 = call i32 (...) @rand()
%11 = srem i32 %10, 10
%12 = load i32*, i32** %2
%13 = getelementptr inbounds i32, i32* %12, i64 1
store i32 %11, i32* %13
br label %14
14: ; preds = %9
%15 = load i32*, i32** %2
%16 = getelementptr inbounds i32, i32* %15, i64 1
%17 = load i32, i32* %16
%18 = load i32*, i32** %2
%19 = load i32, i32* %18
%20 = icmp eq i32 %17, %19
br i1 %20, label %9, label %21
21: ; preds = %14
br label %22
22: ; preds = %42, %21
%23 = call i32 (...) @rand()
%24 = srem i32 %23, 10
%25 = load i32*, i32** %2
%26 = getelementptr inbounds i32, i32* %25, i64 2
store i32 %24, i32* %26
br label %27
27: ; preds = %22
%28 = load i32*, i32** %2
%29 = getelementptr inbounds i32, i32* %28, i64 2
%30 = load i32, i32* %29
%31 = load i32*, i32** %2
%32 = load i32, i32* %31
%33 = icmp eq i32 %30, %32
br i1 %33, label %42, label %34
34: ; preds = %27
%35 = load i32*, i32** %2
%36 = getelementptr inbounds i32, i32* %35, i64 2
%37 = load i32, i32* %36
%38 = load i32*, i32** %2
%39 = getelementptr inbounds i32, i32* %38, i64 1
%40 = load i32, i32* %39
%41 = icmp eq i32 %37, %40
br label %42
42: ; preds = %34, %27
%43 = phi i1 [ true, %27 ], [ %41, %34 ]
br i1 %43, label %22, label %44
44: ; preds = %42
ret void
}

LLVM IR (-O2):
define void @setRandNum(i32* nocapture %0) {
%2 = tail call i64 @time(i32* null)
%3 = trunc i64 %2 to i32
%4 = tail call i32 @srand(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 10
store i32 %6, i32* %0
%7 = getelementptr inbounds i32, i32* %0, i64 1
br label %8
8: ; preds = %8, %1
%9 = tail call i32 (...) @rand()
%10 = srem i32 %9, 10
store i32 %10, i32* %7
%11 = load i32, i32* %0
%12 = icmp eq i32 %10, %11
br i1 %12, label %8, label %13
13: ; preds = %8
%14 = getelementptr inbounds i32, i32* %0, i64 2
br label %15
15: ; preds = %23, %13
%16 = tail call i32 (...) @rand()
%17 = srem i32 %16, 10
store i32 %17, i32* %14
%18 = load i32, i32* %0
%19 = icmp eq i32 %17, %18
br i1 %19, label %23, label %20
20: ; preds = %15
%21 = load i32, i32* %7
%22 = icmp eq i32 %17, %21
br i1 %22, label %23, label %24
23: ; preds = %20, %15
br label %15
24: ; preds = %20
ret void
}