#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 /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void dificuldade(int show_m[9][9], int main_m[9][9], int dif) {
  int i, rNum2, rNum3;
  srand(time(NULL));
  for (i = 0; i < dif; i++) {
    rNum2 = rand() % 9;
    rNum3 = rand() % 9;
    if (show_m[rNum2][rNum3] == 0)
      show_m[rNum2][rNum3] = main_m[rNum2][rNum3];
    else
      i--;
  }
}


x86 assembly (clang, -O0):
<dificuldade>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11f4 <dificuldade+0xc4>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x9,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x9,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    11d8 <dificuldade+0xa8>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    11e1 <dificuldade+0xb1>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    11e6 <dificuldade+0xb6>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    115a <dificuldade+0x2a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dificuldade>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r12d
mov    %rsi,%r14
mov    %rdi,%r15
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
test   %r12d,%r12d
jle    11d2 <dificuldade+0xa2>
xor    %ebp,%ebp
jmp    116b <dificuldade+0x3b>
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%ebp
add    $0x1,%ebp
cmp    %r12d,%ebp
jge    11d2 <dificuldade+0xa2>
xor    %eax,%eax
call   1050 <rand@plt>
movslq %eax,%rbx
imul   $0x38e38e39,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
lea    (%rax,%rax,8),%eax
sub    %eax,%ebx
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
movslq %ebx,%rcx
cltq
lea    (%rcx,%rcx,8),%rcx
lea    (%r15,%rcx,4),%rdx
cmpl   $0x0,(%rdx,%rax,4)
jne    1160 <dificuldade+0x30>
lea    (%rdx,%rax,4),%rdx
lea    (%r14,%rcx,4),%rcx
mov    (%rcx,%rax,4),%eax
mov    %eax,(%rdx)
jmp    1163 <dificuldade+0x33>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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