#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int min = 0, max = 0, sum = 0, t = 0;
  puts("请输入两个整数");
  printf("整数a: ");
  scanf("%d", &min);
  printf("整数b: ");
  scanf("%d", &max);
  if (min > max) {
    t = min;
    min = max;
    max = t;
  }
  t = min;
  do {
    sum += t;
    t++;
  } while (t <= max);
  printf("大于等于%d小于等于%d的所有整数的和是: %d\n", min, max, sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xe9e(%rip),%rdi
call   1030 <puts@plt>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea4(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe86(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11c1 <main+0x91>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11c7 <main+0x97>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xeb4(%rip),%rdi
call   1030 <puts@plt>
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeba(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xea9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
mov    0x8(%rsp),%esi
cmp    %esi,%eax
jle    11a6 <main+0x76>
mov    %esi,0xc(%rsp)
mov    %eax,0x8(%rsp)
mov    %eax,%edx
jmp    11aa <main+0x7a>
mov    %esi,%edx
mov    %eax,%esi
cmp    %edx,%esi
mov    %edx,%eax
cmovg  %esi,%eax
mov    %esi,%edi
not    %edi
add    %eax,%edi
sub    %esi,%eax
lea    0x1(%rsi),%ecx
imul   %eax,%ecx
imul   %rdi,%rax
shr    %rax
add    %esi,%ecx
add    %eax,%ecx
lea    0xe5c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E4\B8\A4\E4\B8\AA\E6\95\B4\E6\95\B0\00"
@.str.1 = [10 x i8] c"\E6\95\B4\E6\95\B0a: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [10 x i8] c"\E6\95\B4\E6\95\B0b: \00"
@.str.4 = [58 x i8] c"\E5\A4\A7\E4\BA\8E\E7\AD\89\E4\BA\8E%d\E5\B0\8F\E4\BA\8E\E7\AD\89\E4\BA\8E%d\E7\9A\84\E6\89\80\E6\9C\89\E6\95\B4\E6\95\B0\E7\9A\84\E5\92\8C\E6\98\AF: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%6 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = icmp sgt i32 %11, %12
br i1 %13, label %14, label %18
14: ; preds = %0
%15 = load i32, i32* %2
store i32 %15, i32* %5
%16 = load i32, i32* %3
store i32 %16, i32* %2
%17 = load i32, i32* %5
store i32 %17, i32* %3
br label %18
18: ; preds = %14, %0
%19 = load i32, i32* %2
store i32 %19, i32* %5
br label %20
20: ; preds = %26, %18
%21 = load i32, i32* %5
%22 = load i32, i32* %4
%23 = add nsw i32 %22, %21
store i32 %23, i32* %4
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %26
26: ; preds = %20
%27 = load i32, i32* %5
%28 = load i32, i32* %3
%29 = icmp sle i32 %27, %28
br i1 %29, label %20, label %30
30: ; preds = %26
%31 = load i32, i32* %2
%32 = load i32, i32* %3
%33 = load i32, i32* %4
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0), i32 %31, i32 %32, i32 %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E4\B8\A4\E4\B8\AA\E6\95\B4\E6\95\B0\00"
@.str.1 = [10 x i8] c"\E6\95\B4\E6\95\B0a: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [10 x i8] c"\E6\95\B4\E6\95\B0b: \00"
@.str.4 = [58 x i8] c"\E5\A4\A7\E4\BA\8E\E7\AD\89\E4\BA\8E%d\E5\B0\8F\E4\BA\8E\E7\AD\89\E4\BA\8E%d\E7\9A\84\E6\89\80\E6\9C\89\E6\95\B4\E6\95\B0\E7\9A\84\E5\92\8C\E6\98\AF: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = icmp sgt i32 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %0
store i32 %11, i32* %1
store i32 %10, i32* %2
br label %14
14: ; preds = %13, %0
%15 = phi i32 [ %10, %13 ], [ %11, %0 ]
%16 = phi i32 [ %11, %13 ], [ %10, %0 ]
%17 = call i32 @llvm.smax.i32(i32 %16, i32 %15)
%18 = sub i32 %17, %16
%19 = add i32 %16, 1
%20 = mul i32 %18, %19
%21 = xor i32 %16, -1
%22 = add i32 %17, %21
%23 = zext i32 %22 to i33
%24 = zext i32 %18 to i33
%25 = mul i33 %23, %24
%26 = lshr i33 %25, 1
%27 = trunc i33 %26 to i32
%28 = add i32 %16, %20
%29 = add i32 %28, %27
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0), i32 %16, i32 %15, i32 %29)
ret i32 0
}