#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 */
long long div_rem(char *, long long, char *);
int /*<<< orphan*/ printf(char *, char *, long long);
int /*<<< orphan*/ scanf(char *, char *, long long *);
int main() {
  char a[1000], b[1000];
  long long int d, receiver;
  scanf("%s%lld", a, &d);
  receiver = div_rem(a, d, b);
  div_rem(a, d, b);
  printf("%s\n%lld", b, receiver);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rsi
lea    0xeb0(%rip),%rdi
lea    -0x7e8(%rbp),%rdx
call   1050 <scanf@plt>
lea    -0x3f0(%rbp),%rdi
mov    -0x7e8(%rbp),%rsi
lea    -0x7e0(%rbp),%rdx
call   1040 <div_rem@plt>
mov    %rax,-0x7f0(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    -0x7e8(%rbp),%rsi
lea    -0x7e0(%rbp),%rdx
call   1040 <div_rem@plt>
lea    -0x7e0(%rbp),%rsi
mov    -0x7f0(%rbp),%rdx
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x7f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x7f0,%rsp
lea    0xebd(%rip),%rdi
lea    0x400(%rsp),%r14
lea    0x8(%rsp),%rdx
mov    %r14,%rsi
call   1050 <scanf@plt>
mov    0x8(%rsp),%rsi
lea    0x10(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rdx
call   1040 <div_rem@plt>
mov    %rax,%rbx
mov    0x8(%rsp),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
call   1040 <div_rem@plt>
lea    0xe80(%rip),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x7f0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%s%lld\00"
@.str.1 = [8 x i8] c"%s\0A%lld\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i8]
%3 = alloca [1000 x i8]
%4 = alloca i64
%5 = alloca i64
store i32 0, i32* %1
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %6, i64* %4)
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%9 = load i64, i64* %4
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%11 = call i64 @div_rem(i8* %8, i64 %9, i8* %10)
store i64 %11, i64* %5
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%13 = load i64, i64* %4
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%15 = call i64 @div_rem(i8* %12, i64 %13, i8* %14)
%16 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%17 = load i64, i64* %5
%18 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %16, i64 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s%lld\00"
@.str.1 = [8 x i8] c"%s\0A%lld\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = alloca [1000 x i8]
%3 = alloca i64
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%6 = bitcast i64* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %4, i64* %3)
%8 = load i64, i64* %3
%9 = call i64 @div_rem(i8* %4, i64 %8, i8* %5)
%10 = load i64, i64* %3
%11 = call i64 @div_rem(i8* %4, i64 %10, i8* %5)
%12 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %5, i64 %9)
ret i32 0
}