#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 */
typedef struct TYPE_6__ TYPE_2__;
typedef struct TYPE_5__ TYPE_1__;

/* Type definitions */
struct TYPE_5__ {
  int quot;
  int rem;
};
typedef TYPE_1__ ldiv_t;
struct TYPE_6__ {
  int quot;
  int rem;
};
typedef TYPE_2__ div_t;

/* Variables and functions */
TYPE_2__ div(int, int);
TYPE_1__ ldiv(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a = 10;
  int b = 5;
  div_t c = div(a, b);
  printf("%d\n", c.quot);
  printf("%d\n", c.rem);
  c = div(23, 12);
  printf("%d\n", c.quot);
  printf("%d\n", c.rem);
  ldiv_t ld = ldiv(2222, 13);
  printf("%ld\n", ld.quot);
  printf("%ld\n", ld.rem);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <div@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
mov    $0x17,%edi
mov    $0xc,%esi
call   1050 <div@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
mov    $0x8ae,%edi
mov    $0xd,%esi
call   1040 <ldiv@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%esi
lea    0xe34(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xe25(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xa,%edi
mov    $0x5,%esi
call   1050 <div@plt>
mov    %rax,%rbx
shr    $0x20,%rbx
lea    0xeaf(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    $0x17,%edi
mov    $0xc,%esi
call   1050 <div@plt>
mov    %rax,%rbx
shr    $0x20,%rbx
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    $0x8ae,%edi
mov    $0xd,%esi
call   1040 <ldiv@plt>
mov    %rax,%rbx
shr    $0x20,%rbx
lea    0xe58(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.TYPE_6__ = type { i32, i32 }
%struct.TYPE_5__ = type { i32, i32 }
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.TYPE_6__
%5 = alloca %struct.TYPE_6__
%6 = alloca %struct.TYPE_5__
store i32 0, i32* %1
store i32 10, i32* %2
store i32 5, i32* %3
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = call i64 @div(i32 %7, i32 %8)
%10 = bitcast %struct.TYPE_6__* %4 to i64*
store i64 %9, i64* %10
%11 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %4, i32 0, i32 0
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %4, i32 0, i32 1
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = call i64 @div(i32 23, i32 12)
%18 = bitcast %struct.TYPE_6__* %5 to i64*
store i64 %17, i64* %18
%19 = bitcast %struct.TYPE_6__* %4 to i8*
%20 = bitcast %struct.TYPE_6__* %5 to i8*
%21 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %4, i32 0, i32 0
%22 = load i32, i32* %21
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %4, i32 0, i32 1
%25 = load i32, i32* %24
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = call i64 @ldiv(i32 2222, i32 13)
%28 = bitcast %struct.TYPE_5__* %6 to i64*
store i64 %27, i64* %28
%29 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %6, i32 0, i32 0
%30 = load i32, i32* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %6, i32 0, i32 1
%33 = load i32, i32* %32
%34 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = tail call i64 @div(i32 10, i32 5)
%2 = trunc i64 %1 to i32
%3 = lshr i64 %1, 32
%4 = trunc i64 %3 to i32
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%7 = tail call i64 @div(i32 23, i32 12)
%8 = trunc i64 %7 to i32
%9 = lshr i64 %7, 32
%10 = trunc i64 %9 to i32
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%13 = tail call i64 @ldiv(i32 2222, i32 13)
%14 = trunc i64 %13 to i32
%15 = lshr i64 %13, 32
%16 = trunc i64 %15 to i32
%17 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %16)
ret i32 0
}