#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int a = 0, b = 0;
  int i = 1, j = 1;
  printf("a : ");
  scanf("%d", &a);
  printf("b : ");
  scanf("%d", &b);
  if (b < a) {
    int c = b;
    b = a;
    a = c;
  }
  for (i; i < a; i++) {
    for (j = 1; j < b; j++) {
      printf("%d %d\n", i * b, j * a);
      if (i * b == j * a) {
        printf("Résultat : %d\n", j * a);
        exit(0);
      }
    }
  }
  printf("Résultat : %d\n", a * b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe77(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11b5 <main+0x85>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1248 <main+0x118>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1235 <main+0x105>
mov    -0x10(%rbp),%esi
imul   -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
imul   -0x8(%rbp),%edx
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
imul   -0x8(%rbp),%ecx
cmp    %ecx,%eax
jne    1222 <main+0xf2>
mov    -0x14(%rbp),%esi
imul   -0x8(%rbp),%esi
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
jmp    1227 <main+0xf7>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c8 <main+0x98>
jmp    123a <main+0x10a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11b5 <main+0x85>
mov    -0x8(%rbp),%esi
imul   -0xc(%rbp),%esi
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea8(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xe97(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%eax
cmp    %eax,%edx
jge    11a2 <main+0x72>
mov    %eax,0x8(%rsp)
mov    %edx,0xc(%rsp)
mov    %eax,%esi
cmp    $0x2,%edx
jge    11ab <main+0x7b>
jmp    120f <main+0xdf>
mov    %edx,%esi
mov    %eax,%edx
cmp    $0x2,%edx
jl     120f <main+0xdf>
mov    $0x1,%ebp
lea    0xe56(%rip),%r14
jmp    11c7 <main+0x97>
nopl   0x0(%rax)
add    $0x1,%ebp
cmp    %edx,%ebp
jge    120f <main+0xdf>
cmp    $0x2,%esi
jl     11c0 <main+0x90>
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
imul   %ebp,%esi
imul   %ebx,%edx
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
mov    %esi,%eax
imul   %ebp,%eax
mov    0xc(%rsp),%edx
mov    %edx,%ecx
imul   %ebx,%ecx
cmp    %ecx,%eax
je     122b <main+0xfb>
add    $0x1,%ebx
cmp    %esi,%ebx
jl     11e0 <main+0xb0>
jmp    11c0 <main+0x90>
imul   %edx,%esi
lea    0xdfb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xde2(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"a : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [5 x i8] c"b : \00"
@.str.3 = [7 x i8] c"%d %d\0A\00"
@.str.4 = [16 x i8] c"R\C3\A9sultat : %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = load i32, i32* %1
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %13
12: ; preds = %0
store i32 %10, i32* %2
store i32 %9, i32* %1
br label %13
13: ; preds = %12, %0
%14 = phi i32 [ %10, %12 ], [ %9, %0 ]
%15 = phi i32 [ %9, %12 ], [ %10, %0 ]
%16 = icmp sgt i32 %15, 1
br i1 %16, label %17, label %45
17: ; preds = %13, %40
%18 = phi i32 [ %41, %40 ], [ %15, %13 ]
%19 = phi i32 [ %42, %40 ], [ %14, %13 ]
%20 = phi i32 [ %43, %40 ], [ 1, %13 ]
%21 = icmp sgt i32 %19, 1
br i1 %21, label %24, label %40
22: ; preds = %24
%23 = icmp slt i32 %36, %31
br i1 %23, label %24, label %40
24: ; preds = %17, %22
%25 = phi i32 [ %33, %22 ], [ %18, %17 ]
%26 = phi i32 [ %31, %22 ], [ %19, %17 ]
%27 = phi i32 [ %36, %22 ], [ 1, %17 ]
%28 = mul nsw i32 %26, %20
%29 = mul nsw i32 %25, %27
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %28, i32 %29)
%31 = load i32, i32* %2
%32 = mul nsw i32 %31, %20
%33 = load i32, i32* %1
%34 = mul nsw i32 %33, %27
%35 = icmp eq i32 %32, %34
%36 = add nuw nsw i32 %27, 1
br i1 %35, label %37, label %22
37: ; preds = %24
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %32)
%39 = call i32 @exit(i32 0)
unreachable
40: ; preds = %22, %17
%41 = phi i32 [ %18, %17 ], [ %33, %22 ]
%42 = phi i32 [ %19, %17 ], [ %31, %22 ]
%43 = add nuw nsw i32 %20, 1
%44 = icmp slt i32 %43, %41
br i1 %44, label %17, label %45
45: ; preds = %40, %13
%46 = phi i32 [ %14, %13 ], [ %42, %40 ]
%47 = phi i32 [ %15, %13 ], [ %41, %40 ]
%48 = mul nsw i32 %46, %47
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %48)
ret i32 0
}