#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 / 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    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
je     120e <main+0xbe>
lea    0xe82(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
je     11d7 <main+0x87>
movl   $0x0,-0xc(%rbp)
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1209 <main+0xb9>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f6 <main+0xa6>
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1204 <main+0xb4>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1209 <main+0xb9>
jmp    1194 <main+0x44>
mov    $0x1,%eax
cltd
idivl  -0x8(%rbp)
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe1d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
xor    %r12d,%r12d
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %eax,%eax
call   1080 <rand@plt>
movslq %eax,%rbp
imul   $0x51eb851f,%rbp,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%ebx
lea    0xe7c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe4f(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
sub    %ebx,%ebp
mov    %ebp,0xc(%rsp)
jne    120b <main+0xab>
lea    0xe7d(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xe27(%rip),%r15
lea    0xc(%rsp),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %ebp,0xc(%rsp)
nopl   (%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %ebp,0xc(%rsp)
test   %ebp,%ebp
je     11f0 <main+0x90>
lea    0xe3e(%rip),%rdi
call   1030 <puts@plt>
lea    0x1(%rbp),%eax
cmp    $0x3,%eax
cmovae %r12d,%ebp
cvtsi2ss %ebp,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdd3(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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 = %29, %0
%12 = load i32, i32* %3
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %30
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* %2
store i32 %16, i32* %4
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %14
store i32 0, i32* %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %29
20: ; preds = %14
%21 = load i32, i32* %4
%22 = load i32, i32* %2
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %28
26: ; preds = %20
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %28
28: ; preds = %26, %24
br label %29
29: ; preds = %28, %18
br label %11
30: ; preds = %11
%31 = load i32, i32* %2
%32 = sdiv i32 1, %31
%33 = sitofp i32 %32 to float
store float %33, float* %5
%34 = load float, float* %5
%35 = fpext float %34 to double
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), double %35)
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 = [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 = icmp eq i32 %5, 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
store i32 %5, i32* %1
br i1 %8, label %10, label %16
10: ; preds = %0
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.6, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
store i32 %5, i32* %1
br label %13
13: ; preds = %10, %13
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.6, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
store i32 %5, i32* %1
br i1 %8, label %13, label %16
16: ; preds = %13, %0
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.7, i64 0, i64 0))
%18 = add nsw i32 %5, 1
%19 = icmp ult i32 %18, 3
%20 = select i1 %19, i32 %5, i32 0
%21 = sitofp i32 %20 to float
%22 = fpext float %21 to double
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), double %22)
ret i32 0
}