#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 */
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, ...);
int main(int argc, char *argv[]) {
  int a[] = {3, 2, 5, 6, 11, 13, 40, 66, 34, 12, 90, 100, 78, 44, 34, 22, 25};
  int size = sizeof(a) / sizeof(a[0]);
  int x = 45, count = 0;
  for (int i = 0; i < size; i++)
    for (int j = 0; j < size; j++)
      if (a[i] + a[j] == x) {
        printf("%d + %d = %d\n", a[i], a[j], x);
        count++;
        break;
      }
  printf("\n Count is %d\n", count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xebc(%rip),%rsi
mov    $0x44,%edx
call   1040 <memcpy@plt>
movl   $0x11,-0x64(%rbp)
movl   $0x2d,-0x68(%rbp)
movl   $0x0,-0x6c(%rbp)
movl   $0x0,-0x70(%rbp)
mov    -0x70(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    11f7 <main+0xd7>
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    11e4 <main+0xc4>
movslq -0x70(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%eax
movslq -0x74(%rbp),%rcx
add    -0x60(%rbp,%rcx,4),%eax
cmp    -0x68(%rbp),%eax
jne    11d1 <main+0xb1>
movslq -0x70(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%esi
movslq -0x74(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%edx
mov    -0x68(%rbp),%ecx
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    11e4 <main+0xc4>
jmp    11d6 <main+0xb6>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    117d <main+0x5d>
jmp    11e9 <main+0xc9>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    116a <main+0x4a>
mov    -0x6c(%rbp),%esi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0xfffffffffffffffe,%rbx
lea    0xed7(%rip),%rbp
mov    $0x4f,%r12d
lea    0xf0e(%rip),%r13
lea    0xf23(%rip),%r14
xor    %r15d,%r15d
jmp    115e <main+0x4e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbx
add    $0x4,%rbp
cmp    $0xf,%rbx
je     118d <main+0x7d>
mov    %rbx,%rax
ror    %rax
cmp    $0x6,%rax
ja     1150 <main+0x40>
bt     %eax,%r12d
jae    1150 <main+0x40>
mov    0x0(%rbp),%esi
mov    0x0(%r13,%rax,4),%edx
mov    %r14,%rdi
mov    $0x2d,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%r15d
jmp    1150 <main+0x40>
lea    0xeda(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.a = [17 x i32] [i32 3, i32 2, i32 5, i32 6, i32 11, i32 13, i32 40, i32 66, i32 34, i32 12, i32 90, i32 100, i32 78, i32 44, i32 34, i32 22, i32 25]
@.str = [14 x i8] c"%d + %d = %d\0A\00"
@.str.1 = [15 x i8] c"\0A Count is %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [17 x 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 = bitcast [17 x i32]* %6 to i8*
store i32 17, i32* %7
store i32 45, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
br label %13
13: ; preds = %52, %2
%14 = load i32, i32* %10
%15 = load i32, i32* %7
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %55
17: ; preds = %13
store i32 0, i32* %11
br label %18
18: ; preds = %48, %17
%19 = load i32, i32* %11
%20 = load i32, i32* %7
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %51
22: ; preds = %18
%23 = load i32, i32* %10
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [17 x i32], [17 x i32]* %6, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = load i32, i32* %11
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [17 x i32], [17 x i32]* %6, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = add nsw i32 %26, %30
%32 = load i32, i32* %8
%33 = icmp eq i32 %31, %32
br i1 %33, label %34, label %47
34: ; preds = %22
%35 = load i32, i32* %10
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [17 x i32], [17 x i32]* %6, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = load i32, i32* %11
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [17 x i32], [17 x i32]* %6, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = load i32, i32* %8
%44 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %38, i32 %42, i32 %43)
%45 = load i32, i32* %9
%46 = add nsw i32 %45, 1
store i32 %46, i32* %9
br label %51
47: ; preds = %22
br label %48
48: ; preds = %47
%49 = load i32, i32* %11
%50 = add nsw i32 %49, 1
store i32 %50, i32* %11
br label %18
51: ; preds = %34, %18
br label %52
52: ; preds = %51
%53 = load i32, i32* %10
%54 = add nsw i32 %53, 1
store i32 %54, i32* %10
br label %13
55: ; preds = %13
%56 = load i32, i32* %9
%57 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %56)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [17 x i32] [i32 3, i32 2, i32 5, i32 6, i32 11, i32 13, i32 40, i32 66, i32 34, i32 12, i32 90, i32 100, i32 78, i32 44, i32 34, i32 22, i32 25]
@.str = [14 x i8] c"%d + %d = %d\0A\00"
@.str.1 = [15 x i8] c"\0A Count is %d\0A\00"
@switch.table.main = [7 x i32] [i32 40, i32 34, i32 5, i32 11, i32 5, i32 5, i32 11]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %5
3: ; preds = %23
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %24)
ret i32 0
5: ; preds = %2, %23
%6 = phi i64 [ 0, %2 ], [ %25, %23 ]
%7 = phi i32 [ 0, %2 ], [ %24, %23 ]
%8 = getelementptr inbounds [17 x i32], [17 x i32]* @__const.main.a, i64 0, i64 %6
%9 = load i32, i32* %8
%10 = add nsw i64 %6, -2
%11 = call i64 @llvm.fshl.i64(i64 %10, i64 %10, i64 63)
%12 = icmp ult i64 %11, 7
br i1 %12, label %13, label %23
13: ; preds = %5
%14 = trunc i64 %11 to i8
%15 = lshr i8 79, %14
%16 = and i8 %15, 1
%17 = icmp eq i8 %16, 0
br i1 %17, label %23, label %18
18: ; preds = %13
%19 = getelementptr inbounds [7 x i32], [7 x i32]* @switch.table.main, i64 0, i64 %11
%20 = load i32, i32* %19
%21 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %20, i32 45)
%22 = add nsw i32 %7, 1
br label %23
23: ; preds = %13, %5, %18
%24 = phi i32 [ %22, %18 ], [ %7, %5 ], [ %7, %13 ]
%25 = add nuw nsw i64 %6, 1
%26 = icmp eq i64 %25, 17
br i1 %26, label %3, label %5
}