#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*/ assert(int);
int /*<<< orphan*/ printf(char *, int);
void gcd(int m, int n) {
  int a = m, b = n, temp;
  assert(a > 0 && b > 0);
  while (b != 0) {
    temp = b;
    b = a % b;
    a = temp;
  }
  printf("%d\n", a);
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x15(%rbp)
jle    1153 <gcd+0x33>
cmpl   $0x0,-0x10(%rbp)
setg   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x0,-0x10(%rbp)
je     1185 <gcd+0x65>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1160 <gcd+0x40>
mov    -0xc(%rbp),%esi
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
test   %edi,%edi
setg   %al
test   %esi,%esi
setg   %cl
and    %al,%cl
movzbl %cl,%edi
call   1040 <assert@plt>
test   %ebp,%ebp
je     1151 <gcd+0x31>
nop
mov    %ebp,%esi
mov    %ebx,%eax
cltd
idiv   %ebp
mov    %ebp,%ebx
mov    %edx,%ebp
test   %edx,%edx
jne    1140 <gcd+0x20>
jmp    1153 <gcd+0x33>
mov    %ebx,%esi
lea    0xea6(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @gcd(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 0
%4 = icmp sgt i32 %1, 0
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = icmp eq i32 %1, 0
br i1 %8, label %14, label %9
9: ; preds = %2, %9
%10 = phi i32 [ %11, %9 ], [ %0, %2 ]
%11 = phi i32 [ %12, %9 ], [ %1, %2 ]
%12 = srem i32 %10, %11
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %9
14: ; preds = %9, %2
%15 = phi i32 [ %0, %2 ], [ %11, %9 ]
%16 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
ret void
}