#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 dec_to_bin(int /*<<< orphan*/);
int /*<<< orphan*/ gcd(int, int);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, int *);
int main() {
  int num, div, checker, checker1;
  printf("Please inert 2 numbers : ");
  checker = scanf("%d", &num);
  checker1 = scanf("%d", &div);
  if (checker != 1 || checker1 != 1) {
    printf("Error");
    return 1;
  }
  if (num < 0 || div <= 0) {
    printf("Error");
    return 1;
  }
  if (div == 0 || num == 0) {
    printf("Error");
    return 1;
  } else {
    printf("%d", dec_to_bin(gcd(num, div)));
    return 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    %eax,-0x10(%rbp)
lea    0xea3(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    1197 <main+0x57>
cmpl   $0x1,-0x14(%rbp)
je     11b1 <main+0x71>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1236 <main+0xf6>
cmpl   $0x0,-0x8(%rbp)
jl     11c5 <main+0x85>
cmpl   $0x0,-0xc(%rbp)
jg     11df <main+0x9f>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1236 <main+0xf6>
cmpl   $0x0,-0xc(%rbp)
je     11f3 <main+0xb3>
cmpl   $0x0,-0x8(%rbp)
jne    120d <main+0xcd>
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1236 <main+0xf6>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1060 <gcd@plt>
mov    %eax,%edi
call   1030 <dec_to_bin@plt>
mov    %eax,%esi
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec2(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %eax,%ebp
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
cmp    $0x1,%ebp
jne    11af <main+0x6f>
cmp    $0x1,%eax
jne    11af <main+0x6f>
mov    0x4(%rsp),%edi
test   %edi,%edi
js     11af <main+0x6f>
mov    (%rsp),%esi
test   %esi,%esi
jle    11af <main+0x6f>
test   %edi,%edi
je     11af <main+0x6f>
call   1060 <gcd@plt>
mov    %eax,%edi
call   1030 <dec_to_bin@plt>
lea    0xe78(%rip),%rdi
xor    %ebx,%ebx
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11c2 <main+0x82>
lea    0xe67(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Please inert 2 numbers : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"Error\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 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 %7, i32* %4
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
store i32 %8, i32* %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 1
br i1 %10, label %14, label %11
11: ; preds = %0
%12 = load i32, i32* %5
%13 = icmp ne i32 %12, 1
br i1 %13, label %14, label %16
14: ; preds = %11, %0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %38
16: ; preds = %11
%17 = load i32, i32* %2
%18 = icmp slt i32 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load i32, i32* %3
%21 = icmp sle i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %19, %16
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %38
24: ; preds = %19
%25 = load i32, i32* %3
%26 = icmp eq i32 %25, 0
br i1 %26, label %30, label %27
27: ; preds = %24
%28 = load i32, i32* %2
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %27, %24
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %38
32: ; preds = %27
%33 = load i32, i32* %2
%34 = load i32, i32* %3
%35 = call i32 @gcd(i32 %33, i32 %34)
%36 = call i32 @dec_to_bin(i32 %35)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %36)
store i32 0, i32* %1
br label %38
38: ; preds = %32, %30, %22, %14
%39 = load i32, i32* %1
ret i32 %39
}

LLVM IR (-O2):
@.str = [26 x i8] c"Please inert 2 numbers : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"Error\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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = icmp ne i32 %6, 1
%9 = icmp ne i32 %7, 1
%10 = or i1 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %29
13: ; preds = %0
%14 = load i32, i32* %1
%15 = icmp slt i32 %14, 0
%16 = load i32, i32* %2
%17 = icmp slt i32 %16, 1
%18 = select i1 %15, i1 true, i1 %17
br i1 %18, label %19, label %21
19: ; preds = %13
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %29
21: ; preds = %13
%22 = icmp eq i32 %14, 0
br i1 %22, label %23, label %25
23: ; preds = %21
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %29
25: ; preds = %21
%26 = call i32 @gcd(i32 %14, i32 %16)
%27 = call i32 @dec_to_bin(i32 %26)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %25, %23, %19, %11
%30 = phi i32 [ 1, %11 ], [ 1, %19 ], [ 1, %23 ], [ 0, %25 ]
ret i32 %30
}