#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);
    } else {
    }
    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    1198 <main+0x78>
jp     1198 <main+0x78>
movsd  -0x20(%rbp),%xmm0
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
jmp    119d <main+0x7d>
jmp    119d <main+0x7d>
jmp    11a2 <main+0x82>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11bf <main+0x9f>
jp     11bf <main+0x9f>
jmp    11ff <main+0xdf>
movsd  -0x18(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11e7 <main+0xc7>
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11fa <main+0xda>
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11a2 <main+0x82>
movsd  -0x18(%rbp),%xmm0
lea    0xdf5(%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 %31
30: ; preds = %2
br label %31
31: ; preds = %30, %27
br label %32
32: ; preds = %47, %31
%33 = load double, double* %7
%34 = fcmp une double %33, 0.000000e+00
br i1 %34, label %35, label %48
35: ; preds = %32
%36 = load double, double* %6
%37 = load double, double* %7
%38 = fcmp ogt double %36, %37
br i1 %38, label %39, label %43
39: ; preds = %35
%40 = load double, double* %7
%41 = load double, double* %6
%42 = fsub double %41, %40
store double %42, double* %6
br label %47
43: ; preds = %35
%44 = load double, double* %6
%45 = load double, double* %7
%46 = fsub double %45, %44
store double %46, double* %7
br label %47
47: ; preds = %43, %39
br label %32
48: ; preds = %32
%49 = load double, double* %6
%50 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %49)
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 = %2, %12
%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
}