#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);
  }
  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    1183 <main+0x63>
jp     1183 <main+0x63>
movsd  -0x20(%rbp),%xmm0
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
jmp    1188 <main+0x68>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11a5 <main+0x85>
jp     11a5 <main+0x85>
jmp    11dd <main+0xbd>
movsd  -0x18(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11c9 <main+0xa9>
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11d8 <main+0xb8>
movsd  -0x20(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1188 <main+0x68>
movsd  -0x18(%rbp),%xmm0
lea    0xe17(%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 %24
24: ; preds = %21, %2
br label %25
25: ; preds = %40, %24
%26 = load double, double* %7
%27 = fcmp une double %26, 0.000000e+00
br i1 %27, label %28, label %41
28: ; preds = %25
%29 = load double, double* %6
%30 = load double, double* %7
%31 = fcmp ogt double %29, %30
br i1 %31, label %32, label %36
32: ; preds = %28
%33 = load double, double* %6
%34 = load double, double* %7
%35 = fsub double %33, %34
store double %35, double* %6
br label %40
36: ; preds = %28
%37 = load double, double* %7
%38 = load double, double* %6
%39 = fsub double %37, %38
store double %39, double* %7
br label %40
40: ; preds = %36, %32
br label %25
41: ; preds = %25
%42 = load double, double* %6
%43 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %42)
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 = %10, %2
%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
}