#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 test(int is_space) {
  int i;
  for (i = 0; i < 10; i++) {
    if (is_space)
      printf("SPACE %d\n", i);
    else
      printf("NON-SPACE %d\n", i);
  }
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    116c <test+0x5c>
cmpl   $0x0,-0x8(%rbp)
je     114a <test+0x3a>
mov    -0xc(%rbp),%esi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
jmp    1159 <test+0x49>
mov    -0xc(%rbp),%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
jmp    115e <test+0x4e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1122 <test+0x12>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbx
test   %edi,%edi
lea    0xee6(%rip),%rax
lea    0xee3(%rip),%rbx
cmove  %rax,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"SPACE %d\0A\00"
@.str.1 = [14 x i8] c"NON-SPACE %d\0A\00"
define i32 @test(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %18, %1
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %21
8: ; preds = %5
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %4
%13 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %17
14: ; preds = %8
%15 = load i32, i32* %4
%16 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %14, %11
br label %18
18: ; preds = %17
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %5
21: ; preds = %5
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
@.str = [10 x i8] c"SPACE %d\0A\00"
@.str.1 = [14 x i8] c"NON-SPACE %d\0A\00"
define i32 @test(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0)
%4 = tail call i32 @printf(i8* %3, i32 0)
%5 = tail call i32 @printf(i8* %3, i32 1)
%6 = tail call i32 @printf(i8* %3, i32 2)
%7 = tail call i32 @printf(i8* %3, i32 3)
%8 = tail call i32 @printf(i8* %3, i32 4)
%9 = tail call i32 @printf(i8* %3, i32 5)
%10 = tail call i32 @printf(i8* %3, i32 6)
%11 = tail call i32 @printf(i8* %3, i32 7)
%12 = tail call i32 @printf(i8* %3, i32 8)
%13 = tail call i32 @printf(i8* %3, i32 9)
ret i32 undef
}