#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  int i;
  for (i = 0; i < 10; i++) {
    char stdout_string[] = "Normal message no:  .";
    char stderr_string[] = "Error message no:  .";
    stdout_string[19] = '0' + i;
    stderr_string[18] = '0' + i;
    sleep(1);
    fprintf(stdout, "%s\n", stdout_string);
    fflush(stdout);
    sleep(1);
    fflush(stderr);
    fprintf(stderr, "%s\n", stderr_string);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    122b <main+0xfb>
mov    0xea2(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe9f(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe9d(%rip),%eax
mov    %eax,-0x20(%rbp)
mov    0xe97(%rip),%ax
mov    %ax,-0x1c(%rbp)
mov    0xe98(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe95(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xe93(%rip),%eax
mov    %eax,-0x40(%rbp)
mov    0xe8e(%rip),%al
mov    %al,-0x3c(%rbp)
mov    -0x14(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x1d(%rbp)
mov    -0x14(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x3e(%rbp)
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    0x2e0c(%rip),%rax
mov    (%rax),%edi
lea    -0x30(%rbp),%rdx
lea    0xe5c(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2df3(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    0x2de3(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    0x2dd5(%rip),%rax
mov    (%rax),%edi
lea    -0x50(%rbp),%rdx
lea    0xe1d(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114d <main+0x1d>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    $0xfffffff6,%ebx
movabs $0x2e20203a6f6e20,%r13
mov    0x2e84(%rip),%rbp
lea    0xeda(%rip),%r12
mov    0x2e7e(%rip),%r14
mov    %rsp,%r15
cs nopw 0x0(%rax,%rax,1)
nop
movaps 0xe89(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    %r13,0x2e(%rsp)
mov    %r13,0xd(%rsp)
movaps 0xe93(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x3a(%rbx),%eax
mov    %al,0x33(%rsp)
mov    %al,0x12(%rsp)
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    0x0(%rbp),%edi
mov    %r12,%rsi
lea    0x20(%rsp),%rdx
call   1030 <fprintf@plt>
mov    0x0(%rbp),%edi
call   1040 <fflush@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    (%r14),%edi
call   1040 <fflush@plt>
mov    (%r14),%edi
mov    %r12,%rsi
mov    %r15,%rdx
call   1030 <fprintf@plt>
inc    %ebx
jne    1170 <main+0x40>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.stdout_string = [22 x i8] c"Normal message no: .\00"
@__const.main.stderr_string = [21 x i8] c"Error message no: .\00"
@stdout = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@stderr = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [22 x i8]
%8 = alloca [21 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %9
9: ; preds = %35, %2
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 10
br i1 %11, label %12, label %38
12: ; preds = %9
%13 = bitcast [22 x i8]* %7 to i8*
%14 = bitcast [21 x i8]* %8 to i8*
%15 = load i32, i32* %6
%16 = add nsw i32 48, %15
%17 = trunc i32 %16 to i8
%18 = getelementptr inbounds [22 x i8], [22 x i8]* %7, i64 0, i64 19
store i8 %17, i8* %18
%19 = load i32, i32* %6
%20 = add nsw i32 48, %19
%21 = trunc i32 %20 to i8
%22 = getelementptr inbounds [21 x i8], [21 x i8]* %8, i64 0, i64 18
store i8 %21, i8* %22
%23 = call i32 @sleep(i32 1)
%24 = load i32, i32* @stdout
%25 = getelementptr inbounds [22 x i8], [22 x i8]* %7, i64 0, i64 0
%26 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %25)
%27 = load i32, i32* @stdout
%28 = call i32 @fflush(i32 %27)
%29 = call i32 @sleep(i32 1)
%30 = load i32, i32* @stderr
%31 = call i32 @fflush(i32 %30)
%32 = load i32, i32* @stderr
%33 = getelementptr inbounds [21 x i8], [21 x i8]* %8, i64 0, i64 0
%34 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %12
%36 = load i32, i32* %6
%37 = add nsw i32 %36, 1
store i32 %37, i32* %6
br label %9
38: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@__const.main.stdout_string = [22 x i8] c"Normal message no: .\00"
@__const.main.stderr_string = [21 x i8] c"Error message no: .\00"
@stdout = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@stderr = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [22 x i8]
%4 = alloca [21 x i8]
%5 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 19
%8 = getelementptr inbounds [21 x i8], [21 x i8]* %4, i64 0, i64 18
br label %9
9: ; preds = %2, %9
%10 = phi i32 [ 0, %2 ], [ %23, %9 ]
%11 = trunc i32 %10 to i8
%12 = add nuw nsw i8 %11, 48
store i8 %12, i8* %7
store i8 %12, i8* %8
%13 = call i32 @sleep(i32 1)
%14 = load i32, i32* @stdout
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%16 = load i32, i32* @stdout
%17 = call i32 @fflush(i32 %16)
%18 = call i32 @sleep(i32 1)
%19 = load i32, i32* @stderr
%20 = call i32 @fflush(i32 %19)
%21 = load i32, i32* @stderr
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
%23 = add nuw nsw i32 %10, 1
%24 = icmp eq i32 %23, 10
br i1 %24, label %25, label %9
25: ; preds = %9
ret i32 0
}