#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 main() {
  int nums[21];
  int total = 0;
  int i;
  int i2 = 0;
  printf("----------\n");
  for (i = 0; i < 41; i += 1) {
    if (((i + 1) % 2) == 1) {
      nums[i2] = i + 1;
      i2 += 1;
    }
  }
  for (i = 0; i < 21; i += 1) {
    printf("%d ", nums[i]);
    total += nums[i];
  }
  printf("\n----------\n");
  printf("Total: %d", total);
  printf("\n----------");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x64(%rbp)
movl   $0x0,-0x6c(%rbp)
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x68(%rbp)
cmpl   $0x29,-0x68(%rbp)
jge    1186 <main+0x76>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    1173 <main+0x63>
mov    -0x68(%rbp),%ecx
add    $0x1,%ecx
movslq -0x6c(%rbp),%rax
mov    %ecx,-0x60(%rbp,%rax,4)
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    1178 <main+0x68>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    113b <main+0x2b>
movl   $0x0,-0x68(%rbp)
cmpl   $0x15,-0x68(%rbp)
jge    11c9 <main+0xb9>
movslq -0x68(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%esi
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x68(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%eax
add    -0x64(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    118d <main+0x7d>
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x64(%rbp),%esi
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
lea    0x1(%rax),%ecx
mov    %ecx,(%rsp,%rax,2)
cmp    $0x28,%eax
je     1151 <main+0x31>
add    $0x2,%rax
jmp    1140 <main+0x20>
mov    (%rsp),%ebp
lea    0xea5(%rip),%r14
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%ebx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
mov    0x8(%rsp),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
mov    0xc(%rsp),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
mov    0x10(%rsp),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
mov    0x14(%rsp),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
mov    0x18(%rsp),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
mov    0x1c(%rsp),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
mov    0x20(%rsp),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
mov    0x24(%rsp),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
mov    0x28(%rsp),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
mov    0x2c(%rsp),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
mov    0x30(%rsp),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
mov    0x34(%rsp),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
mov    0x38(%rsp),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
mov    0x3c(%rsp),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
mov    0x40(%rsp),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
mov    0x44(%rsp),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
mov    0x48(%rsp),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
mov    0x4c(%rsp),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
mov    0x50(%rsp),%ebp
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %ebp,%ebx
lea    0xd38(%rip),%rbp
mov    %rbp,%rdi
call   1030 <puts@plt>
lea    0xd1f(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d \00"
@.str.3 = [10 x i8] c"Total: %d\00"
@str = [11 x i8] c"----------\00"
@str.5 = [12 x i8] c"\0A----------\00"
define void @main() {
%1 = alloca [21 x i32]
%2 = bitcast [21 x i32]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %12, %0
%5 = phi i32 [ 0, %0 ], [ %10, %12 ]
%6 = phi i32 [ 0, %0 ], [ %13, %12 ]
%7 = or i32 %6, 1
%8 = sext i32 %5 to i64
%9 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 %8
store i32 %7, i32* %9
%10 = add nsw i32 %5, 1
%11 = icmp eq i32 %7, 41
br i1 %11, label %14, label %12
12: ; preds = %4
%13 = add nuw nsw i32 %6, 2
br label %4
14: ; preds = %4
%15 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 0
%16 = load i32, i32* %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 1
%19 = load i32, i32* %18
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = add nsw i32 %19, %16
%22 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 2
%23 = load i32, i32* %22
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = add nsw i32 %23, %21
%26 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 3
%27 = load i32, i32* %26
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = add nsw i32 %27, %25
%30 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 4
%31 = load i32, i32* %30
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = add nsw i32 %31, %29
%34 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 5
%35 = load i32, i32* %34
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %35)
%37 = add nsw i32 %35, %33
%38 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 6
%39 = load i32, i32* %38
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %39)
%41 = add nsw i32 %39, %37
%42 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 7
%43 = load i32, i32* %42
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %43)
%45 = add nsw i32 %43, %41
%46 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 8
%47 = load i32, i32* %46
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %47)
%49 = add nsw i32 %47, %45
%50 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 9
%51 = load i32, i32* %50
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %51)
%53 = add nsw i32 %51, %49
%54 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 10
%55 = load i32, i32* %54
%56 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %55)
%57 = add nsw i32 %55, %53
%58 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 11
%59 = load i32, i32* %58
%60 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %59)
%61 = add nsw i32 %59, %57
%62 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 12
%63 = load i32, i32* %62
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %63)
%65 = add nsw i32 %63, %61
%66 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 13
%67 = load i32, i32* %66
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %67)
%69 = add nsw i32 %67, %65
%70 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 14
%71 = load i32, i32* %70
%72 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %71)
%73 = add nsw i32 %71, %69
%74 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 15
%75 = load i32, i32* %74
%76 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %75)
%77 = add nsw i32 %75, %73
%78 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 16
%79 = load i32, i32* %78
%80 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %79)
%81 = add nsw i32 %79, %77
%82 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 17
%83 = load i32, i32* %82
%84 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %83)
%85 = add nsw i32 %83, %81
%86 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 18
%87 = load i32, i32* %86
%88 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %87)
%89 = add nsw i32 %87, %85
%90 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 19
%91 = load i32, i32* %90
%92 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %91)
%93 = add nsw i32 %91, %89
%94 = getelementptr inbounds [21 x i32], [21 x i32]* %1, i64 0, i64 20
%95 = load i32, i32* %94
%96 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %95)
%97 = add nsw i32 %95, %93
%98 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.5, i64 0, i64 0))
%99 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %97)
%100 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.5, i64 0, i64 0))
ret void
}