#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*/ milli_delay(int);
int /*<<< orphan*/ printf(char *, ...);
void test_c() {
  int i = 150236;
  char str[] = "Hello, w~";
  while (1) {
    printf("%s\n", str);
    printf("%x\n", i++);
    printf("%d\n", i);
    milli_delay(10000);
  }
}


x86 assembly (clang, -O0):
<test_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x24adc,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0xe(%rbp)
mov    0xec7(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    -0xe(%rbp),%rsi
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    %eax,-0x4(%rbp)
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x2710,%edi
call   1040 <milli_delay@plt>
jmp    1145 <test_c+0x25>

x86 assembly (clang, -O2):
<test_c>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movabs $0x77202c6f6c6c6548,%rax
2c 20 77
mov    %rax,(%rsp)
movw   $0x7e,0x8(%rsp)
mov    $0x24adc,%ebx
mov    %rsp,%r14
lea    0xeaa(%rip),%r15
lea    0xea7(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0x1(%rbx),%ebp
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2710,%edi
call   1050 <milli_delay@plt>
mov    %ebp,%ebx
jmp    1170 <test_c+0x40>

LLVM IR (-O0):
@__const.test_c.str = [10 x i8] c"Hello, w~\00"
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [4 x i8] c"%x\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define void @test_c() {
%1 = alloca i32
%2 = alloca [10 x i8]
store i32 150236, i32* %1
%3 = bitcast [10 x i8]* %2 to i8*
br label %4
4: ; preds = %0, %4
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i32, i32* %1
%8 = add nsw i32 %7, 1
store i32 %8, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%10 = load i32, i32* %1
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = call i32 @milli_delay(i32 10000)
br label %4
}

LLVM IR (-O2):
@__const.test_c.str = [10 x i8] c"Hello, w~\00"
@.str.1 = [4 x i8] c"%x\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define void @test_c() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %3, %0
%4 = phi i32 [ 150236, %0 ], [ %6, %3 ]
%5 = call i32 @puts(i8* %2)
%6 = add nuw nsw i32 %4, 1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%9 = tail call i32 @milli_delay(i32 10000)
br label %3
}