#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 *, ...);
int main(int argc, char **argv) {
  int i, j;
  if (3 != argc) {
    printf("Nombre de param\212tres insuffisant");
    return 1;
  } else if (atoi(argv[1]) < 0 || atoi(argv[2]) < 0) {
    printf("Division sur des entiers naturels uniquement");
    return 1;
  } else if (0 == atoi(argv[2])) {
    printf("Division par zero impossible");
    return 1;
  } else if ((i = atoi(argv[1])) < (j = atoi(argv[2]))) {
    printf("%d n'est pas divisible par %d", i, j);
    return 1;
  }
  int divisor = atoi(argv[2]), dividend = atoi(argv[1]), remainder = dividend,
      quotient = 0;
  i = 0;
  while ((remainder -= divisor) >= 0)
    quotient++;
  if ((remainder += divisor) == 0)
    printf("%d=%d*%d", dividend, quotient, divisor);
  else
    printf("%d=%d*%d+%d", dividend, quotient, divisor, remainder);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x3,%eax
cmp    -0x8(%rbp),%eax
je     115e <main+0x3e>
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12dc <main+0x1bc>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
cmp    $0x0,%eax
jl     118a <main+0x6a>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atoi@plt>
cmp    $0x0,%eax
jge    11a4 <main+0x84>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12dc <main+0x1bc>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jne    11d7 <main+0xb7>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12dc <main+0x1bc>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x2c(%rbp)
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
mov    %ecx,-0x18(%rbp)
cmp    %ecx,%eax
jge    1227 <main+0x107>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12dc <main+0x1bc>
jmp    122c <main+0x10c>
jmp    1231 <main+0x111>
jmp    1236 <main+0x116>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x24(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
jl     128c <main+0x16c>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    126a <main+0x14a>
mov    -0x1c(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
jne    12ba <main+0x19a>
mov    -0x20(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12d5 <main+0x1b5>
mov    -0x20(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x24(%rbp),%r8d
lea    0xdc4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    1161 <main+0x41>
mov    %rsi,%rbp
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
test   %eax,%eax
js     116a <main+0x4a>
mov    %eax,%ebx
mov    0x10(%rbp),%rdi
call   1040 <atoi@plt>
test   %eax,%eax
js     116a <main+0x4a>
je     1186 <main+0x66>
cmp    %eax,%ebx
jae    118f <main+0x6f>
lea    0xf17(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1178 <main+0x58>
lea    0xe98(%rip),%rdi
jmp    1171 <main+0x51>
lea    0xeb0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xec1(%rip),%rdi
jmp    1171 <main+0x51>
mov    %ebx,%r8d
add    %eax,%r8d
mov    $0xffffffff,%edx
mov    %ebx,%ecx
nopl   0x0(%rax)
mov    %ecx,%esi
sub    %eax,%r8d
add    $0x1,%edx
sub    %eax,%ecx
jns    11a0 <main+0x80>
test   %esi,%esi
je     11c6 <main+0xa6>
lea    0xedb(%rip),%rdi
xor    %ebp,%ebp
mov    %ebx,%esi
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    117d <main+0x5d>
lea    0xebc(%rip),%rdi
xor    %ebp,%ebp
mov    %ebx,%esi
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    117d <main+0x5d>

LLVM IR (-O0):
@.str = [33 x i8] c"Nombre de param\8Atres insuffisant\00"
@.str.1 = [45 x i8] c"Division sur des entiers naturels uniquement\00"
@.str.2 = [29 x i8] c"Division par zero impossible\00"
@.str.3 = [30 x i8] c"%d n'est pas divisible par %d\00"
@.str.4 = [9 x i8] c"%d=%d*%d\00"
@.str.5 = [12 x i8] c"%d=%d*%d+%d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp ne i32 3, %12
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %90
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
%21 = icmp slt i32 %20, 0
br i1 %21, label %28, label %22
22: ; preds = %16
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i32 @atoi(i8* %25)
%27 = icmp slt i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %22, %16
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %90
30: ; preds = %22
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 2
%33 = load i8*, i8** %32
%34 = call i32 @atoi(i8* %33)
%35 = icmp eq i32 0, %34
br i1 %35, label %36, label %38
36: ; preds = %30
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %90
38: ; preds = %30
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 1
%41 = load i8*, i8** %40
%42 = call i32 @atoi(i8* %41)
store i32 %42, i32* %6
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 2
%45 = load i8*, i8** %44
%46 = call i32 @atoi(i8* %45)
store i32 %46, i32* %7
%47 = icmp slt i32 %42, %46
br i1 %47, label %48, label %52
48: ; preds = %38
%49 = load i32, i32* %6
%50 = load i32, i32* %7
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %49, i32 %50)
store i32 1, i32* %3
br label %90
52: ; preds = %38
br label %53
53: ; preds = %52
br label %54
54: ; preds = %53
br label %55
55: ; preds = %54
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 2
%58 = load i8*, i8** %57
%59 = call i32 @atoi(i8* %58)
store i32 %59, i32* %8
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 1
%62 = load i8*, i8** %61
%63 = call i32 @atoi(i8* %62)
store i32 %63, i32* %9
%64 = load i32, i32* %9
store i32 %64, i32* %10
store i32 0, i32* %11
store i32 0, i32* %6
br label %65
65: ; preds = %70, %55
%66 = load i32, i32* %8
%67 = load i32, i32* %10
%68 = sub nsw i32 %67, %66
store i32 %68, i32* %10
%69 = icmp sge i32 %68, 0
br i1 %69, label %70, label %73
70: ; preds = %65
%71 = load i32, i32* %11
%72 = add nsw i32 %71, 1
store i32 %72, i32* %11
br label %65
73: ; preds = %65
%74 = load i32, i32* %8
%75 = load i32, i32* %10
%76 = add nsw i32 %75, %74
store i32 %76, i32* %10
%77 = icmp eq i32 %76, 0
br i1 %77, label %78, label %83
78: ; preds = %73
%79 = load i32, i32* %9
%80 = load i32, i32* %11
%81 = load i32, i32* %8
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %79, i32 %80, i32 %81)
br label %89
83: ; preds = %73
%84 = load i32, i32* %9
%85 = load i32, i32* %11
%86 = load i32, i32* %8
%87 = load i32, i32* %10
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %84, i32 %85, i32 %86, i32 %87)
br label %89
89: ; preds = %83, %78
store i32 0, i32* %3
br label %90
90: ; preds = %89, %48, %36, %28, %14
%91 = load i32, i32* %3
ret i32 %91
}

LLVM IR (-O2):
@.str = [33 x i8] c"Nombre de param\8Atres insuffisant\00"
@.str.1 = [45 x i8] c"Division sur des entiers naturels uniquement\00"
@.str.2 = [29 x i8] c"Division par zero impossible\00"
@.str.3 = [30 x i8] c"%d n'est pas divisible par %d\00"
@.str.4 = [9 x i8] c"%d=%d*%d\00"
@.str.5 = [12 x i8] c"%d=%d*%d+%d\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 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %38
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = icmp slt i32 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %6
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11, %6
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
br label %38
18: ; preds = %11
%19 = icmp eq i32 %14, 0
br i1 %19, label %20, label %22
20: ; preds = %18
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %38
22: ; preds = %18
%23 = icmp ult i32 %9, %14
br i1 %23, label %24, label %26
24: ; preds = %22
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %9, i32 %14)
br label %38
26: ; preds = %22, %26
%27 = phi i32 [ %29, %26 ], [ %9, %22 ]
%28 = phi i32 [ %31, %26 ], [ 0, %22 ]
%29 = sub nsw i32 %27, %14
%30 = icmp sgt i32 %29, -1
%31 = add nuw nsw i32 %28, 1
br i1 %30, label %26, label %32
32: ; preds = %26
%33 = icmp eq i32 %27, 0
br i1 %33, label %34, label %36
34: ; preds = %32
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %9, i32 %28, i32 %14)
br label %38
36: ; preds = %32
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %9, i32 %28, i32 %14, i32 %27)
br label %38
38: ; preds = %34, %36, %24, %20, %16, %4
%39 = phi i32 [ 1, %4 ], [ 1, %16 ], [ 1, %20 ], [ 1, %24 ], [ 0, %36 ], [ 0, %34 ]
ret i32 %39
}