#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 *, char, ...);
int main(void) {
  unsigned char c;
  char d;
  int i;
  for (i = 0; i < 300; i++) {
    c = i * i;
    printf("i = %i, c = %i\n", i, c);
  }
  d = 0xFF;
  printf("(char)0xFF = %i\n", d);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x12c,-0xc(%rbp)
jge    1163 <main+0x53>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %al,-0x5(%rbp)
mov    -0xc(%rbp),%eax
movzbl -0x5(%rbp),%edx
lea    0xeb5(%rip),%rdi
movsbl %al,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1126 <main+0x16>
movb   $0xff,-0x6(%rbp)
lea    0xea2(%rip),%rdi
movsbl -0x6(%rbp),%esi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xee6(%rip),%rbx
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %ebp,%eax
imul   %ebp,%eax
movzbl %al,%edx
movsbl %bpl,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    $0x12c,%ebp
jne    1120 <main+0x10>
lea    0xec8(%rip),%rdi
mov    $0xffffffff,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"i = %i, c = %i\0A\00"
@.str.1 = [17 x i8] c"(char)0xFF = %i\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %7, %1 ]
%3 = mul nuw nsw i32 %2, %2
%4 = trunc i32 %2 to i8
%5 = and i32 %3, 255
%6 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8 signext %4, i32 %5)
%7 = add nuw nsw i32 %2, 1
%8 = icmp eq i32 %7, 300
br i1 %8, label %9, label %1
9: ; preds = %1
%10 = tail call i32 (i8*, i8, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8 signext -1)
ret i32 0
}