#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);
int main(int argc, char **argv) {
  for (int x = 5; x; --x) {
    printf("x is %d\n", x);
  }
  int ia[] = {1, 2, 3, 4, 5, 0};
  for (int *ip = ia; *ip; ++ip) {
    printf("value is %d\n", *ip);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1154 <main+0x44>
mov    -0x14(%rbp),%esi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
mov    0xec5(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec2(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebf(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmpl   $0x0,(%rax)
je     11ad <main+0x9d>
mov    -0x38(%rbp),%rax
mov    (%rax),%esi
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x38(%rbp)
jmp    117d <main+0x6d>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xee1(%rip),%r14
mov    %r14,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    $0x1,%ebp
mov    %r14,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    0xec4(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xea8(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x4(%rsp),%rbx
lea    0xe81(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
mov    (%rbx),%ebp
add    $0x4,%rbx
test   %ebp,%ebp
jne    1190 <main+0x80>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"x is %d\0A\00"
@__const.main.ia = [6 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 0]
@.str.1 = [13 x i8] c"value is %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [6 x i32]
%8 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 5, i32* %6
br label %9
9: ; preds = %15, %2
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = load i32, i32* %6
%14 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %12
%16 = load i32, i32* %6
%17 = add nsw i32 %16, -1
store i32 %17, i32* %6
br label %9
18: ; preds = %9
%19 = bitcast [6 x i32]* %7 to i8*
%20 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 0
store i32* %20, i32** %8
br label %21
21: ; preds = %29, %18
%22 = load i32*, i32** %8
%23 = load i32, i32* %22
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %32
25: ; preds = %21
%26 = load i32*, i32** %8
%27 = load i32, i32* %26
%28 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %25
%30 = load i32*, i32** %8
%31 = getelementptr inbounds i32, i32* %30, i32 1
store i32* %31, i32** %8
br label %21
32: ; preds = %21
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"x is %d\0A\00"
@__const.main.ia = [6 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 0]
@.str.1 = [13 x i8] c"value is %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [6 x i32]
%4 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 5)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 3)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 2)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 1)
%9 = bitcast [6 x i32]* %3 to i8*
%10 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
br label %12
11: ; preds = %12
ret i32 0
12: ; preds = %2, %12
%13 = phi i32 [ %17, %12 ], [ 1, %2 ]
%14 = phi i32* [ %16, %12 ], [ %10, %2 ]
%15 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%16 = getelementptr inbounds i32, i32* %14, i64 1
%17 = load i32, i32* %16
%18 = icmp eq i32 %17, 0
br i1 %18, label %11, label %12
}