#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 *, char);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char str[1000];
  int i;
  scanf("%s", str);
  for (i = 0; str[i]; i++)
    ;
  for (i--; str[i] == '0'; i--)
    ;
  for (; i >= 0; i--)
    printf("%c", str[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rsi
lea    0xec0(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0x3f4(%rbp)
movslq -0x3f4(%rbp),%rax
cmpb   $0x0,-0x3f0(%rbp,%rax,1)
je     117d <main+0x5d>
jmp    1169 <main+0x49>
mov    -0x3f4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3f4(%rbp)
jmp    114f <main+0x2f>
mov    -0x3f4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3f4(%rbp)
movslq -0x3f4(%rbp),%rax
movsbl -0x3f0(%rbp,%rax,1),%eax
ff
cmp    $0x30,%eax
jne    11bd <main+0x9d>
jmp    11a9 <main+0x89>
mov    -0x3f4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3f4(%rbp)
jmp    118c <main+0x6c>
jmp    11c2 <main+0xa2>
cmpl   $0x0,-0x3f4(%rbp)
jl     11fe <main+0xde>
movslq -0x3f4(%rbp),%rax
lea    0xe26(%rip),%rdi
movsbl -0x3f0(%rbp,%rax,1),%esi
ff
call   1030 <printf@plt>
mov    -0x3f4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3f4(%rbp)
jmp    11c2 <main+0xa2>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x3f0,%rsp
lea    0xece(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%eax
cmpb   $0x0,(%rbx)
lea    0x1(%rbx),%rbx
jne    1150 <main+0x30>
movslq %eax,%rcx
add    %rsp,%rcx
add    $0xffffffffffffffff,%rcx
cs nopw 0x0(%rax,%rax,1)
add    $0xffffffff,%eax
cmpb   $0x30,(%rcx)
lea    -0x1(%rcx),%rcx
je     1170 <main+0x50>
lea    0x1(%rax),%ebp
test   %ebp,%ebp
jle    11a6 <main+0x86>
mov    %eax,%eax
lea    (%rsp,%rax,1),%rbx
lea    0xe73(%rip),%r14
movsbl (%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0xffffffff,%ebp
add    $0xffffffffffffffff,%rbx
test   %ebp,%ebp
jg     1190 <main+0x70>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
store i32 0, i32* %3
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %6
br label %13
13: ; preds = %12
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %6
16: ; preds = %6
%17 = load i32, i32* %3
%18 = add nsw i32 %17, -1
store i32 %18, i32* %3
br label %19
19: ; preds = %27, %16
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 48
br i1 %25, label %26, label %30
26: ; preds = %19
br label %27
27: ; preds = %26
%28 = load i32, i32* %3
%29 = add nsw i32 %28, -1
store i32 %29, i32* %3
br label %19
30: ; preds = %19
br label %31
31: ; preds = %40, %30
%32 = load i32, i32* %3
%33 = icmp sge i32 %32, 0
br i1 %33, label %34, label %43
34: ; preds = %31
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %38)
br label %40
40: ; preds = %34
%41 = load i32, i32* %3
%42 = add nsw i32 %41, -1
store i32 %42, i32* %3
br label %31
43: ; preds = %31
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %4
4: ; preds = %4, %0
%5 = phi i64 [ %9, %4 ], [ 0, %0 ]
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
%9 = add nuw i64 %5, 1
br i1 %8, label %10, label %4
10: ; preds = %4
%11 = shl i64 %5, 32
%12 = ashr exact i64 %11, 32
br label %13
13: ; preds = %10, %13
%14 = phi i64 [ %12, %10 ], [ %15, %13 ]
%15 = add nsw i64 %14, -1
%16 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 48
br i1 %18, label %13, label %19
19: ; preds = %13
%20 = trunc i64 %14 to i32
%21 = icmp sgt i32 %20, 0
br i1 %21, label %22, label %32
22: ; preds = %19
%23 = and i64 %15, 4294967295
br label %24
24: ; preds = %22, %24
%25 = phi i64 [ %23, %22 ], [ %29, %24 ]
%26 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %27)
%29 = add nsw i64 %25, -1
%30 = trunc i64 %25 to i32
%31 = icmp sgt i32 %30, 0
br i1 %31, label %24, label %32
32: ; preds = %24, %19
ret i32 0
}