#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 *, ...);
void SumEven(int from, int to) {
  unsigned int sum;
  if (from > to)
    printf("%s", "Cannot execute!");
  else {
    for (int i = from; i <= to; i += 2) {
      sum += i;
    }
    printf("The even sum is: %u \n", sum);
  }
}


x86 assembly (clang, -O0):
<SumEven>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1144 <SumEven+0x34>
lea    0xecf(%rip),%rdi
lea    0xecb(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    117e <SumEven+0x6e>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     116d <SumEven+0x5d>
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x10(%rbp)
jmp    114a <SumEven+0x3a>
mov    -0xc(%rbp),%esi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SumEven>:
cmp    %esi,%edi
jle    1129 <SumEven+0x19>
lea    0xee5(%rip),%rdi
lea    0xee1(%rip),%rsi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xee3(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [16 x i8] c"Cannot execute!\00"
@.str.2 = [22 x i8] c"The even sum is: %u \0A\00"
define void @SumEven(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = icmp sgt i32 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %28
12: ; preds = %2
%13 = load i32, i32* %3
store i32 %13, i32* %6
br label %14
14: ; preds = %22, %12
%15 = load i32, i32* %6
%16 = load i32, i32* %4
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %25
18: ; preds = %14
%19 = load i32, i32* %6
%20 = load i32, i32* %5
%21 = add i32 %20, %19
store i32 %21, i32* %5
br label %22
22: ; preds = %18
%23 = load i32, i32* %6
%24 = add nsw i32 %23, 2
store i32 %24, i32* %6
br label %14
25: ; preds = %14
%26 = load i32, i32* %5
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %25, %10
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [16 x i8] c"Cannot execute!\00"
@.str.2 = [22 x i8] c"The even sum is: %u \0A\00"
define void @SumEven(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 undef)
br label %8
6: ; preds = %2
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %4, %6
ret void
}