#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;
  swp = num1;
  num1 = num3;
  num3 = swp;
  swp = num2;
  num2 = num4;
  num4 = swp;
  num1 = num1 - 7;
  num2 = num2 - 7;
  num3 = num3 - 7;
  num4 = num4 - 7;
  if (num1 < 0)
    num1 = num1 + 10;
  if (num2 < 0)
    num2 = num2 + 10;
  if (num3 < 0)
    num3 = num3 + 10;
  if (num4 < 0)
    num4 = num4 + 10;
  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
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),%eax
sub    $0x7,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x7,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x7,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x7,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    11fb <main+0xdb>
mov    -0x8(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    120e <main+0xee>
mov    -0xc(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    1221 <main+0x101>
mov    -0x10(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1234 <main+0x114>
mov    -0x14(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xdbc(%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),%r8
imul   $0x10624dd3,%r8,%rax
mov    %rax,%r9
shr    $0x3f,%r9
sar    $0x26,%rax
lea    (%rax,%r9,1),%ecx
imul   $0x3e8,%ecx,%edx
mov    %r8d,%r10d
sub    %edx,%r10d
movswl %r10w,%edx
imul   $0x147b,%edx,%ebx
mov    %ebx,%edx
shr    $0x1f,%edx
sar    $0x13,%ebx
lea    (%rbx,%rdx,1),%esi
imul   $0x64,%esi,%esi
mov    %r10d,%edi
sub    %esi,%edi
movsbl %dil,%esi
imul   $0x67,%esi,%esi
movzwl %si,%esi
movswl %si,%ebp
shr    $0xf,%esi
shr    $0xa,%ebp
add    %sil,%bpl
movsbl %bpl,%esi
movzbl %sil,%ebp
add    %ebp,%ebp
lea    0x0(%rbp,%rbp,4),%ebp
mov    %edi,%ecx
sub    %bpl,%cl
movsbl %cl,%ecx
lea    -0x7(%rsi),%ebp
add    $0x3,%esi
cmp    $0x46,%di
cmovge %ebp,%esi
lea    -0x7(%rcx),%edi
lea    0x3(%rcx),%r14d
cmp    $0x7,%cl
cmovge %edi,%r14d
cmp    $0x1b58,%r8
mov    %ecx,0x4(%rsp)
lea    0x3(%rax,%r9,1),%ecx
lea    -0x7(%rax,%r9,1),%ebp
cmovl  %ecx,%ebp
cmp    $0x2bc,%r10d
lea    0x3(%rbx,%rdx,1),%eax
lea    -0x7(%rbx,%rdx,1),%ebx
cmovl  %eax,%ebx
lea    0xe2b(%rip),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %ebx,%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
store i32 %22, i32* %6
%23 = load i32, i32* %4
store i32 %23, i32* %2
%24 = load i32, i32* %6
store i32 %24, i32* %4
%25 = load i32, i32* %3
store i32 %25, i32* %6
%26 = load i32, i32* %5
store i32 %26, i32* %3
%27 = load i32, i32* %6
store i32 %27, i32* %5
%28 = load i32, i32* %2
%29 = sub nsw i32 %28, 7
store i32 %29, i32* %2
%30 = load i32, i32* %3
%31 = sub nsw i32 %30, 7
store i32 %31, i32* %3
%32 = load i32, i32* %4
%33 = sub nsw i32 %32, 7
store i32 %33, i32* %4
%34 = load i32, i32* %5
%35 = sub nsw i32 %34, 7
store i32 %35, i32* %5
%36 = load i32, i32* %2
%37 = icmp slt i32 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %0
%39 = load i32, i32* %2
%40 = add nsw i32 %39, 10
store i32 %40, i32* %2
br label %41
41: ; preds = %38, %0
%42 = load i32, i32* %3
%43 = icmp slt i32 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %41
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 10
store i32 %46, i32* %3
br label %47
47: ; preds = %44, %41
%48 = load i32, i32* %4
%49 = icmp slt i32 %48, 0
br i1 %49, label %50, label %53
50: ; preds = %47
%51 = load i32, i32* %4
%52 = add nsw i32 %51, 10
store i32 %52, i32* %4
br label %53
53: ; preds = %50, %47
%54 = load i32, i32* %5
%55 = icmp slt i32 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %53
%57 = load i32, i32* %5
%58 = add nsw i32 %57, 10
store i32 %58, i32* %5
br label %59
59: ; preds = %56, %53
%60 = load i32, i32* %2
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %60)
%62 = load i32, i32* %3
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %62)
%64 = load i32, i32* %4
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %64)
%66 = load i32, i32* %5
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %66)
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 = sext i16 %9 to i32
%11 = srem i16 %8, 100
%12 = trunc i16 %11 to i8
%13 = sdiv i8 %12, 10
%14 = sext i8 %13 to i32
%15 = srem i8 %12, 10
%16 = sext i8 %15 to i32
store i32 %16, i32* %1
%17 = icmp slt i16 %11, 70
%18 = select i1 %17, i32 3, i32 -7
%19 = add nsw i32 %18, %14
%20 = icmp slt i8 %15, 7
%21 = select i1 %20, i32 3, i32 -7
%22 = add nsw i32 %21, %16
%23 = icmp slt i32 %5, 7000
%24 = select i1 %23, i32 3, i32 -7
%25 = add nsw i32 %24, %6
%26 = icmp slt i32 %7, 700
%27 = select i1 %26, i32 3, i32 -7
%28 = add nsw i32 %27, %10
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %22)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %25)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %28)
ret void
}