int isStillAlive() {
  int i;
  unsigned int cpt = 1;
  while (1) {
    for (i = 0; i < (50000000); i++) {
      cpt *= 2 - 1;
      asm volatile("nop");
    }
    puts("  + Processor is running ");
    print_hex((unsigned int)cpt);
    puts("\r\n");
    cpt += 1;
    if (kbhit())
      return getch();
  }
  return (i - cpt);
}


x86 assembly (clang, -O0):
<isStillAlive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x2faf080,-0x4(%rbp)
jge    117b <isStillAlive+0x3b>
mov    -0x8(%rbp),%eax
shl    $0x0,%eax
mov    %eax,-0x8(%rbp)
nop
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1156 <isStillAlive+0x16>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1050 <print_hex@plt>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <kbhit@plt>
cmp    $0x0,%eax
je     11c7 <isStillAlive+0x87>
mov    $0x0,%al
call   1060 <getch@plt>
add    $0x10,%rsp
pop    %rbp
ret
jmp    114f <isStillAlive+0xf>

x86 assembly (clang, -O2):
<isStillAlive>:
push   %r15
push   %r14
push   %rbx
mov    $0x1,%ebx
lea    0xeaf(%rip),%r14
lea    0xec2(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    $0x2faf080,%eax
cs nopw 0x0(%rax,%rax,1)
nop
nop
add    $0xffffffff,%eax
jne    1170 <isStillAlive+0x30>
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <puts@plt>
mov    %ebx,%edi
xor    %eax,%eax
call   1050 <print_hex@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <puts@plt>
add    $0x1,%ebx
xor    %eax,%eax
call   1040 <kbhit@plt>
test   %eax,%eax
je     1160 <isStillAlive+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1060 <getch@plt>

LLVM IR (-O0):
@.str = [26 x i8] c" + Processor is running \00"
@.str.1 = [3 x i8] c"\0D\0A\00"
define i32 @isStillAlive() {
%1 = alloca i32
%2 = alloca i32
store i32 1, i32* %2
br label %3
3: ; preds = %0, %24
store i32 0, i32* %1
br label %4
4: ; preds = %10, %3
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 50000000
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = load i32, i32* %2
%9 = mul i32 %8, 1
store i32 %9, i32* %2
br label %10
10: ; preds = %7
%11 = load i32, i32* %1
%12 = add nsw i32 %11, 1
store i32 %12, i32* %1
br label %4
13: ; preds = %4
%14 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* %2
%16 = call i32 (i32, ...) bitcast (i32 (...)* @print_hex to i32 (i32, ...)*)(i32 %15)
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%18 = load i32, i32* %2
%19 = add i32 %18, 1
store i32 %19, i32* %2
%20 = call i32 (...) @kbhit()
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %13
%23 = call i32 (...) @getch()
ret i32 %23
24: ; preds = %13
br label %3
}

LLVM IR (-O2):
@.str = [26 x i8] c" + Processor is running \00"
@.str.1 = [3 x i8] c"\0D\0A\00"
define i32 @isStillAlive() {
br label %1
1: ; preds = %7, %0
%2 = phi i32 [ 1, %0 ], [ %11, %7 ]
br label %3
3: ; preds = %1, %3
%4 = phi i32 [ 0, %1 ], [ %5, %3 ]
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
%5 = add nuw nsw i32 %4, 1
%6 = icmp eq i32 %5, 50000000
br i1 %6, label %7, label %3
7: ; preds = %3
%8 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @print_hex to i32 (i32, ...)*)(i32 %2)
%10 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%11 = add i32 %2, 1
%12 = tail call i32 (...) @kbhit()
%13 = icmp eq i32 %12, 0
br i1 %13, label %1, label %14
14: ; preds = %7
%15 = tail call i32 (...) @getch()
ret i32 %15
}