#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*/ clear();
int /*<<< orphan*/ printf(char *, int, int);
scalar_t__ scanf(char *, int *);
int get(int a, int b) {
  int n;
  printf("%d,%d\n", a, b);
  do {
    printf("please input num between%d to %d: ", a, b);
    if (scanf("%d", &n))
      clear();
  } while (n < a || n > b);
  return (a + b) / n;
}


x86 assembly (clang, -O0):
<get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x0,%rax
je     1183 <get+0x53>
mov    $0x0,%al
call   1050 <clear@plt>
jmp    1188 <get+0x58>
mov    -0xc(%rbp),%ecx
mov    $0x1,%al
cmp    -0x4(%rbp),%ecx
mov    %al,-0xd(%rbp)
jl     11a5 <get+0x75>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
setg   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1150 <get+0x20>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xeb9(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
lea    0xeb0(%rip),%r14
lea    0xecc(%rip),%r15
lea    0xc(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     1193 <get+0x63>
xor    %eax,%eax
call   1050 <clear@plt>
mov    0xc(%rsp),%ecx
cmp    %ebp,%ecx
jl     1170 <get+0x40>
cmp    %ebx,%ecx
jg     1170 <get+0x40>
add    %ebp,%ebx
mov    %ebx,%eax
cltd
idiv   %ecx
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d,%d\0A\00"
@.str.1 = [35 x i8] c"please input num between%d to %d: \00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @get(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
br label %9
9: ; preds = %26, %2
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %11)
%13 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = call i32 (...) @clear()
br label %17
17: ; preds = %15, %9
br label %18
18: ; preds = %17
%19 = load i32, i32* %5
%20 = load i32, i32* %3
%21 = icmp slt i32 %19, %20
br i1 %21, label %26, label %22
22: ; preds = %18
%23 = load i32, i32* %5
%24 = load i32, i32* %4
%25 = icmp sgt i32 %23, %24
br label %26
26: ; preds = %22, %18
%27 = phi i1 [ true, %18 ], [ %25, %22 ]
br i1 %27, label %9, label %28
28: ; preds = %26
%29 = load i32, i32* %3
%30 = load i32, i32* %4
%31 = add nsw i32 %29, %30
%32 = load i32, i32* %5
%33 = sdiv i32 %31, %32
ret i32 %33
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d,%d\0A\00"
@.str.1 = [35 x i8] c"please input num between%d to %d: \00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @get(i32 %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
br label %6
6: ; preds = %12, %2
%7 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 %0, i32 %1)
%8 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = call i32 (...) @clear()
br label %12
12: ; preds = %6, %10
%13 = load i32, i32* %3
%14 = icmp slt i32 %13, %0
%15 = icmp sgt i32 %13, %1
%16 = or i1 %14, %15
br i1 %16, label %6, label %17
17: ; preds = %12
%18 = add nsw i32 %1, %0
%19 = sdiv i32 %18, %13
ret i32 %19
}