#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 main() {
  int ful, num1, num2, num3, num4;
  int swp;
  printf("Please enter a integer with four digits: ");
  scanf("%d", &ful);
  num1 = ful / 1000;
  ful = ful % 1000;
  num2 = ful / 100;
  ful = ful % 100;
  num3 = ful / 10;
  ful = ful % 10;
  num4 = ful;
  num1 = (num1 + 7) % 10;
  num2 = (num2 + 7) % 10;
  num3 = (num3 + 7) % 10;
  num4 = (num4 + 7) % 10;
  swp = num1;
  num1 = num3;
  num3 = swp;
  swp = num2;
  num2 = num4;
  num4 = swp;
  printf("%d   ", num1);
  printf("%d   ", num2);
  printf("%d   ", num3);
  printf("%d   ", num4);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    $0x7,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x7,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x7,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x7,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movslq 0x4(%rsp),%rax
imul   $0x10624dd3,%rax,%rsi
mov    %rsi,%rdi
shr    $0x3f,%rdi
sar    $0x26,%rsi
lea    (%rsi,%rdi,1),%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
movswl %ax,%ecx
imul   $0x147b,%ecx,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x13,%ecx
add    %edx,%ecx
imul   $0x64,%ecx,%edx
sub    %edx,%eax
movsbl %al,%edx
imul   $0x67,%edx,%edx
movzwl %dx,%edx
movswl %dx,%ebp
shr    $0xf,%edx
shr    $0xa,%ebp
add    %dl,%bpl
movzbl %bpl,%edx
lea    (%rdx,%rdx,1),%ebp
lea    0x0(%rbp,%rbp,4),%ebp
sub    %bpl,%al
movsbl %al,%eax
mov    %eax,0x4(%rsp)
add    %edi,%esi
add    $0x7,%esi
movslq %esi,%r15
imul   $0x66666667,%r15,%rsi
mov    %rsi,%rdi
shr    $0x3f,%rdi
sar    $0x22,%rsi
add    %edi,%esi
add    %esi,%esi
lea    (%rsi,%rsi,4),%esi
sub    %esi,%r15d
add    $0x7,%cl
movsbl %cl,%ecx
imul   $0x67,%ecx,%esi
movzwl %si,%edi
shr    $0xa,%esi
shr    $0xf,%edi
add    %sil,%dil
movzbl %dil,%esi
add    %esi,%esi
lea    (%rsi,%rsi,4),%esi
sub    %sil,%cl
movsbl %cl,%r14d
add    $0x7,%dl
movsbl %dl,%ecx
imul   $0x67,%ecx,%edx
movzwl %dx,%esi
shr    $0xa,%edx
shr    $0xf,%esi
add    %dl,%sil
movzbl %sil,%edx
add    %edx,%edx
lea    (%rdx,%rdx,4),%edx
sub    %dl,%cl
movsbl %cl,%esi
add    $0x7,%al
movsbl %al,%eax
imul   $0x67,%eax,%ecx
movzwl %cx,%edx
shr    $0xa,%ecx
shr    $0xf,%edx
add    %cl,%dl
movzbl %dl,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
movsbl %al,%ebp
lea    0xdf0(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Please enter a integer with four digits: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"%d \00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 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* %1)
%9 = load i32, i32* %1
%10 = sdiv i32 %9, 1000
store i32 %10, i32* %2
%11 = load i32, i32* %1
%12 = srem i32 %11, 1000
store i32 %12, i32* %1
%13 = load i32, i32* %1
%14 = sdiv i32 %13, 100
store i32 %14, i32* %3
%15 = load i32, i32* %1
%16 = srem i32 %15, 100
store i32 %16, i32* %1
%17 = load i32, i32* %1
%18 = sdiv i32 %17, 10
store i32 %18, i32* %4
%19 = load i32, i32* %1
%20 = srem i32 %19, 10
store i32 %20, i32* %1
%21 = load i32, i32* %1
store i32 %21, i32* %5
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 7
%24 = srem i32 %23, 10
store i32 %24, i32* %2
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 7
%27 = srem i32 %26, 10
store i32 %27, i32* %3
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 7
%30 = srem i32 %29, 10
store i32 %30, i32* %4
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 7
%33 = srem i32 %32, 10
store i32 %33, i32* %5
%34 = load i32, i32* %2
store i32 %34, i32* %6
%35 = load i32, i32* %4
store i32 %35, i32* %2
%36 = load i32, i32* %6
store i32 %36, i32* %4
%37 = load i32, i32* %3
store i32 %37, i32* %6
%38 = load i32, i32* %5
store i32 %38, i32* %3
%39 = load i32, i32* %6
store i32 %39, i32* %5
%40 = load i32, i32* %2
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %3
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %4
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %44)
%46 = load i32, i32* %5
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %46)
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"Please enter a integer with four digits: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"%d \00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) 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* %1)
%5 = load i32, i32* %1
%6 = sdiv i32 %5, 1000
%7 = srem i32 %5, 1000
%8 = trunc i32 %7 to i16
%9 = sdiv i16 %8, 100
%10 = srem i16 %8, 100
%11 = trunc i16 %10 to i8
%12 = sdiv i8 %11, 10
%13 = srem i8 %11, 10
%14 = sext i8 %13 to i32
store i32 %14, i32* %1
%15 = add nsw i32 %6, 7
%16 = srem i32 %15, 10
%17 = trunc i16 %9 to i8
%18 = add nsw i8 %17, 7
%19 = srem i8 %18, 10
%20 = sext i8 %19 to i32
%21 = add nsw i8 %12, 7
%22 = srem i8 %21, 10
%23 = sext i8 %22 to i32
%24 = add nsw i8 %13, 7
%25 = srem i8 %24, 10
%26 = sext i8 %25 to i32
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %20)
ret void
}