#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 *, char *, int);
int /*<<< orphan*/ puts(char *);
int main(void) {
  int counter = 1;
  while (counter <= 1000000000) {
    counter++;
    if ((counter % 100000000) == 0) {
      printf("%s%d\n", "The counter is: ", counter);
    }
  }
  puts("Finished adding!!!");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x3b9aca00,-0x8(%rbp)
jg     117b <main+0x5b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x5f5e100,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1176 <main+0x56>
mov    -0x8(%rbp),%edx
lea    0xe96(%rip),%rdi
lea    0xe95(%rip),%rsi
call   1040 <printf@plt>
jmp    1136 <main+0x16>
lea    0xe95(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x2,%ebx
lea    0xecf(%rip),%r14
lea    0xece(%rip),%r15
jmp    114b <main+0x2b>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    $0x3b9aca02,%ebx
je     1171 <main+0x51>
mov    %ebx,%eax
imul   $0x55e63b89,%rax,%rax
shr    $0x39,%rax
imul   $0x5f5e100,%eax,%eax
cmp    %eax,%ebx
jne    1140 <main+0x20>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1040 <printf@plt>
jmp    1140 <main+0x20>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s%d\0A\00"
@.str.1 = [17 x i8] c"The counter is: \00"
@.str.2 = [19 x i8] c"Finished adding!!!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
br label %3
3: ; preds = %15, %0
%4 = load i32, i32* %2
%5 = icmp sle i32 %4, 1000000000
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 1
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = srem i32 %9, 100000000
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %6
%13 = load i32, i32* %2
%14 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %12, %6
br label %3
16: ; preds = %3
%17 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s%d\0A\00"
@.str.1 = [17 x i8] c"The counter is: \00"
@.str.2 = [19 x i8] c"Finished adding!!!\00"
define i32 @main() {
br label %1
1: ; preds = %0, %8
%2 = phi i32 [ 1, %0 ], [ %3, %8 ]
%3 = add nuw nsw i32 %2, 1
%4 = urem i32 %3, 100000000
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %3)
br label %8
8: ; preds = %6, %1
%9 = icmp eq i32 %3, 1000000001
br i1 %9, label %10, label %1
10: ; preds = %8
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}