#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*/ printf(char *, ...);
int strtol(char *, int /*<<< orphan*/ *, int);
int main(int ac, char *av[]) {
  int a, b, c, aa, bb, cc, min_n, max_n;
  if (ac < 3) {
    printf("usage : pythagoras min_n max_n\n");
    return (1);
  }
  min_n = strtol(av[1], NULL, 10);
  max_n = strtol(av[2], NULL, 10);
  for (c = min_n; c < max_n; c++) {
    cc = c * c;
    for (b = 1; b < c; b++) {
      bb = b * b;
      for (a = 1; a < b; a++) {
        aa = a * a;
        if (aa + bb == cc)
          printf("%d %d %d\n", a, b, c);
      }
    }
  }
  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)
cmpl   $0x3,-0x8(%rbp)
jge    115a <main+0x3a>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1248 <main+0x128>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    1241 <main+0x121>
mov    -0x1c(%rbp),%eax
imul   -0x1c(%rbp),%eax
mov    %eax,-0x28(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    122e <main+0x10e>
mov    -0x18(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    121b <main+0xfb>
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
add    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
jne    1208 <main+0xe8>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120d <main+0xed>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11cc <main+0xac>
jmp    1220 <main+0x100>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11af <main+0x8f>
jmp    1233 <main+0x113>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1192 <main+0x72>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jg     1156 <main+0x26>
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
jmp    1229 <main+0xf9>
mov    %rsi,%rbp
mov    0x8(%rsi),%rdi
xor    %ebx,%ebx
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,%r12d
mov    0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,0x4(%rsp)
cmp    %eax,%r12d
jl     119f <main+0x6f>
jmp    1229 <main+0xf9>
nopl   0x0(%rax)
add    $0x1,%r12d
cmp    0x4(%rsp),%r12d
je     1227 <main+0xf7>
cmp    $0x2,%r12d
jl     1190 <main+0x60>
mov    %r12d,%r13d
imul   %r12d,%r13d
mov    $0x1,%r15d
xor    %r14d,%r14d
jmp    11cd <main+0x9d>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r15d
add    $0xffffffff,%r14d
cmp    %r12d,%r15d
je     1190 <main+0x60>
cmp    $0x2,%r15d
jb     11c0 <main+0x90>
mov    %r15d,%ebp
imul   %r15d,%ebp
mov    $0x1,%ebx
jmp    1203 <main+0xd3>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    (%r14,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
je     11c0 <main+0x90>
mov    %ebx,%eax
imul   %ebx,%eax
add    %ebp,%eax
cmp    %r13d,%eax
jne    11f0 <main+0xc0>
lea    0xdea(%rip),%rdi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %r12d,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11f0 <main+0xc0>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"usage : pythagoras min_n max_n\0A\00"
@.str.1 = [10 x i8] c"%d %d %d\0A\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
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 3
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %75
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @strtol(i8* %21, i32* null, i32 10)
store i32 %22, i32* %12
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i32 @strtol(i8* %25, i32* null, i32 10)
store i32 %26, i32* %13
%27 = load i32, i32* %12
store i32 %27, i32* %8
br label %28
28: ; preds = %71, %18
%29 = load i32, i32* %8
%30 = load i32, i32* %13
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %74
32: ; preds = %28
%33 = load i32, i32* %8
%34 = load i32, i32* %8
%35 = mul nsw i32 %33, %34
store i32 %35, i32* %11
store i32 1, i32* %7
br label %36
36: ; preds = %67, %32
%37 = load i32, i32* %7
%38 = load i32, i32* %8
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %70
40: ; preds = %36
%41 = load i32, i32* %7
%42 = load i32, i32* %7
%43 = mul nsw i32 %41, %42
store i32 %43, i32* %10
store i32 1, i32* %6
br label %44
44: ; preds = %63, %40
%45 = load i32, i32* %6
%46 = load i32, i32* %7
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %66
48: ; preds = %44
%49 = load i32, i32* %6
%50 = load i32, i32* %6
%51 = mul nsw i32 %49, %50
store i32 %51, i32* %9
%52 = load i32, i32* %9
%53 = load i32, i32* %10
%54 = add nsw i32 %52, %53
%55 = load i32, i32* %11
%56 = icmp eq i32 %54, %55
br i1 %56, label %57, label %62
57: ; preds = %48
%58 = load i32, i32* %6
%59 = load i32, i32* %7
%60 = load i32, i32* %8
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %58, i32 %59, i32 %60)
br label %62
62: ; preds = %57, %48
br label %63
63: ; preds = %62
%64 = load i32, i32* %6
%65 = add nsw i32 %64, 1
store i32 %65, i32* %6
br label %44
66: ; preds = %44
br label %67
67: ; preds = %66
%68 = load i32, i32* %7
%69 = add nsw i32 %68, 1
store i32 %69, i32* %7
br label %36
70: ; preds = %36
br label %71
71: ; preds = %70
%72 = load i32, i32* %8
%73 = add nsw i32 %72, 1
store i32 %73, i32* %8
br label %28
74: ; preds = %28
store i32 0, i32* %3
br label %75
75: ; preds = %74, %16
%76 = load i32, i32* %3
ret i32 %76
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"%d %d %d\0A\00"
@str = [31 x i8] c"usage : pythagoras min_n max_n\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 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 @strtol(i8* nocapture %8, i32* null, i32 10)
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32 @strtol(i8* nocapture %11, i32* null, i32 10)
%13 = icmp slt i32 %9, %12
br i1 %13, label %14, label %38
14: ; preds = %6, %35
%15 = phi i32 [ %36, %35 ], [ %9, %6 ]
%16 = mul nsw i32 %15, %15
%17 = icmp sgt i32 %15, 1
br i1 %17, label %18, label %35
18: ; preds = %14, %32
%19 = phi i32 [ %33, %32 ], [ 1, %14 ]
%20 = mul nsw i32 %19, %19
%21 = icmp ugt i32 %19, 1
br i1 %21, label %22, label %32
22: ; preds = %18, %29
%23 = phi i32 [ %30, %29 ], [ 1, %18 ]
%24 = mul nsw i32 %23, %23
%25 = add nuw nsw i32 %24, %20
%26 = icmp eq i32 %25, %16
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %23, i32 %19, i32 %15)
br label %29
29: ; preds = %22, %27
%30 = add nuw nsw i32 %23, 1
%31 = icmp eq i32 %30, %19
br i1 %31, label %32, label %22
32: ; preds = %29, %18
%33 = add nuw nsw i32 %19, 1
%34 = icmp eq i32 %33, %15
br i1 %34, label %35, label %18
35: ; preds = %32, %14
%36 = add i32 %15, 1
%37 = icmp eq i32 %36, %12
br i1 %37, label %38, label %14
38: ; preds = %35, %6, %4
%39 = phi i32 [ 1, %4 ], [ 0, %6 ], [ 0, %35 ]
ret i32 %39
}