#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 atoi(char *);
int /*<<< orphan*/ printf(char *, double);
int main(int argc, char **argv) {
  double a;
  double b;
  double c;
  double r1;
  double r2;
  int tmp;
  int tmp___0;
  {
    tmp = atoi(*(argv + 1));
    a = (double)tmp;
    tmp___0 = atoi(*(argv + 2));
    b = (double)tmp___0;
    if (a == (double)0) {
      printf("%g\n", b);
    }
    while (b != (double)0) {
      if (a > b) {
        a -= b;
      } else {
        b -= a;
      }
    }
    printf("%g\n", a);
    return (0);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x3c(%rbp)
cvtsi2sdl -0x3c(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x40(%rbp)
cvtsi2sdl -0x40(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1193 <main+0x73>
jp     1193 <main+0x73>
movsd  -0x20(%rbp),%xmm0
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
jmp    1198 <main+0x78>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11b5 <main+0x95>
jp     11b5 <main+0x95>
jmp    11f5 <main+0xd5>
movsd  -0x18(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11dd <main+0xbd>
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11f0 <main+0xd0>
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1198 <main+0x78>
movsd  -0x18(%rbp),%xmm0
lea    0xdff(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbp
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
mov    %eax,%ebx
mov    0x10(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,%ebp
cvtsi2sd %eax,%xmm4
test   %ebx,%ebx
jne    115e <main+0x3e>
lea    0xeb5(%rip),%rdi
movapd %xmm4,%xmm0
movsd  %xmm4,(%rsp)
call   1030 <printf@plt>
movsd  (%rsp),%xmm4
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
test   %ebp,%ebp
je     119d <main+0x7d>
xorpd  %xmm1,%xmm1
jmp    118d <main+0x6d>
nop
movapd %xmm4,%xmm3
cmpltsd %xmm0,%xmm3
andnpd %xmm0,%xmm3
subsd  %xmm3,%xmm4
subsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm4
jne    118d <main+0x6d>
jnp    119d <main+0x7d>
ucomisd %xmm4,%xmm0
movapd %xmm4,%xmm2
ja     1170 <main+0x50>
xorpd  %xmm2,%xmm2
jmp    1170 <main+0x50>
lea    0xe5c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%g\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @atoi(i8* %15)
store i32 %16, i32* %11
%17 = load i32, i32* %11
%18 = sitofp i32 %17 to double
store double %18, double* %6
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %12
%23 = load i32, i32* %12
%24 = sitofp i32 %23 to double
store double %24, double* %7
%25 = load double, double* %6
%26 = fcmp oeq double %25, 0.000000e+00
br i1 %26, label %27, label %30
27: ; preds = %2
%28 = load double, double* %7
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %28)
br label %30
30: ; preds = %27, %2
br label %31
31: ; preds = %46, %30
%32 = load double, double* %7
%33 = fcmp une double %32, 0.000000e+00
br i1 %33, label %34, label %47
34: ; preds = %31
%35 = load double, double* %6
%36 = load double, double* %7
%37 = fcmp ogt double %35, %36
br i1 %37, label %38, label %42
38: ; preds = %34
%39 = load double, double* %7
%40 = load double, double* %6
%41 = fsub double %40, %39
store double %41, double* %6
br label %46
42: ; preds = %34
%43 = load double, double* %6
%44 = load double, double* %7
%45 = fsub double %44, %43
store double %45, double* %7
br label %46
46: ; preds = %42, %38
br label %31
47: ; preds = %31
%48 = load double, double* %6
%49 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %48)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%g\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = sitofp i32 %5 to double
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = sitofp i32 %9 to double
%11 = icmp eq i32 %5, 0
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %10)
br label %14
14: ; preds = %12, %2
%15 = icmp eq i32 %9, 0
br i1 %15, label %25, label %16
16: ; preds = %14, %16
%17 = phi double [ %23, %16 ], [ %6, %14 ]
%18 = phi double [ %21, %16 ], [ %10, %14 ]
%19 = fcmp ogt double %17, %18
%20 = select i1 %19, double 0.000000e+00, double %17
%21 = fsub double %18, %20
%22 = select i1 %19, double %18, double 0.000000e+00
%23 = fsub double %17, %22
%24 = fcmp une double %21, 0.000000e+00
br i1 %24, label %16, label %25
25: ; preds = %16, %14
%26 = phi double [ %6, %14 ], [ %23, %16 ]
%27 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %26)
ret i32 0
}