#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 /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  int i, ulang;
  int jumlah_genap, jumlah_ganjil, total;
  int atas, bawah;
  jumlah_ganjil = 0;
  jumlah_genap = 0;
  printf("Masukkan batas atas = ");
  scanf("%i", &atas);
  printf("Masukkan batas bawah = ");
  scanf("%i", &bawah);
  printf("Jumlah Ganjil\n");
  for (i = bawah; i <= atas; i++) {
    if (i % 2 == 1) {
      printf("%i", i);
      if (i < atas - 1) {
        printf(" + ");
      }
      jumlah_ganjil = i + jumlah_ganjil;
    }
  }
  printf(" = %i\n", jumlah_ganjil);
  printf("\n");
  printf("Jumlah Genap\n");
  for (i = atas; i >= bawah; i--) {
    if (i % 2 == 0) {
      printf("%i", i);
      if (bawah % 2 == 1) {
        if (i > bawah + 1) {
          printf(" + ");
        }
      } else if (bawah % 2 == 0) {
        if (i > bawah) {
          printf(" + ");
        }
      }
      jumlah_genap = i + jumlah_genap;
    }
  }
  printf(" = %i\n", jumlah_genap);
  printf("\n");
  total = jumlah_ganjil + jumlah_genap;
  printf("Total = %i\n\n", total);
  system("PAUSE");
  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)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeae(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe90(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x28(%rbp),%eax
jg     1210 <main+0xe0>
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    11fd <main+0xcd>
mov    -0x14(%rbp),%esi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
mov    -0x28(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    11f4 <main+0xc4>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    1202 <main+0xd2>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a4 <main+0x74>
mov    -0x20(%rbp),%esi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jl     1300 <main+0x1d0>
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    12ed <main+0x1bd>
mov    -0x14(%rbp),%esi
lea    0xdaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    12ac <main+0x17c>
mov    -0x14(%rbp),%eax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jle    12a7 <main+0x177>
lea    0xda1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12e4 <main+0x1b4>
mov    -0x2c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    12df <main+0x1af>
mov    -0x14(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jle    12da <main+0x1aa>
lea    0xd6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12df <main+0x1af>
jmp    12e4 <main+0x1b4>
mov    -0x14(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    12f2 <main+0x1c2>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1243 <main+0x113>
mov    -0x1c(%rbp),%esi
lea    0xd3b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd4d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xd28(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd27(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe9d(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xea3(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0xead(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%ebx
mov    0xc(%rsp),%eax
mov    $0x0,%ebp
cmp    %eax,%ebx
jle    1238 <main+0xe8>
lea    0xe76(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe84(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%ebx
mov    0x8(%rsp),%eax
cmp    %eax,%ebx
jge    1299 <main+0x149>
lea    0xe40(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    %r14d,%ebp
lea    0xe29(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe26(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdd8(%rip),%r15
lea    0xdec(%rip),%r12
xor    %ebp,%ebp
jmp    125f <main+0x10f>
nopw   0x0(%rax,%rax,1)
add    %ebx,%ebp
lea    0x1(%rbx),%ecx
cmp    %eax,%ebx
mov    %ecx,%ebx
jge    11b9 <main+0x69>
mov    %ebx,%ecx
shr    $0x1f,%ecx
add    %ebx,%ecx
and    $0xfffffffe,%ecx
mov    %ebx,%edx
sub    %ecx,%edx
cmp    $0x1,%edx
jne    1252 <main+0x102>
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    %ecx,%ebx
jge    1250 <main+0x100>
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0xc(%rsp),%eax
jmp    1250 <main+0x100>
lea    0xd77(%rip),%r15
lea    0xd8b(%rip),%r12
xor    %r14d,%r14d
jmp    12c4 <main+0x174>
nopl   0x0(%rax)
add    %ebx,%r14d
mov    0x8(%rsp),%eax
lea    -0x1(%rbx),%ecx
cmp    %eax,%ebx
mov    %ecx,%ebx
jle    11ef <main+0x9f>
test   $0x1,%bl
jne    12b7 <main+0x167>
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%rsp),%eax
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
and    $0xfffffffe,%edx
mov    %eax,%ecx
sub    %edx,%ecx
je     12f1 <main+0x1a1>
cmp    $0x1,%ecx
jne    12b0 <main+0x160>
add    $0x1,%eax
cmp    %eax,%ebx
jle    12b0 <main+0x160>
mov    %r12,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    12b0 <main+0x160>

LLVM IR (-O0):
@.str = [23 x i8] c"Masukkan batas atas = \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [24 x i8] c"Masukkan batas bawah = \00"
@.str.3 = [15 x i8] c"Jumlah Ganjil\0A\00"
@.str.4 = [4 x i8] c" + \00"
@.str.5 = [7 x i8] c" = %i\0A\00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [14 x i8] c"Jumlah Genap\0A\00"
@.str.8 = [13 x i8] c"Total = %i\0A\0A\00"
@.str.9 = [6 x i8] c"PAUSE\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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
store i32 0, i32* %8
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %11)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%18 = load i32, i32* %12
store i32 %18, i32* %6
br label %19
19: ; preds = %41, %2
%20 = load i32, i32* %6
%21 = load i32, i32* %11
%22 = icmp sle i32 %20, %21
br i1 %22, label %23, label %44
23: ; preds = %19
%24 = load i32, i32* %6
%25 = srem i32 %24, 2
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %40
27: ; preds = %23
%28 = load i32, i32* %6
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %6
%31 = load i32, i32* %11
%32 = sub nsw i32 %31, 1
%33 = icmp slt i32 %30, %32
br i1 %33, label %34, label %36
34: ; preds = %27
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %36
36: ; preds = %34, %27
%37 = load i32, i32* %6
%38 = load i32, i32* %9
%39 = add nsw i32 %37, %38
store i32 %39, i32* %9
br label %40
40: ; preds = %36, %23
br label %41
41: ; preds = %40
%42 = load i32, i32* %6
%43 = add nsw i32 %42, 1
store i32 %43, i32* %6
br label %19
44: ; preds = %19
%45 = load i32, i32* %9
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %45)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
%49 = load i32, i32* %11
store i32 %49, i32* %6
br label %50
50: ; preds = %89, %44
%51 = load i32, i32* %6
%52 = load i32, i32* %12
%53 = icmp sge i32 %51, %52
br i1 %53, label %54, label %92
54: ; preds = %50
%55 = load i32, i32* %6
%56 = srem i32 %55, 2
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %88
58: ; preds = %54
%59 = load i32, i32* %6
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %59)
%61 = load i32, i32* %12
%62 = srem i32 %61, 2
%63 = icmp eq i32 %62, 1
br i1 %63, label %64, label %72
64: ; preds = %58
%65 = load i32, i32* %6
%66 = load i32, i32* %12
%67 = add nsw i32 %66, 1
%68 = icmp sgt i32 %65, %67
br i1 %68, label %69, label %71
69: ; preds = %64
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %71
71: ; preds = %69, %64
br label %84
72: ; preds = %58
%73 = load i32, i32* %12
%74 = srem i32 %73, 2
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %83
76: ; preds = %72
%77 = load i32, i32* %6
%78 = load i32, i32* %12
%79 = icmp sgt i32 %77, %78
br i1 %79, label %80, label %82
80: ; preds = %76
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %82
82: ; preds = %80, %76
br label %83
83: ; preds = %82, %72
br label %84
84: ; preds = %83, %71
%85 = load i32, i32* %6
%86 = load i32, i32* %8
%87 = add nsw i32 %85, %86
store i32 %87, i32* %8
br label %88
88: ; preds = %84, %54
br label %89
89: ; preds = %88
%90 = load i32, i32* %6
%91 = add nsw i32 %90, -1
store i32 %91, i32* %6
br label %50
92: ; preds = %50
%93 = load i32, i32* %8
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %93)
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%96 = load i32, i32* %9
%97 = load i32, i32* %8
%98 = add nsw i32 %96, %97
store i32 %98, i32* %10
%99 = load i32, i32* %10
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 %99)
%101 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Masukkan batas atas = \00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [24 x i8] c"Masukkan batas bawah = \00"
@.str.4 = [4 x i8] c" + \00"
@.str.5 = [7 x i8] c" = %i\0A\00"
@.str.8 = [13 x i8] c"Total = %i\0A\0A\00"
@.str.9 = [6 x i8] c"PAUSE\00"
@str = [14 x i8] c"Jumlah Ganjil\00"
@str.10 = [13 x i8] c"Jumlah Genap\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 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* %3)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 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* %4)
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = icmp sgt i32 %12, %13
br i1 %14, label %37, label %15
15: ; preds = %2, %32
%16 = phi i32 [ %33, %32 ], [ %13, %2 ]
%17 = phi i32 [ %35, %32 ], [ %12, %2 ]
%18 = phi i32 [ %34, %32 ], [ 0, %2 ]
%19 = srem i32 %17, 2
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %32
21: ; preds = %15
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%23 = load i32, i32* %3
%24 = add nsw i32 %23, -1
%25 = icmp slt i32 %17, %24
br i1 %25, label %26, label %29
26: ; preds = %21
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%28 = load i32, i32* %3
br label %29
29: ; preds = %26, %21
%30 = phi i32 [ %28, %26 ], [ %23, %21 ]
%31 = add nsw i32 %17, %18
br label %32
32: ; preds = %15, %29
%33 = phi i32 [ %30, %29 ], [ %16, %15 ]
%34 = phi i32 [ %31, %29 ], [ %18, %15 ]
%35 = add nsw i32 %17, 1
%36 = icmp slt i32 %17, %33
br i1 %36, label %15, label %37
37: ; preds = %32, %2
%38 = phi i32 [ 0, %2 ], [ %34, %32 ]
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %38)
%40 = call i32 @putchar(i32 10)
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.10, i64 0, i64 0))
%42 = load i32, i32* %3
%43 = load i32, i32* %4
%44 = icmp slt i32 %42, %43
br i1 %44, label %70, label %45
45: ; preds = %37, %65
%46 = phi i32 [ %66, %65 ], [ %43, %37 ]
%47 = phi i32 [ %68, %65 ], [ %42, %37 ]
%48 = phi i32 [ %67, %65 ], [ 0, %37 ]
%49 = and i32 %47, 1
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %65
51: ; preds = %45
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %47)
%53 = load i32, i32* %4
%54 = srem i32 %53, 2
switch i32 %54, label %62 [
i32 1, label %55
i32 0, label %58
]
55: ; preds = %51
%56 = add nsw i32 %53, 1
%57 = icmp sgt i32 %47, %56
br i1 %57, label %60, label %62
58: ; preds = %51
%59 = icmp sgt i32 %47, %53
br i1 %59, label %60, label %62
60: ; preds = %58, %55
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %62
62: ; preds = %60, %51, %58, %55
%63 = add nsw i32 %47, %48
%64 = load i32, i32* %4
br label %65
65: ; preds = %45, %62
%66 = phi i32 [ %64, %62 ], [ %46, %45 ]
%67 = phi i32 [ %63, %62 ], [ %48, %45 ]
%68 = add nsw i32 %47, -1
%69 = icmp sgt i32 %47, %66
br i1 %69, label %45, label %70
70: ; preds = %65, %37
%71 = phi i32 [ 0, %37 ], [ %67, %65 ]
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %71)
%73 = call i32 @putchar(i32 10)
%74 = add nsw i32 %71, %38
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 %74)
%76 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
ret i32 0
}