#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 *);
int main(void) {
  int number;
  printf("ÇëÊäÈëÒ»¸öÈÎÒâÕûÊý£º\n");
  scanf("%i", &number);
  printf("¸ÃÊýµÄÄæÐòÊýÎª£º\n");
  if (number > 0) {
    while (number > 0) {
      printf("%i", number % 10);
      number /= 10;
    }
  } else if (number < 0) {
    number = -number;
    while (number > 0) {
      printf("%i", number % 10);
      number /= 10;
    }
    printf("-");
  } else
    printf("0");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    11a7 <main+0x87>
jmp    116a <main+0x4a>
cmpl   $0x0,-0x8(%rbp)
jle    11a2 <main+0x82>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    116a <main+0x4a>
jmp    1217 <main+0xf7>
cmpl   $0x0,-0x8(%rbp)
jge    1204 <main+0xe4>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    11f1 <main+0xd1>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    11b9 <main+0x99>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1212 <main+0xf2>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1217 <main+0xf7>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xeb8(%rip),%rdi
call   1040 <puts@plt>
lea    0xea9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
lea    0xec4(%rip),%rdi
call   1040 <puts@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
jle    11d0 <main+0x90>
mov    $0xcccccccd,%r14d
lea    0xe7e(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %esi,%eax
imul   %r14,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movslq 0x4(%rsp),%rax
imul   $0x66666667,%rax,%rsi
mov    %rsi,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rsi
add    %ecx,%esi
mov    %esi,0x4(%rsp)
cmp    $0x9,%rax
jg     1190 <main+0x50>
jmp    1238 <main+0xf8>
mov    $0x30,%edi
jns    1233 <main+0xf3>
neg    %esi
mov    %esi,0x4(%rsp)
mov    $0xcccccccd,%r14d
lea    0xe16(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    %esi,%eax
imul   %r14,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movslq 0x4(%rsp),%rax
imul   $0x66666667,%rax,%rsi
mov    %rsi,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rsi
add    %ecx,%esi
mov    %esi,0x4(%rsp)
cmp    $0x9,%rax
jg     11f0 <main+0xb0>
mov    $0x2d,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [42 x i8] c"\C3\87\C3\AB\C3\8A\C3\A4\C3\88\C3\AB\C3\92\C2\BB\C2\B8\C3\B6\C3\88\C3\8E\C3\92\C3\A2\C3\95\C3\BB\C3\8A\C3\BD\C2\A3\C2\BA\0A\00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [34 x i8] c"\C2\B8\C3\83\C3\8A\C3\BD\C2\B5\C3\84\C3\84\C3\A6\C3\90\C3\B2\C3\8A\C3\BD\C3\8E\C2\AA\C2\A3\C2\BA\0A\00"
@.str.3 = [2 x i8] c"-\00"
@.str.4 = [2 x i8] c"0\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %19
8: ; preds = %0
br label %9
9: ; preds = %12, %8
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = load i32, i32* %2
%14 = srem i32 %13, 10
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %2
%17 = sdiv i32 %16, 10
store i32 %17, i32* %2
br label %9
18: ; preds = %9
br label %39
19: ; preds = %0
%20 = load i32, i32* %2
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %36
22: ; preds = %19
%23 = load i32, i32* %2
%24 = sub nsw i32 0, %23
store i32 %24, i32* %2
br label %25
25: ; preds = %28, %22
%26 = load i32, i32* %2
%27 = icmp sgt i32 %26, 0
br i1 %27, label %28, label %34
28: ; preds = %25
%29 = load i32, i32* %2
%30 = srem i32 %29, 10
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %2
%33 = sdiv i32 %32, 10
store i32 %33, i32* %2
br label %25
34: ; preds = %25
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %38
36: ; preds = %19
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %38
38: ; preds = %36, %34
br label %39
39: ; preds = %38, %18
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%i\00"
@str = [41 x i8] c"\C3\87\C3\AB\C3\8A\C3\A4\C3\88\C3\AB\C3\92\C2\BB\C2\B8\C3\B6\C3\88\C3\8E\C3\92\C3\A2\C3\95\C3\BB\C3\8A\C3\BD\C2\A3\C2\BA\00"
@str.5 = [33 x i8] c"\C2\B8\C3\83\C3\8A\C3\BD\C2\B5\C3\84\C3\84\C3\A6\C3\90\C3\B2\C3\8A\C3\BD\C3\8E\C2\AA\C2\A3\C2\BA\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.5, i64 0, i64 0))
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %0, %8
%9 = phi i32 [ %13, %8 ], [ %6, %0 ]
%10 = urem i32 %9, 10
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %1
%13 = sdiv i32 %12, 10
store i32 %13, i32* %1
%14 = icmp sgt i32 %12, 9
br i1 %14, label %8, label %29
15: ; preds = %0
%16 = icmp slt i32 %6, 0
br i1 %16, label %17, label %26
17: ; preds = %15
%18 = sub nsw i32 0, %6
store i32 %18, i32* %1
br label %19
19: ; preds = %17, %19
%20 = phi i32 [ %24, %19 ], [ %18, %17 ]
%21 = urem i32 %20, 10
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %1
%24 = sdiv i32 %23, 10
store i32 %24, i32* %1
%25 = icmp sgt i32 %23, 9
br i1 %25, label %19, label %26
26: ; preds = %19, %15
%27 = phi i32 [ 48, %15 ], [ 45, %19 ]
%28 = call i32 @putchar(i32 %27)
br label %29
29: ; preds = %8, %26
ret i32 0
}