#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int read_value();
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char **argv) {
  int value = 0;
  printf("Example: 01 \n");
  do {
    printf("Choose one:\n");
    printf("[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]: ");
    scanf("%i", &value);
  } while (value <= 0 || value > 10);
  printf("Example: 02 \n");
  int i = 0;
  do
    printf("%i\n", i);
  while (++i < value);
  printf("Example: 03 \n");
  do
    value = read_value();
  while (value <= 0 || value > 10);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xebf(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x19(%rbp)
jle    11a0 <main+0x70>
cmpl   $0xa,-0x14(%rbp)
setg   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    115b <main+0x2b>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmp    -0x14(%rbp),%eax
jl     11c0 <main+0x90>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <read_value@plt>
mov    %eax,-0x14(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x1a(%rbp)
jle    1214 <main+0xe4>
cmpl   $0xa,-0x14(%rbp)
setg   %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
test   $0x1,%al
jne    11f1 <main+0xc1>
mov    0x2dba(%rip),%rax
mov    (%rax),%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
movl   $0x0,0xc(%rsp)
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
lea    0xecf(%rip),%r14
lea    0xe92(%rip),%r15
lea    0xead(%rip),%r12
lea    0xc(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
add    $0xfffffff5,%eax
cmp    $0xfffffff6,%eax
jb     1180 <main+0x40>
lea    0xe92(%rip),%rdi
call   1030 <puts@plt>
lea    0xe69(%rip),%rbx
xor    %ebp,%ebp
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jl     11c0 <main+0x80>
lea    0xe73(%rip),%rdi
call   1030 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <read_value@plt>
mov    %eax,0xc(%rsp)
add    $0xfffffff5,%eax
cmp    $0xfffffff6,%eax
jb     11f0 <main+0xb0>
mov    0x2dd6(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Example: 01 \0A\00"
@.str.1 = [13 x i8] c"Choose one:\0A\00"
@.str.2 = [34 x i8] c"[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]: \00"
@.str.3 = [3 x i8] c"%i\00"
@.str.4 = [14 x i8] c"Example: 02 \0A\00"
@.str.5 = [4 x i8] c"%i\0A\00"
@.str.6 = [14 x i8] c"Example: 03 \0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %19, %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %6)
br label %13
13: ; preds = %9
%14 = load i32, i32* %6
%15 = icmp sle i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = load i32, i32* %6
%18 = icmp sgt i32 %17, 10
br label %19
19: ; preds = %16, %13
%20 = phi i1 [ true, %13 ], [ %18, %16 ]
br i1 %20, label %9, label %21
21: ; preds = %19
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %7
br label %23
23: ; preds = %26, %21
%24 = load i32, i32* %7
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %23
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
%29 = load i32, i32* %6
%30 = icmp slt i32 %28, %29
br i1 %30, label %23, label %31
31: ; preds = %26
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0))
br label %33
33: ; preds = %41, %31
%34 = call i32 (...) @read_value()
store i32 %34, i32* %6
br label %35
35: ; preds = %33
%36 = load i32, i32* %6
%37 = icmp sle i32 %36, 0
br i1 %37, label %41, label %38
38: ; preds = %35
%39 = load i32, i32* %6
%40 = icmp sgt i32 %39, 10
br label %41
41: ; preds = %38, %35
%42 = phi i1 [ true, %35 ], [ %40, %38 ]
br i1 %42, label %33, label %43
43: ; preds = %41
%44 = load i32, i32* @EXIT_SUCCESS
ret i32 %44
}

LLVM IR (-O2):
@.str.2 = [34 x i8] c"[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]: \00"
@.str.3 = [3 x i8] c"%i\00"
@.str.5 = [4 x i8] c"%i\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [13 x i8] c"Example: 01 \00"
@str.7 = [12 x i8] c"Choose one:\00"
@str.8 = [13 x i8] c"Example: 02 \00"
@str.9 = [13 x i8] c"Example: 03 \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %6, %2
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.7, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %3
%11 = add i32 %10, -11
%12 = icmp ult i32 %11, -10
br i1 %12, label %6, label %13
13: ; preds = %6
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.8, i64 0, i64 0))
br label %15
15: ; preds = %15, %13
%16 = phi i32 [ 0, %13 ], [ %18, %15 ]
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %16)
%18 = add nuw nsw i32 %16, 1
%19 = load i32, i32* %3
%20 = icmp slt i32 %18, %19
br i1 %20, label %15, label %21
21: ; preds = %15
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.9, i64 0, i64 0))
br label %23
23: ; preds = %23, %21
%24 = call i32 (...) @read_value()
store i32 %24, i32* %3
%25 = add i32 %24, -11
%26 = icmp ult i32 %25, -10
br i1 %26, label %23, label %27
27: ; preds = %23
%28 = load i32, i32* @EXIT_SUCCESS
ret i32 %28
}