#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 solve() {
  int n;
  scanf("%d", &n);
  while (n % 10 == 0)
    n /= 10;
  while (n) {
    printf("%d", n % 10);
    n = n / 10;
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<solve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    115f <solve+0x3f>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    1138 <solve+0x18>
jmp    1164 <solve+0x44>
cmpl   $0x0,-0x4(%rbp)
je     119c <solve+0x7c>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    1164 <solve+0x44>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
imul   $0xcccccccd,%eax,%ecx
add    $0x19999998,%ecx
ror    %ecx
cmp    $0x19999998,%ecx
jbe    1170 <solve+0x40>
test   %eax,%eax
jne    11a4 <solve+0x74>
jmp    11fd <solve+0xcd>
nopl   0x0(%rax)
cltq
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
imul   $0xcccccccd,%eax,%ecx
add    $0x19999998,%ecx
ror    %ecx
cmp    $0x19999999,%ecx
jb     1170 <solve+0x40>
mov    %eax,0xc(%rsp)
test   %eax,%eax
je     11fd <solve+0xcd>
lea    0xe55(%rip),%rbx
nopl   0x0(%rax,%rax,1)
movslq %eax,%rsi
imul   $0x66666667,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movslq 0xc(%rsp),%rcx
imul   $0x66666667,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
mov    %eax,0xc(%rsp)
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     11b0 <solve+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @solve() {
%1 = alloca i32
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
br label %3
3: ; preds = %7, %0
%4 = load i32, i32* %1
%5 = srem i32 %4, 10
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = load i32, i32* %1
%9 = sdiv i32 %8, 10
store i32 %9, i32* %1
br label %3
10: ; preds = %3
br label %11
11: ; preds = %14, %10
%12 = load i32, i32* %1
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load i32, i32* %1
%16 = srem i32 %15, 10
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %1
%19 = sdiv i32 %18, 10
store i32 %19, i32* %1
br label %11
20: ; preds = %11
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @solve() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = srem i32 %4, 10
%6 = icmp eq i32 %5, 0
br i1 %6, label %11, label %8
7: ; preds = %11
store i32 %13, i32* %1
br label %8
8: ; preds = %7, %0
%9 = phi i32 [ %13, %7 ], [ %4, %0 ]
%10 = icmp eq i32 %9, 0
br i1 %10, label %24, label %16
11: ; preds = %0, %11
%12 = phi i32 [ %13, %11 ], [ %4, %0 ]
%13 = sdiv i32 %12, 10
%14 = srem i32 %13, 10
%15 = icmp eq i32 %14, 0
br i1 %15, label %11, label %7
16: ; preds = %8, %16
%17 = phi i32 [ %21, %16 ], [ %9, %8 ]
%18 = srem i32 %17, 10
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %1
%21 = sdiv i32 %20, 10
store i32 %21, i32* %1
%22 = add i32 %20, 9
%23 = icmp ult i32 %22, 19
br i1 %23, label %24, label %16
24: ; preds = %16, %8
%25 = call i32 @putchar(i32 10)
ret void
}