#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 /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
main() {
  int a, b, i;
  srand(time(NULL));
  b = rand() % 10 + 1;
  printf("Отгадайте число с 3 попыток\n");
  for (i = 0; i < 3; i++) {
    printf("Попытка номер %d\n", i + 1);
    scanf("%d", &a);
    if (a == b) {
      printf("Вы отгадали\n");
      break;
    } else {
      if (a < b)
        printf("Ваше число меньше\n");
      else
        printf("Ваше число больше\n");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
jge    122b <main+0xdb>
mov    -0x10(%rbp),%esi
add    $0x1,%esi
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe93(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    11e6 <main+0x96>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122b <main+0xdb>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1205 <main+0xb5>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1213 <main+0xc3>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1218 <main+0xc8>
jmp    121d <main+0xcd>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1199 <main+0x49>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1080 <rand@plt>
mov    %eax,%ebx
cltq
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%ebp
mov    %ebp,%eax
neg    %eax
lea    (%rbx,%rax,1),%r13d
add    $0x1,%r13d
lea    0xe71(%rip),%rdi
call   1030 <puts@plt>
lea    0xe44(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe4f(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%eax
lea    0xeb1(%rip),%r14
cmp    %r13d,%eax
je     127c <main+0x11c>
sub    %ebp,%ebx
cmp    %ebx,%eax
lea    0xe5b(%rip),%r12
lea    0xe75(%rip),%r15
mov    %r15,%rdi
cmovg  %r12,%rdi
call   1030 <puts@plt>
lea    0xdee(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdf9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %r13d,%eax
je     127c <main+0x11c>
cmp    %ebx,%eax
mov    %r15,%rdi
cmovg  %r12,%rdi
call   1030 <puts@plt>
lea    0xdb3(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdbe(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %r13d,%eax
je     127c <main+0x11c>
cmp    %ebx,%eax
cmovg  %r12,%r15
mov    %r15,%r14
mov    %r14,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [51 x i8] c"\D0\9E\D1\82\D0\B3\D0\B0\D0\B4\D0\B0\D0\B9\D1\82\D0\B5 \D1\87\D0\B8\D1\81\D0\BB\D0\BE \D1\81 3 \D0\BF\D0\BE\D0\BF\D1\8B\D1\82\D0\BE\D0\BA\0A\00"
@.str.1 = [30 x i8] c"\D0\9F\D0\BE\D0\BF\D1\8B\D1\82\D0\BA\D0\B0 \D0\BD\D0\BE\D0\BC\D0\B5\D1\80 %d\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [23 x i8] c"\D0\92\D1\8B \D0\BE\D1\82\D0\B3\D0\B0\D0\B4\D0\B0\D0\BB\D0\B8\0A\00"
@.str.4 = [34 x i8] c"\D0\92\D0\B0\D1\88\D0\B5 \D1\87\D0\B8\D1\81\D0\BB\D0\BE \D0\BC\D0\B5\D0\BD\D1\8C\D1\88\D0\B5\0A\00"
@.str.5 = [34 x i8] c"\D0\92\D0\B0\D1\88\D0\B5 \D1\87\D0\B8\D1\81\D0\BB\D0\BE \D0\B1\D0\BE\D0\BB\D1\8C\D1\88\D0\B5\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @time(i32* null)
%6 = call i32 @srand(i32 %5)
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 10
%9 = add nsw i32 %8, 1
store i32 %9, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %11
11: ; preds = %34, %0
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 3
br i1 %13, label %14, label %37
14: ; preds = %11
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = icmp eq i32 %19, %20
br i1 %21, label %22, label %24
22: ; preds = %14
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %37
24: ; preds = %14
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
br label %32
30: ; preds = %24
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
br label %32
32: ; preds = %30, %28
br label %33
33: ; preds = %32
br label %34
34: ; preds = %33
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
br label %11
37: ; preds = %22, %11
%38 = load i32, i32* %1
ret i32 %38
}

LLVM IR (-O2):
@.str.1 = [30 x i8] c"\D0\9F\D0\BE\D0\BF\D1\8B\D1\82\D0\BA\D0\B0 \D0\BD\D0\BE\D0\BC\D0\B5\D1\80 %d\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@str = [50 x i8] c"\D0\9E\D1\82\D0\B3\D0\B0\D0\B4\D0\B0\D0\B9\D1\82\D0\B5 \D1\87\D0\B8\D1\81\D0\BB\D0\BE \D1\81 3 \D0\BF\D0\BE\D0\BF\D1\8B\D1\82\D0\BE\D0\BA\00"
@str.6 = [33 x i8] c"\D0\92\D0\B0\D1\88\D0\B5 \D1\87\D0\B8\D1\81\D0\BB\D0\BE \D0\B1\D0\BE\D0\BB\D1\8C\D1\88\D0\B5\00"
@str.7 = [33 x i8] c"\D0\92\D0\B0\D1\88\D0\B5 \D1\87\D0\B8\D1\81\D0\BB\D0\BE \D0\BC\D0\B5\D0\BD\D1\8C\D1\88\D0\B5\00"
@str.8 = [22 x i8] c"\D0\92\D1\8B \D0\BE\D1\82\D0\B3\D0\B0\D0\B4\D0\B0\D0\BB\D0\B8\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 10
%7 = add nsw i32 %6, 1
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 1)
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = icmp eq i32 %11, %7
br i1 %12, label %32, label %13
13: ; preds = %0
%14 = icmp sgt i32 %11, %6
%15 = select i1 %14, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @str.6, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @str.7, i64 0, i64 0)
%16 = call i32 @puts(i8* dereferenceable(1) %15)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 2)
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%19 = load i32, i32* %1
%20 = icmp eq i32 %19, %7
br i1 %20, label %32, label %21
21: ; preds = %13
%22 = icmp sgt i32 %19, %6
%23 = select i1 %22, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @str.6, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @str.7, i64 0, i64 0)
%24 = call i32 @puts(i8* dereferenceable(1) %23)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 3)
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%27 = load i32, i32* %1
%28 = icmp eq i32 %27, %7
br i1 %28, label %32, label %29
29: ; preds = %21
%30 = icmp sgt i32 %27, %6
%31 = select i1 %30, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @str.6, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @str.7, i64 0, i64 0)
br label %32
32: ; preds = %29, %0, %13, %21
%33 = phi i8* [ getelementptr inbounds ([22 x i8], [22 x i8]* @str.8, i64 0, i64 0), %21 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @str.8, i64 0, i64 0), %13 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @str.8, i64 0, i64 0), %0 ], [ %31, %29 ]
%34 = call i32 @puts(i8* dereferenceable(1) %33)
ret i32 0
}