#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, int, int);
main() {
  int u, v, t, x, y;
  u = x = 1248480;
  v = y = 4187610;
  while (u > 0) {
    if (u < v) {
      t = u;
      u = v;
      v = t;
    }
    u = u - v;
  }
  printf("gcd(%d, %d) = %d\n", x, y, v);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x130ce0,-0x14(%rbp)
movl   $0x130ce0,-0x8(%rbp)
movl   $0x3fe5da,-0x18(%rbp)
movl   $0x3fe5da,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1171 <main+0x61>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1163 <main+0x53>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    113b <main+0x2b>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x3fe5da,%ecx
mov    $0x130ce0,%eax
nopw   0x0(%rax,%rax,1)
mov    %ecx,%edx
cmp    %ecx,%eax
cmovl  %eax,%ecx
cmovl  %edx,%eax
sub    %ecx,%eax
jg     1120 <main+0x10>
push   %rax
lea    0xeca(%rip),%rdi
mov    $0x130ce0,%esi
mov    $0x3fe5da,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"gcd(%d, %d) = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 1248480, i32* %5
store i32 1248480, i32* %2
store i32 4187610, i32* %6
store i32 4187610, i32* %3
br label %7
7: ; preds = %18, %0
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i32, i32* %2
store i32 %15, i32* %4
%16 = load i32, i32* %3
store i32 %16, i32* %2
%17 = load i32, i32* %4
store i32 %17, i32* %3
br label %18
18: ; preds = %14, %10
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = sub nsw i32 %19, %20
store i32 %21, i32* %2
br label %7
22: ; preds = %7
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = load i32, i32* %3
%26 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %23, i32 %24, i32 %25)
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
@.str = [18 x i8] c"gcd(%d, %d) = %d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 1248480, %0 ], [ %7, %1 ]
%3 = phi i32 [ 4187610, %0 ], [ %5, %1 ]
%4 = icmp slt i32 %2, %3
%5 = select i1 %4, i32 %2, i32 %3
%6 = select i1 %4, i32 %3, i32 %2
%7 = sub nsw i32 %6, %5
%8 = icmp sgt i32 %7, 0
br i1 %8, label %1, label %9
9: ; preds = %1
%10 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 1248480, i32 4187610, i32 %5)
ret i32 0
}