#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 */
double atoi(char *);
int /*<<< orphan*/ printf(char *, double);
int main(int argc, char *argv[]) {
  double a, b, c;
  double r1, r2;
  a = atoi(argv[1]);
  b = atoi(argv[2]);
  if (a == 0) {
    printf("%g\n", b);
  } else {
  }
  {
    while (b != 0) {
      if (a > b) {
        a = a - b;
      } else {
        b = 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>
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atoi@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1188 <main+0x68>
jp     1188 <main+0x68>
movsd  -0x20(%rbp),%xmm0
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
jmp    118d <main+0x6d>
jmp    118d <main+0x6d>
jmp    1192 <main+0x72>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11af <main+0x8f>
jp     11af <main+0x8f>
jmp    11e7 <main+0xc7>
movsd  -0x18(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11d3 <main+0xb3>
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11e2 <main+0xc2>
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1192 <main+0x72>
movsd  -0x18(%rbp),%xmm0
lea    0xe0d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
movapd %xmm0,0x10(%rsp)
mov    0x10(%rbx),%rdi
call   1040 <atoi@plt>
movapd 0x10(%rsp),%xmm3
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm3
jne    1174 <main+0x54>
jp     1174 <main+0x54>
lea    0xea7(%rip),%rdi
movsd  %xmm0,0x8(%rsp)
call   1030 <printf@plt>
xorpd  %xmm1,%xmm1
movsd  0x8(%rsp),%xmm0
movapd 0x10(%rsp),%xmm3
ucomisd %xmm1,%xmm0
jne    117c <main+0x5c>
jnp    11bd <main+0x9d>
xorpd  %xmm4,%xmm4
jmp    11ad <main+0x8d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movapd %xmm0,%xmm2
cmpltsd %xmm3,%xmm2
andnpd %xmm3,%xmm2
subsd  %xmm2,%xmm0
subsd  %xmm1,%xmm3
ucomisd %xmm4,%xmm0
jne    11ad <main+0x8d>
jnp    11bd <main+0x9d>
ucomisd %xmm0,%xmm3
movapd %xmm0,%xmm1
ja     1190 <main+0x70>
xorpd  %xmm1,%xmm1
jmp    1190 <main+0x70>
lea    0xe3c(%rip),%rdi
movapd %xmm3,%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call double @atoi(i8* %13)
store double %14, double* %6
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
%18 = call double @atoi(i8* %17)
store double %18, double* %7
%19 = load double, double* %6
%20 = fcmp oeq double %19, 0.000000e+00
br i1 %20, label %21, label %24
21: ; preds = %2
%22 = load double, double* %7
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %22)
br label %25
24: ; preds = %2
br label %25
25: ; preds = %24, %21
br label %26
26: ; preds = %41, %25
%27 = load double, double* %7
%28 = fcmp une double %27, 0.000000e+00
br i1 %28, label %29, label %42
29: ; preds = %26
%30 = load double, double* %6
%31 = load double, double* %7
%32 = fcmp ogt double %30, %31
br i1 %32, label %33, label %37
33: ; preds = %29
%34 = load double, double* %6
%35 = load double, double* %7
%36 = fsub double %34, %35
store double %36, double* %6
br label %41
37: ; preds = %29
%38 = load double, double* %7
%39 = load double, double* %6
%40 = fsub double %38, %39
store double %40, double* %7
br label %41
41: ; preds = %37, %33
br label %26
42: ; preds = %26
%43 = load double, double* %6
%44 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %43)
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 double @atoi(i8* %4)
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call double @atoi(i8* %7)
%9 = fcmp oeq double %5, 0.000000e+00
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %8)
br label %12
12: ; preds = %2, %10
%13 = fcmp une double %8, 0.000000e+00
br i1 %13, label %14, label %23
14: ; preds = %12, %14
%15 = phi double [ %21, %14 ], [ %5, %12 ]
%16 = phi double [ %19, %14 ], [ %8, %12 ]
%17 = fcmp ogt double %15, %16
%18 = select i1 %17, double 0.000000e+00, double %15
%19 = fsub double %16, %18
%20 = select i1 %17, double %16, double 0.000000e+00
%21 = fsub double %15, %20
%22 = fcmp une double %19, 0.000000e+00
br i1 %22, label %14, label %23
23: ; preds = %14, %12
%24 = phi double [ %5, %12 ], [ %21, %14 ]
%25 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %24)
ret i32 0
}