#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, l, j;
  printf("podaj liczbe: ");
  scanf("%d", &j);
  l = 0;
  for (i = 0; i < j; i++) {
    if (l == 0) {
      printf("* * * * * * *\n");
      l = 1;
    } else if (l == 1) {
      printf(" * * * * * * *\n");
      l = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11bc <main+0x9c>
cmpl   $0x0,-0xc(%rbp)
jne    1187 <main+0x67>
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
jmp    11a9 <main+0x89>
cmpl   $0x1,-0xc(%rbp)
jne    11a4 <main+0x84>
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
jmp    11a9 <main+0x89>
jmp    11ae <main+0x8e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1159 <main+0x39>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
call   1040 <printf@plt>
lea    0xec5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    118a <main+0x5a>
xor    %ebx,%ebx
lea    0xeaf(%rip),%r14
lea    0xea7(%rip),%r15
xor    %ebp,%ebp
nopl   (%rax)
test   %ebx,%ebx
mov    %r15,%rdi
cmove  %r14,%rdi
xor    $0x1,%ebx
call   1030 <puts@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jl     1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [15 x i8] c"podaj liczbe: \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [15 x i8] c" * * * * * * *\00"
@str.4 = [14 x i8] c"* * * * * * *\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %0, %7
%8 = phi i32 [ %12, %7 ], [ 0, %0 ]
%9 = phi i32 [ %14, %7 ], [ 0, %0 ]
%10 = icmp eq i32 %8, 0
%11 = select i1 %10, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0)
%12 = xor i32 %8, 1
%13 = call i32 @puts(i8* dereferenceable(1) %11)
%14 = add nuw nsw i32 %9, 1
%15 = load i32, i32* %1
%16 = icmp slt i32 %14, %15
br i1 %16, label %7, label %17
17: ; preds = %7, %0
ret i32 0
}