#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 */
scalar_t__ ceil(double);
scalar_t__ floor(double);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(void) {
  int a, b, quociente, resto;
  scanf("%d %d", &a, &b);
  if (b > 0) {
    quociente = (int)floor((double)a / b);
  } else {
    quociente = (int)ceil((double)a / b);
  }
  resto = a - quociente * b;
  printf("%d %d\n", quociente, resto);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jle    1188 <main+0x48>
cvtsi2sdl -0x8(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1060 <floor@plt>
mov    %eax,-0x10(%rbp)
jmp    119e <main+0x5e>
cvtsi2sdl -0x8(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1030 <ceil@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
imul   -0xc(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe4c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
mov    (%rsp),%eax
cvtsi2sdl 0x4(%rsp),%xmm0
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
test   %eax,%eax
jle    1171 <main+0x31>
call   1060 <floor@plt>
jmp    1176 <main+0x36>
call   1030 <ceil@plt>
mov    0x4(%rsp),%edx
mov    (%rsp),%ecx
imul   %eax,%ecx
sub    %ecx,%edx
lea    0xe7d(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [7 x i8] c"%d %d\0A\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 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%7 = load i32, i32* %3
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %0
%10 = load i32, i32* %2
%11 = sitofp i32 %10 to double
%12 = load i32, i32* %3
%13 = sitofp i32 %12 to double
%14 = fdiv double %11, %13
%15 = call i64 @floor(double %14)
%16 = trunc i64 %15 to i32
store i32 %16, i32* %4
br label %25
17: ; preds = %0
%18 = load i32, i32* %2
%19 = sitofp i32 %18 to double
%20 = load i32, i32* %3
%21 = sitofp i32 %20 to double
%22 = fdiv double %19, %21
%23 = call i64 @ceil(double %22)
%24 = trunc i64 %23 to i32
store i32 %24, i32* %4
br label %25
25: ; preds = %17, %9
%26 = load i32, i32* %2
%27 = load i32, i32* %4
%28 = load i32, i32* %3
%29 = mul nsw i32 %27, %28
%30 = sub nsw i32 %26, %29
store i32 %30, i32* %5
%31 = load i32, i32* %4
%32 = load i32, i32* %5
%33 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %31, i32 %32)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
%8 = load i32, i32* %1
%9 = sitofp i32 %8 to double
%10 = sitofp i32 %6 to double
%11 = fdiv double %9, %10
br i1 %7, label %12, label %14
12: ; preds = %0
%13 = call i64 @floor(double %11)
br label %16
14: ; preds = %0
%15 = call i64 @ceil(double %11)
br label %16
16: ; preds = %14, %12
%17 = phi i64 [ %13, %12 ], [ %15, %14 ]
%18 = trunc i64 %17 to i32
%19 = load i32, i32* %1
%20 = load i32, i32* %2
%21 = mul nsw i32 %20, %18
%22 = sub nsw i32 %19, %21
%23 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %18, i32 %22)
ret i32 0
}