#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_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int quot;
  int rem;
};
typedef TYPE_1__ div_t;

/* Variables and functions */
TYPE_1__ div(int, int);
int mydiv();
int /*<<< orphan*/ printf(char *, int, ...);
int main() {
  div_t result = div(99, 99);
  int x = mydiv();
  printf("\n\nQuotient %d Remainder %d", result.quot, result.rem);
  printf("\nValue returned by mydiv is %d\n\n", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x63,%esi
mov    %esi,%edi
call   1040 <div@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <mydiv@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x63,%edi
mov    $0x63,%esi
call   1040 <div@plt>
mov    %rax,%r14
mov    %rax,%rbx
shr    $0x20,%rbx
xor    %eax,%eax
call   1050 <mydiv@plt>
mov    %eax,%ebp
lea    0xea3(%rip),%rdi
mov    %r14d,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeab(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32 }
@.str = [27 x i8] c"\0A\0AQuotient %d Remainder %d\00"
@.str.1 = [33 x i8] c"\0AValue returned by mydiv is %d\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.TYPE_3__
%3 = alloca i32
store i32 0, i32* %1
%4 = call i64 @div(i32 99, i32 99)
%5 = bitcast %struct.TYPE_3__* %2 to i64*
store i64 %4, i64* %5
%6 = call i32 (...) @mydiv()
store i32 %6, i32* %3
%7 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 0
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 1
%10 = load i32, i32* %9
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %10)
%12 = load i32, i32* %3
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"\0A\0AQuotient %d Remainder %d\00"
@.str.1 = [33 x i8] c"\0AValue returned by mydiv is %d\0A\0A\00"
define i32 @main() {
%1 = tail call i64 @div(i32 99, i32 99)
%2 = trunc i64 %1 to i32
%3 = lshr i64 %1, 32
%4 = trunc i64 %3 to i32
%5 = tail call i32 (...) @mydiv()
%6 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %4)
%7 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}