#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 ni, nf, dez, cen, uni;
  printf("Digite o número: ");
  scanf("%d", &ni);
  cen = ni / 100;
  dez = (ni / 10) % 10;
  uni = ni % 10;
  nf = uni * 100 + dez * 10 + cen;
  printf("O número invertido é %d\n", nf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
imul   $0x64,-0x18(%rbp),%eax
imul   $0xa,-0x10(%rbp),%ecx
add    %ecx,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movslq 0x4(%rsp),%rax
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x66666667,%rax,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rdx
add    %esi,%edx
movslq %edx,%rdx
imul   $0x66666667,%rdx,%rsi
mov    %rsi,%rdi
shr    $0x3f,%rdi
sar    $0x22,%rsi
add    %edi,%esi
add    %esi,%esi
lea    (%rsi,%rsi,4),%esi
mov    %edx,%edi
sub    %esi,%edi
add    %edx,%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%eax
imul   $0x64,%eax,%eax
add    %ecx,%eax
lea    (%rdi,%rdi,4),%ecx
lea    (%rax,%rcx,2),%esi
lea    0xe70(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Digite o n\C3\BAmero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [27 x i8] c"O n\C3\BAmero invertido \C3\A9 %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = sdiv i32 %9, 100
store i32 %10, i32* %5
%11 = load i32, i32* %2
%12 = sdiv i32 %11, 10
%13 = srem i32 %12, 10
store i32 %13, i32* %4
%14 = load i32, i32* %2
%15 = srem i32 %14, 10
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = mul nsw i32 %16, 100
%18 = load i32, i32* %4
%19 = mul nsw i32 %18, 10
%20 = add nsw i32 %17, %19
%21 = load i32, i32* %5
%22 = add nsw i32 %20, %21
store i32 %22, i32* %3
%23 = load i32, i32* %3
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Digite o n\C3\BAmero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [27 x i8] c"O n\C3\BAmero invertido \C3\A9 %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 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 = load i32, i32* %1
%6 = sdiv i32 %5, 100
%7 = sdiv i32 %5, 10
%8 = srem i32 %7, 10
%9 = srem i32 %5, 10
%10 = mul nsw i32 %9, 100
%11 = mul nsw i32 %8, 10
%12 = add nsw i32 %10, %6
%13 = add nsw i32 %12, %11
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %13)
ret i32 0
}