#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 */
char EOF;
int /*<<< orphan*/ forma_binarna_znaku(char);
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char z;
  z = getchar();
  while (z != EOF) {
    if (z != '\n') {
      printf("wartosc znaku %c wynosi %i \n", z, z);
      forma_binarna_znaku(z);
      printf("\n");
    }
    z = getchar();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    0x2e94(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11a8 <main+0x78>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
je     1199 <main+0x69>
movsbl -0x5(%rbp),%esi
movsbl -0x5(%rbp),%edx
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x5(%rbp),%edi
call   1050 <forma_binarna_znaku@plt>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
jmp    1149 <main+0x19>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e96(%rip),%rbx
cmp    (%rbx),%al
jne    115d <main+0x1d>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe9c(%rip),%r14
jmp    117b <main+0x3b>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%al
je     1156 <main+0x16>
cmp    $0xa,%al
je     1170 <main+0x30>
movsbl %al,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%edi
call   1060 <forma_binarna_znaku@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1170 <main+0x30>

LLVM IR (-O0):
@EOF = global i8 0
@.str = [29 x i8] c"wartosc znaku %c wynosi %i \0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call signext i8 (...) @getchar()
store i8 %3, i8* %2
br label %4
4: ; preds = %23, %0
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = load i8, i8* @EOF
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %6, %8
br i1 %9, label %10, label %25
10: ; preds = %4
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 10
br i1 %13, label %14, label %23
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %18)
%20 = load i8, i8* %2
%21 = call i32 @forma_binarna_znaku(i8 signext %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %14, %10
%24 = call signext i8 (...) @getchar()
store i8 %24, i8* %2
br label %4
25: ; preds = %4
%26 = load i32, i32* %1
ret i32 %26
}

LLVM IR (-O2):
@EOF = global i8 0
@.str = [29 x i8] c"wartosc znaku %c wynosi %i \0A\00"
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = load i8, i8* @EOF
%3 = icmp eq i8 %1, %2
br i1 %3, label %16, label %4
4: ; preds = %0, %12
%5 = phi i8 [ %13, %12 ], [ %1, %0 ]
%6 = icmp eq i8 %5, 10
br i1 %6, label %12, label %7
7: ; preds = %4
%8 = sext i8 %5 to i32
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %8)
%10 = tail call i32 @forma_binarna_znaku(i8 signext %5)
%11 = tail call i32 @putchar(i32 10)
br label %12
12: ; preds = %7, %4
%13 = tail call signext i8 (...) @getchar()
%14 = load i8, i8* @EOF
%15 = icmp eq i8 %13, %14
br i1 %15, label %16, label %4
16: ; preds = %12, %0
ret i32 0
}