#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 *, unsigned int *, unsigned int *);
int main() {
  unsigned a, b;
  printf("Enter two +ve integers:\n");
  scanf(" %u %u%*c", &a, &b);
  printf("%u / %u = %u\n%u %% %u = %u\n", a, b, a / b, a, b, a % b);
  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    0xed5(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
mov    %eax,%ecx
mov    -0x8(%rbp),%r8d
mov    -0xc(%rbp),%r9d
mov    -0x8(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
mov    %edx,%eax
mov    -0x10(%rbp),%edx
lea    0xea3(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xeeb(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1050 <scanf@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%r9d
mov    %esi,%eax
xor    %edx,%edx
div    %r9d
mov    %edx,(%rsp)
lea    0xe9a(%rip),%rdi
mov    %r9d,%edx
mov    %eax,%ecx
mov    %esi,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Enter two +ve integers:\0A\00"
@.str.1 = [10 x i8] c" %u %u%*c\00"
@.str.2 = [28 x i8] c"%u / %u = %u\0A%u %% %u = %u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = udiv i32 %8, %9
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = urem i32 %13, %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %7, i32 %10, i32 %11, i32 %12, i32 %15)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c" %u %u%*c\00"
@.str.2 = [28 x i8] c"%u / %u = %u\0A%u %% %u = %u\0A\00"
@str = [24 x i8] c"Enter two +ve integers:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = udiv i32 %7, %8
%10 = urem i32 %7, %8
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8, i32 %9, i32 %7, i32 %8, i32 %10)
ret i32 0
}