#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 randomInt(int);
void priklad_dva(int strana_trojuhelniku) {
  int a, b, c;
  bool repeat = true;
  printf("===== PRIKLAD 2 =====\n");
  while (repeat) {
    repeat = false;
    a = randomInt(strana_trojuhelniku);
    b = randomInt(strana_trojuhelniku);
    c = randomInt(strana_trojuhelniku);
    if (((a + b) < c) || ((a + c) < b) || ((b + c) < a)) {
      repeat = true;
    }
    printf("Trojuhelnik a=%d b=%d c=%d   - %s\n", a, b, c,
           (repeat == true) ? "NEVYHOVUJE" : "VYHOVUJE");
  }
  printf("===== KONEC PRIKLADU 2 =====\n");
}


x86 assembly (clang, -O0):
<priklad_dva>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x14(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x14(%rbp)
je     11da <priklad_dva+0xba>
movl   $0x0,-0x14(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <randomInt@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <randomInt@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <randomInt@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     119f <priklad_dva+0x7f>
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     119f <priklad_dva+0x7f>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a6 <priklad_dva+0x86>
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%edi
lea    0xe83(%rip),%r8
lea    0xe7a(%rip),%rax
cmp    $0x1,%edi
cmove  %rax,%r8
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1140 <priklad_dva+0x20>
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<priklad_dva>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r15d
lea    0xee9(%rip),%rdi
call   1030 <puts@plt>
lea    0xed2(%rip),%r12
lea    0xea8(%rip),%r14
jmp    1175 <priklad_dva+0x45>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
test   %r13b,%r13b
je     11bd <priklad_dva+0x8d>
mov    %r15d,%edi
call   1050 <randomInt@plt>
mov    %eax,%ebx
mov    %r15d,%edi
call   1050 <randomInt@plt>
mov    %eax,%ebp
mov    %r15d,%edi
call   1050 <randomInt@plt>
lea    (%rbx,%rbp,1),%ecx
cmp    %eax,%ecx
setl   %cl
lea    (%rax,%rbx,1),%edx
cmp    %ebp,%edx
setl   %dl
or     %cl,%dl
lea    (%rax,%rbp,1),%ecx
cmp    %ebx,%ecx
setl   %r13b
or     %dl,%r13b
mov    %r12,%r8
jne    1160 <priklad_dva+0x30>
lea    0xe6a(%rip),%r8
jmp    1160 <priklad_dva+0x30>
lea    0xe80(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"===== PRIKLAD 2 =====\0A\00"
@.str.1 = [35 x i8] c"Trojuhelnik a=%d b=%d c=%d - %s\0A\00"
@.str.2 = [11 x i8] c"NEVYHOVUJE\00"
@.str.3 = [9 x i8] c"VYHOVUJE\00"
@.str.4 = [30 x i8] c"===== KONEC PRIKLADU 2 =====\0A\00"
define void @priklad_dva(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %36, %1
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %45
11: ; preds = %8
store i32 0, i32* %6
%12 = load i32, i32* %2
%13 = call i32 @randomInt(i32 %12)
store i32 %13, i32* %3
%14 = load i32, i32* %2
%15 = call i32 @randomInt(i32 %14)
store i32 %15, i32* %4
%16 = load i32, i32* %2
%17 = call i32 @randomInt(i32 %16)
store i32 %17, i32* %5
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = add nsw i32 %18, %19
%21 = load i32, i32* %5
%22 = icmp slt i32 %20, %21
br i1 %22, label %35, label %23
23: ; preds = %11
%24 = load i32, i32* %3
%25 = load i32, i32* %5
%26 = add nsw i32 %24, %25
%27 = load i32, i32* %4
%28 = icmp slt i32 %26, %27
br i1 %28, label %35, label %29
29: ; preds = %23
%30 = load i32, i32* %4
%31 = load i32, i32* %5
%32 = add nsw i32 %30, %31
%33 = load i32, i32* %3
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %36
35: ; preds = %29, %23, %11
store i32 1, i32* %6
br label %36
36: ; preds = %35, %29
%37 = load i32, i32* %3
%38 = load i32, i32* %4
%39 = load i32, i32* %5
%40 = load i32, i32* %6
%41 = icmp eq i32 %40, 1
%42 = zext i1 %41 to i64
%43 = select i1 %41, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0)
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %37, i32 %38, i32 %39, i8* %43)
br label %8
45: ; preds = %8
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [35 x i8] c"Trojuhelnik a=%d b=%d c=%d - %s\0A\00"
@.str.2 = [11 x i8] c"NEVYHOVUJE\00"
@.str.3 = [9 x i8] c"VYHOVUJE\00"
@str = [22 x i8] c"===== PRIKLAD 2 =====\00"
@str.5 = [29 x i8] c"===== KONEC PRIKLADU 2 =====\00"
define void @priklad_dva(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %3
3: ; preds = %1, %3
%4 = tail call i32 @randomInt(i32 %0)
%5 = tail call i32 @randomInt(i32 %0)
%6 = tail call i32 @randomInt(i32 %0)
%7 = add nsw i32 %5, %4
%8 = icmp slt i32 %7, %6
%9 = add nsw i32 %6, %4
%10 = icmp slt i32 %9, %5
%11 = select i1 %8, i1 true, i1 %10
%12 = add nsw i32 %6, %5
%13 = icmp slt i32 %12, %4
%14 = select i1 %11, i1 true, i1 %13
%15 = select i1 %14, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %5, i32 %6, i8* %15)
br i1 %14, label %3, label %17
17: ; preds = %3
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.5, i64 0, i64 0))
ret void
}