#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() {
  int j, d, s;
  int n;
  printf("Podaj liczbę w 10: ");
  scanf("%d", &n);
  j = n % 7;
  n = (n - j) / 7;
  d = n % 7;
  n = (n - d) / 7;
  s = n % 7;
  printf("\n%d%d%d", s, d, j);
  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    0xed6(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x14(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x14(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xe6c(%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    0xee4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movslq 0x4(%rsp),%rax
imul   $0xffffffff92492493,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x2,%ecx
add    %edx,%ecx
lea    0x0(,%rcx,8),%edx
movslq %ecx,%rsi
sub    %edx,%ecx
add    %eax,%ecx
imul   $0xffffffff92492493,%rsi,%rdx
shr    $0x20,%rdx
add    %esi,%edx
mov    %edx,%edi
shr    $0x1f,%edi
sar    $0x2,%edx
add    %edi,%edx
lea    0x0(,%rdx,8),%edi
sub    %edi,%edx
add    %esi,%edx
imul   $0x5397829d,%rax,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
shr    $0x20,%rax
sar    $0x4,%eax
add    %esi,%eax
mov    %eax,0x4(%rsp)
cltq
imul   $0xffffffff92492493,%rax,%rsi
shr    $0x20,%rsi
add    %eax,%esi
mov    %esi,%edi
shr    $0x1f,%edi
sar    $0x2,%esi
add    %edi,%esi
lea    0x0(,%rsi,8),%edi
sub    %edi,%esi
add    %eax,%esi
lea    0xe43(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Podaj liczb\C4\99 w 10: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [8 x i8] c"\0A%d%d%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%8 = load i32, i32* %5
%9 = srem i32 %8, 7
store i32 %9, i32* %2
%10 = load i32, i32* %5
%11 = load i32, i32* %2
%12 = sub nsw i32 %10, %11
%13 = sdiv i32 %12, 7
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = srem i32 %14, 7
store i32 %15, i32* %3
%16 = load i32, i32* %5
%17 = load i32, i32* %3
%18 = sub nsw i32 %16, %17
%19 = sdiv i32 %18, 7
store i32 %19, i32* %5
%20 = load i32, i32* %5
%21 = srem i32 %20, 7
store i32 %21, i32* %4
%22 = load i32, i32* %4
%23 = load i32, i32* %3
%24 = load i32, i32* %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32 %23, i32 %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Podaj liczb\C4\99 w 10: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [8 x i8] c"\0A%d%d%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 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 = srem i32 %5, 7
%7 = sdiv i32 %5, 7
%8 = srem i32 %7, 7
%9 = sdiv i32 %5, 49
store i32 %9, i32* %1
%10 = srem i32 %9, 7
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %10, i32 %8, i32 %6)
ret i32 0
}