#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 /*<<< orphan*/ scanf(char *, int *);
void loop_till_sentinal_value(void) {
  int sentinal = 13, input;
  printf("Enter the number 13 to exit the following loop...\n");
  while (input != sentinal) {
    printf("Enter a number > ");
    scanf("%d", &input);
    printf("You entered %d\n", input);
  }
}


x86 assembly (clang, -O0):
<loop_till_sentinal_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xd,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
je     117d <loop_till_sentinal_value+0x5d>
lea    0xee3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    113d <loop_till_sentinal_value+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loop_till_sentinal_value>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xee6(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb5(%rip),%r14
lea    0xec0(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xeb7(%rip),%rbx
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0xd,0x4(%rsp)
jne    1160 <loop_till_sentinal_value+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [51 x i8] c"Enter the number 13 to exit the following loop...\0A\00"
@.str.1 = [18 x i8] c"Enter a number > \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [16 x i8] c"You entered %d\0A\00"
define void @loop_till_sentinal_value() {
%1 = alloca i32
%2 = alloca i32
store i32 13, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %8, %0
%5 = load i32, i32* %2
%6 = load i32, i32* %1
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %11)
br label %4
13: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str.1 = [18 x i8] c"Enter a number > \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [16 x i8] c"You entered %d\0A\00"
@str = [50 x i8] c"Enter the number 13 to exit the following loop...\00"
define void @loop_till_sentinal_value() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %0, %4
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, 13
br i1 %10, label %11, label %4
11: ; preds = %4
ret void
}