#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 pgcd(int, int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  if (argc != 3) {
    printf("Nombre de parametres insuffisants\n");
    return 1;
  } else if (atoi(argv[2]) == 0) {
    printf("infini\n");
    return 1;
  } else {
    int a = (atoi(argv[1]) < 0 ? atoi(argv[1]) * -1 : atoi(argv[1]));
    int b = (atoi(argv[2]) < 0 ? atoi(argv[2]) * -1 : atoi(argv[2]));
    printf("%d", pgcd(a, b));
    return 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     116a <main+0x3a>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1244 <main+0x114>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
cmp    $0x0,%eax
jne    119a <main+0x6a>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1244 <main+0x114>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
cmp    $0x0,%eax
jge    11c8 <main+0x98>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
imul   $0xffffffff,%eax,%eax
mov    %eax,-0x1c(%rbp)
jmp    11d8 <main+0xa8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
cmp    $0x0,%eax
jge    120c <main+0xdc>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
imul   $0xffffffff,%eax,%eax
mov    %eax,-0x20(%rbp)
jmp    121c <main+0xec>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <pgcd@plt>
mov    %eax,%esi
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    118a <main+0x4a>
mov    %rsi,%rbx
mov    0x10(%rsi),%rdi
call   1060 <atoi@plt>
test   %eax,%eax
je     1193 <main+0x53>
mov    %eax,%ebp
mov    0x8(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
neg    %edi
cmovs  %eax,%edi
mov    %ebp,%esi
neg    %esi
cmovs  %ebp,%esi
call   1050 <pgcd@plt>
lea    0xe83(%rip),%rdi
xor    %ebx,%ebx
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11a4 <main+0x64>
lea    0xe79(%rip),%rdi
jmp    119a <main+0x5a>
lea    0xe69(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Nombre de parametres insuffisants\0A\00"
@.str.1 = [8 x i8] c"infini\0A\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 3
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %61
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 2
%15 = load i8*, i8** %14
%16 = call i32 @atoi(i8* %15)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %61
20: ; preds = %12
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @atoi(i8* %23)
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %32
26: ; preds = %20
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 @atoi(i8* %29)
%31 = mul nsw i32 %30, -1
br label %37
32: ; preds = %20
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32 @atoi(i8* %35)
br label %37
37: ; preds = %32, %26
%38 = phi i32 [ %31, %26 ], [ %36, %32 ]
store i32 %38, i32* %6
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 2
%41 = load i8*, i8** %40
%42 = call i32 @atoi(i8* %41)
%43 = icmp slt i32 %42, 0
br i1 %43, label %44, label %50
44: ; preds = %37
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 2
%47 = load i8*, i8** %46
%48 = call i32 @atoi(i8* %47)
%49 = mul nsw i32 %48, -1
br label %55
50: ; preds = %37
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 2
%53 = load i8*, i8** %52
%54 = call i32 @atoi(i8* %53)
br label %55
55: ; preds = %50, %44
%56 = phi i32 [ %49, %44 ], [ %54, %50 ]
store i32 %56, i32* %7
%57 = load i32, i32* %6
%58 = load i32, i32* %7
%59 = call i32 @pgcd(i32 %57, i32 %58)
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %59)
store i32 0, i32* %3
br label %61
61: ; preds = %55, %18, %10
%62 = load i32, i32* %3
ret i32 %62
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"%d\00"
@str = [7 x i8] c"infini\00"
@str.3 = [34 x i8] c"Nombre de parametres insuffisants\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.3, i64 0, i64 0))
br label %21
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
br label %21
13: ; preds = %6
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i32 @atoi(i8* %15)
%17 = tail call i32 @llvm.abs.i32(i32 %16, i1 true)
%18 = tail call i32 @llvm.abs.i32(i32 %9, i1 true)
%19 = tail call i32 @pgcd(i32 %17, i32 %18)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %13, %11, %4
%22 = phi i32 [ 1, %4 ], [ 1, %11 ], [ 0, %13 ]
ret i32 %22
}