#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 input_number, first_digit, second_digit;
  printf("What's the 2 digit number you wish reversed? ");
  scanf("%2d", &input_number);
  first_digit = input_number / 10;
  second_digit = input_number % 10;
  printf("Your number reversed is %1d%1d.\n", second_digit, first_digit);
  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    0xeea(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [46 x i8] c"What's the 2 digit number you wish reversed? \00"
@.str.1 = [4 x i8] c"%2d\00"
@.str.2 = [33 x i8] c"Your number reversed is %1d%1d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = sdiv i32 %7, 10
store i32 %8, i32* %3
%9 = load i32, i32* %2
%10 = srem i32 %9, 10
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = load i32, i32* %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %11, i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [46 x i8] c"What's the 2 digit number you wish reversed? \00"
@.str.1 = [4 x i8] c"%2d\00"
@.str.2 = [33 x i8] c"Your number reversed is %1d%1d.\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 ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = sdiv i32 %5, 10
%7 = srem i32 %5, 10
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %6)
ret i32 0
}