#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*/);
int main() {
  srand(time(0));
  int zufall = rand() % 100;
  int raten = 1;
  printf("Raten Sie eine Zahl zwischen 0 und 99\n");
  while (raten) {
    int R;
    scanf("%i", &R);
    if (R == zufall) {
      raten = 0;
      printf("Gefunden :-) \n");
    } else {
      if (R < zufall)
        printf("zu klein\n");
      else
        printf("zu gross\n");
    }
  }
  float kehrwert = 1.0 / zufall;
  printf("Der Kehrwert der Zahl ist %f\n", kehrwert);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
je     120b <main+0xbb>
lea    0xe8a(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11d4 <main+0x84>
movl   $0x0,-0xc(%rbp)
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1206 <main+0xb6>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f3 <main+0xa3>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1201 <main+0xb1>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1206 <main+0xb6>
jmp    1194 <main+0x44>
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xde8(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe20(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1080 <rand@plt>
movslq %eax,%rbx
imul   $0x51eb851f,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%ebx
lea    0xe84(%rip),%rdi
call   1030 <puts@plt>
lea    0xe57(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    %ebx,%eax
jne    1208 <main+0xa8>
lea    0xe97(%rip),%rdi
call   1030 <puts@plt>
cvtsi2sd %ebx,%xmm0
movsd  0xe25(%rip),%xmm1
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe1a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xe49(%rip),%r12
lea    0xe39(%rip),%r13
lea    0xdeb(%rip),%r14
lea    0xc(%rsp),%r15
jmp    124c <main+0xec>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    %ebx,%eax
je     11c3 <main+0x63>
mov    %r12,%rdi
cmp    %ebx,%eax
jl     1230 <main+0xd0>
mov    %r13,%rdi
jmp    1230 <main+0xd0>

LLVM IR (-O0):
@.str = [39 x i8] c"Raten Sie eine Zahl zwischen 0 und 99\0A\00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [15 x i8] c"Gefunden :-) \0A\00"
@.str.3 = [10 x i8] c"zu klein\0A\00"
@.str.4 = [10 x i8] c"zu gross\0A\00"
@.str.5 = [30 x i8] c"Der Kehrwert der Zahl ist %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
store i32 0, i32* %1
%6 = call i32 @time(i32 0)
%7 = call i32 @srand(i32 %6)
%8 = call i32 (...) @rand()
%9 = srem i32 %8, 100
store i32 %9, i32* %2
store i32 1, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %30, %0
%12 = load i32, i32* %3
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %31
14: ; preds = %11
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%16 = load i32, i32* %4
%17 = load i32, i32* %2
%18 = icmp eq i32 %16, %17
br i1 %18, label %19, label %21
19: ; preds = %14
store i32 0, i32* %3
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %30
21: ; preds = %14
%22 = load i32, i32* %4
%23 = load i32, i32* %2
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %29
27: ; preds = %21
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %29
29: ; preds = %27, %25
br label %30
30: ; preds = %29, %19
br label %11
31: ; preds = %11
%32 = load i32, i32* %2
%33 = sitofp i32 %32 to double
%34 = fdiv double 1.000000e+00, %33
%35 = fptrunc double %34 to float
store float %35, float* %5
%36 = load float, float* %5
%37 = fpext float %36 to double
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), double %37)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%i\00"
@.str.5 = [30 x i8] c"Der Kehrwert der Zahl ist %f\0A\00"
@str = [38 x i8] c"Raten Sie eine Zahl zwischen 0 und 99\00"
@str.6 = [9 x i8] c"zu gross\00"
@str.7 = [9 x i8] c"zu klein\00"
@str.8 = [14 x i8] c"Gefunden :-) \00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 @time(i32 0)
%3 = tail call i32 @srand(i32 %2)
%4 = tail call i32 (...) @rand()
%5 = srem i32 %4, 100
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%7 = bitcast i32* %1 to i8*
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, %5
br i1 %10, label %19, label %11
11: ; preds = %0, %11
%12 = phi i32 [ %17, %11 ], [ %9, %0 ]
%13 = icmp slt i32 %12, %5
%14 = select i1 %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.6, i64 0, i64 0)
%15 = call i32 @puts(i8* dereferenceable(1) %14)
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%17 = load i32, i32* %1
%18 = icmp eq i32 %17, %5
br i1 %18, label %19, label %11
19: ; preds = %11, %0
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.8, i64 0, i64 0))
%21 = sitofp i32 %5 to double
%22 = fdiv double 1.000000e+00, %21
%23 = fptrunc double %22 to float
%24 = fpext float %23 to double
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), double %24)
ret i32 0
}