#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 *, ...);
void program3() {
  long int num1 = 0;
  int num2 = 0, remainder = 0, quotient = 0;
  printf("Enter a LONG number: ");
  scanf("%ld", &num1);
a:
  printf("Enter a multiple of 2 NOT bigger than previous number: ");
  scanf("%d", &num2);
  if (num2 % 2 == 1) {
    printf("It is NOT a multiple of 2!\n\n");
    goto a;
  } else if (num1 < num2) {
    printf("It is BIGGER than Numerator!\n\n");
    goto a;
  }
  remainder = num1 % num2;
  while (num1 >= 0) {
    quotient++;
    num1 = num1 - num2;
  }
  printf("\nThe quotient is %d and the remainder is %d\n\n", quotient - 1,
         remainder);
}


x86 assembly (clang, -O0):
<program3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    11ac <program3+0x8c>
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1165 <program3+0x45>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmp    %rcx,%rax
jge    11d0 <program3+0xb0>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1165 <program3+0x45>
jmp    11d5 <program3+0xb5>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jl     120f <program3+0xef>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    11e7 <program3+0xc7>
mov    -0x14(%rbp),%esi
sub    $0x1,%esi
mov    -0x10(%rbp),%edx
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<program3>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xeab(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xea4(%rip),%r14
lea    0xed5(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xf18(%rip),%rbx
lea    0xef3(%rip),%r13
jmp    11a5 <program3+0x75>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
call   1030 <puts@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movslq 0x4(%rsp),%rcx
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
and    $0xfffffffe,%eax
mov    %ecx,%edx
sub    %eax,%edx
mov    %rbx,%rdi
cmp    $0x1,%edx
je     11a0 <program3+0x70>
mov    0x8(%rsp),%rax
mov    %r13,%rdi
cmp    %rcx,%rax
jl     11a0 <program3+0x70>
mov    $0xffffffff,%esi
test   %rax,%rax
js     120d <program3+0xdd>
mov    %rax,%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%esi
sub    %rcx,%rdx
jns    1200 <program3+0xd0>
mov    %rdx,0x8(%rsp)
mov    %rcx,%rdx
or     %rax,%rdx
shr    $0x20,%rdx
je     1220 <program3+0xf0>
cqto
idiv   %rcx
jmp    1224 <program3+0xf4>
xor    %edx,%edx
div    %ecx
lea    0xe2a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Enter a LONG number: \00"
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [56 x i8] c"Enter a multiple of 2 NOT bigger than previous number: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [29 x i8] c"It is NOT a multiple of 2!\0A\0A\00"
@.str.5 = [31 x i8] c"It is BIGGER than Numerator!\0A\0A\00"
@.str.6 = [46 x i8] c"\0AThe quotient is %d and the remainder is %d\0A\0A\00"
define void @program3() {
%1 = alloca i64
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i64 0, i64* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %1)
br label %7
7: ; preds = %20, %13, %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = srem i32 %10, 2
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
br label %7
15: ; preds = %7
%16 = load i64, i64* %1
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = icmp slt i64 %16, %18
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
br label %7
22: ; preds = %15
br label %23
23: ; preds = %22
%24 = load i64, i64* %1
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = srem i64 %24, %26
%28 = trunc i64 %27 to i32
store i32 %28, i32* %3
br label %29
29: ; preds = %32, %23
%30 = load i64, i64* %1
%31 = icmp sge i64 %30, 0
br i1 %31, label %32, label %39
32: ; preds = %29
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
%35 = load i64, i64* %1
%36 = load i32, i32* %2
%37 = sext i32 %36 to i64
%38 = sub nsw i64 %35, %37
store i64 %38, i64* %1
br label %29
39: ; preds = %29
%40 = load i32, i32* %4
%41 = sub nsw i32 %40, 1
%42 = load i32, i32* %3
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0), i32 %41, i32 %42)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"Enter a LONG number: \00"
@.str.1 = [4 x i8] c"%ld\00"
@.str.2 = [56 x i8] c"Enter a multiple of 2 NOT bigger than previous number: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.6 = [46 x i8] c"\0AThe quotient is %d and the remainder is %d\0A\0A\00"
@str = [30 x i8] c"It is BIGGER than Numerator!\0A\00"
@str.7 = [28 x i8] c"It is NOT a multiple of 2!\0A\00"
define void @program3() {
%1 = alloca i64
%2 = alloca i32
%3 = bitcast i64* %1 to i8*
store i64 0, i64* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %1)
br label %7
7: ; preds = %13, %0
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = srem i32 %10, 2
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %16
13: ; preds = %7, %16
%14 = phi i8* [ getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0), %16 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @str.7, i64 0, i64 0), %7 ]
%15 = call i32 @puts(i8* dereferenceable(1) %14)
br label %7
16: ; preds = %7
%17 = load i64, i64* %1
%18 = sext i32 %10 to i64
%19 = icmp slt i64 %17, %18
br i1 %19, label %13, label %20
20: ; preds = %16
%21 = sext i32 %10 to i64
%22 = icmp sgt i64 %17, -1
br i1 %22, label %23, label %30
23: ; preds = %20, %23
%24 = phi i32 [ %26, %23 ], [ 0, %20 ]
%25 = phi i64 [ %27, %23 ], [ %17, %20 ]
%26 = add nuw nsw i32 %24, 1
%27 = sub nsw i64 %25, %21
%28 = icmp sgt i64 %27, -1
br i1 %28, label %23, label %29
29: ; preds = %23
store i64 %27, i64* %1
br label %30
30: ; preds = %29, %20
%31 = phi i32 [ %24, %29 ], [ -1, %20 ]
%32 = srem i64 %17, %21
%33 = trunc i64 %32 to i32
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0), i32 %31, i32 %33)
ret void
}