#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 mcd(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, j, res, est, n;
  int num[4];
  est = i = j = 0;
  for (i = 0; i < 4; ++i) {
    printf("Ingrese un numero: ");
    scanf("%d", &n);
    num[i] = n;
  }
  while (j < 4) {
    if (est == 0) {
      res = mcd(num[j], num[++j]);
      est = 1;
    } else
      res = mcd(num[j], res);
    ++j;
  }
  printf("El maximo comun divisor de los numeros ingresados es: %d", res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    119c <main+0x6c>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x18(%rbp),%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115b <main+0x2b>
jmp    11a1 <main+0x71>
cmpl   $0x4,-0xc(%rbp)
jge    1201 <main+0xd1>
cmpl   $0x0,-0x14(%rbp)
jne    11e0 <main+0xb0>
movslq -0xc(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cltq
mov    -0x30(%rbp,%rax,4),%esi
call   1040 <mcd@plt>
mov    %eax,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
jmp    11f3 <main+0xc3>
movslq -0xc(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
mov    -0x10(%rbp),%esi
call   1040 <mcd@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a1 <main+0x71>
mov    -0x10(%rbp),%esi
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
lea    0xebd(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef6(%rip),%r12
lea    0xc(%rsp),%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ebp
mov    %ebp,0x10(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,0x14(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x18(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
mov    %eax,0x1c(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <mcd@plt>
mov    0x18(%rsp),%edi
mov    %eax,%esi
call   1040 <mcd@plt>
mov    0x1c(%rsp),%edi
mov    %eax,%esi
call   1040 <mcd@plt>
lea    0xe2b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Ingrese un numero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [57 x i8] c"El maximo comun divisor de los numeros ingresados es: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [4 x i32]
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %2
store i32 0, i32* %5
store i32 0, i32* %2
br label %8
8: ; preds = %18, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 4
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%14 = load i32, i32* %6
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 %16
store i32 %14, i32* %17
br label %18
18: ; preds = %11
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %8
21: ; preds = %8
br label %22
22: ; preds = %46, %21
%23 = load i32, i32* %3
%24 = icmp slt i32 %23, 4
br i1 %24, label %25, label %49
25: ; preds = %22
%26 = load i32, i32* %5
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %39
28: ; preds = %25
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 %30
%32 = load i32, i32* %31
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = call i32 @mcd(i32 %32, i32 %37)
store i32 %38, i32* %4
store i32 1, i32* %5
br label %46
39: ; preds = %25
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = load i32, i32* %4
%45 = call i32 @mcd(i32 %43, i32 %44)
store i32 %45, i32* %4
br label %46
46: ; preds = %39, %28
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 1
store i32 %48, i32* %3
br label %22
49: ; preds = %22
%50 = load i32, i32* %4
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0), i32 %50)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Ingrese un numero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [57 x i8] c"El maximo comun divisor de los numeros ingresados es: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i32]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [4 x i32]* %2 to i8*
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 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 = load i32, i32* %1
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
store i32 %7, i32* %8
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%11 = load i32, i32* %1
%12 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 1
store i32 %11, i32* %12
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%15 = load i32, i32* %1
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 2
store i32 %15, i32* %16
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%19 = load i32, i32* %1
%20 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 3
store i32 %19, i32* %20
%21 = call i32 @mcd(i32 %7, i32 %11)
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 2
%23 = load i32, i32* %22
%24 = call i32 @mcd(i32 %23, i32 %21)
%25 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 3
%26 = load i32, i32* %25
%27 = call i32 @mcd(i32 %26, i32 %24)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.2, i64 0, i64 0), i32 %27)
ret i32 0
}