#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 *, int *, ...);
int main() {
  int a[10] = {5, 8, 11, 16, 20, 25, 35, 48, 55, 68};
  int find;
  printf("\n=========while Loop implementation=========\n");
  printf("\nEnter interger which you want to find\n");
  scanf("%d", &find);
  int i = 0;
  while (a[i] != find && i < 10) {
    i++;
  }
  if (a[i] == find) {
    printf("\nNumber is found at %d position \n", i);
  } else {
    printf("\nNot Found\n");
  }
  printf("\n=========do-while Loop implementation=========\n");
  int x, y, temp;
  printf("\nEnter two number\n");
  scanf("%d %d", &x, &y);
  do {
    temp = x % y;
    x = y;
    y = temp;
  } while (y > 0);
  printf("\nGCD of Entered number is %d\n", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf7c(%rip),%rdi
lea    -0x34(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0x38(%rbp)
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
xor    %eax,%eax
cmp    -0x34(%rbp),%ecx
mov    %al,-0x45(%rbp)
je     11a9 <main+0x79>
cmpl   $0xa,-0x38(%rbp)
setl   %al
mov    %al,-0x45(%rbp)
mov    -0x45(%rbp),%al
test   $0x1,%al
jne    11b9 <main+0x89>
jmp    11c7 <main+0x97>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1189 <main+0x59>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x34(%rbp),%eax
jne    11ee <main+0xbe>
mov    -0x38(%rbp),%esi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11fc <main+0xcc>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x3c(%rbp),%rsi
lea    -0x40(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x3c(%rbp),%eax
cltd
idivl  -0x40(%rbp)
mov    %edx,-0x44(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jg     122e <main+0xfe>
mov    -0x3c(%rbp),%esi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xf32(%rip),%rdi
call   1030 <puts@plt>
lea    0xf53(%rip),%rdi
call   1030 <puts@plt>
lea    0xef9(%rip),%rdi
xor    %ebx,%ebx
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe97(%rip),%rax
mov    0xc(%rsp),%ecx
nopl   (%rax)
mov    (%rax),%edx
lea    0x1(%rbx),%rsi
cmp    %ecx,%edx
je     1187 <main+0x57>
add    $0x4,%rax
cmp    $0xa,%rbx
mov    %rsi,%rbx
jb     1170 <main+0x40>
cmp    %ecx,%edx
jne    119e <main+0x6e>
add    $0xffffffff,%esi
lea    0xe93(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11aa <main+0x7a>
lea    0xf1d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1c(%rip),%rdi
call   1030 <puts@plt>
lea    0xf40(%rip),%rdi
call   1030 <puts@plt>
lea    0xe81(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0x4(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x8(%rsp),%esi
mov    0x4(%rsp),%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %esi,%eax
mov    %edx,%esi
cltd
idiv   %esi
test   %edx,%edx
jg     11f0 <main+0xc0>
mov    %esi,0x8(%rsp)
mov    %edx,0x4(%rsp)
lea    0xe46(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [10 x i32] [i32 5, i32 8, i32 11, i32 16, i32 20, i32 25, i32 35, i32 48, i32 55, i32 68]
@.str = [46 x i8] c"\0A=========while Loop implementation=========\0A\00"
@.str.1 = [40 x i8] c"\0AEnter interger which you want to find\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [34 x i8] c"\0ANumber is found at %d position \0A\00"
@.str.4 = [12 x i8] c"\0ANot Found\0A\00"
@.str.5 = [49 x i8] c"\0A=========do-while Loop implementation=========\0A\00"
@.str.6 = [19 x i8] c"\0AEnter two number\0A\00"
@.str.7 = [6 x i8] c"%d %d\00"
@.str.8 = [30 x i8] c"\0AGCD of Entered number is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [10 x i32]* %2 to i8*
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
store i32 0, i32* %4
br label %12
12: ; preds = %24, %0
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = load i32, i32* %3
%18 = icmp ne i32 %16, %17
br i1 %18, label %19, label %22
19: ; preds = %12
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 10
br label %22
22: ; preds = %19, %12
%23 = phi i1 [ false, %12 ], [ %21, %19 ]
br i1 %23, label %24, label %27
24: ; preds = %22
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %12
27: ; preds = %22
%28 = load i32, i32* %4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = load i32, i32* %3
%33 = icmp eq i32 %31, %32
br i1 %33, label %34, label %37
34: ; preds = %27
%35 = load i32, i32* %4
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %35)
br label %39
37: ; preds = %27
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %39
39: ; preds = %37, %34
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0))
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%42 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32* %5, i32* %6)
br label %43
43: ; preds = %49, %39
%44 = load i32, i32* %5
%45 = load i32, i32* %6
%46 = srem i32 %44, %45
store i32 %46, i32* %7
%47 = load i32, i32* %6
store i32 %47, i32* %5
%48 = load i32, i32* %7
store i32 %48, i32* %6
br label %49
49: ; preds = %43
%50 = load i32, i32* %6
%51 = icmp sgt i32 %50, 0
br i1 %51, label %43, label %52
52: ; preds = %49
%53 = load i32, i32* %5
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i32 %53)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [10 x i32] [i32 5, i32 8, i32 11, i32 16, i32 20, i32 25, i32 35, i32 48, i32 55, i32 68]
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [34 x i8] c"\0ANumber is found at %d position \0A\00"
@.str.7 = [6 x i8] c"%d %d\00"
@.str.8 = [30 x i8] c"\0AGCD of Entered number is %d\0A\00"
@str = [45 x i8] c"\0A=========while Loop implementation=========\00"
@str.9 = [39 x i8] c"\0AEnter interger which you want to find\00"
@str.10 = [11 x i8] c"\0ANot Found\00"
@str.11 = [48 x i8] c"\0A=========do-while Loop implementation=========\00"
@str.12 = [18 x i8] c"\0AEnter two number\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.9, i64 0, i64 0))
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
br label %9
9: ; preds = %9, %0
%10 = phi i64 [ %16, %9 ], [ 0, %0 ]
%11 = getelementptr inbounds [10 x i32], [10 x i32]* @__const.main.a, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = icmp ne i32 %12, %8
%14 = icmp ult i64 %10, 10
%15 = select i1 %13, i1 %14, i1 false
%16 = add nuw nsw i64 %10, 1
br i1 %15, label %9, label %17
17: ; preds = %9
%18 = icmp eq i32 %12, %8
br i1 %18, label %19, label %22
19: ; preds = %17
%20 = trunc i64 %10 to i32
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %20)
br label %24
22: ; preds = %17
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.10, i64 0, i64 0))
br label %24
24: ; preds = %22, %19
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.11, i64 0, i64 0))
%26 = bitcast i32* %2 to i8*
%27 = bitcast i32* %3 to i8*
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.12, i64 0, i64 0))
%29 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32* %2, i32* %3)
%30 = load i32, i32* %2
%31 = load i32, i32* %3
br label %32
32: ; preds = %32, %24
%33 = phi i32 [ %35, %32 ], [ %31, %24 ]
%34 = phi i32 [ %33, %32 ], [ %30, %24 ]
%35 = srem i32 %34, %33
%36 = icmp sgt i32 %35, 0
br i1 %36, label %32, label %37
37: ; preds = %32
store i32 %33, i32* %2
store i32 %35, i32* %3
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i32 %33)
ret i32 0
}