#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 i = 3;
  char j = '1';
  char myChar = 'B';
  int myInt = 2;
  printf("int i is:%d \n", i);
  printf("char j is: %c \n", j);
  i = (int)j;
  myInt = (int)myChar;
  printf("int i is:%d \n", i);
  printf("char j is: %c \n", j);
  printf("char myChar is casted as %d \n", myInt);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
movb   $0x31,-0x9(%rbp)
movb   $0x42,-0xa(%rbp)
movl   $0x2,-0x10(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x9(%rbp),%esi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x9(%rbp),%eax
mov    %eax,-0x8(%rbp)
movsbl -0xa(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x9(%rbp),%esi
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%r14
mov    %r14,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
lea    0xedf(%rip),%rbx
mov    %rbx,%rdi
mov    $0x31,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x31,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x31,%esi
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
mov    $0x42,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [14 x i8] c"int i is:%d \0A\00"
@.str.1 = [16 x i8] c"char j is: %c \0A\00"
@.str.2 = [30 x i8] c"char myChar is casted as %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
store i32 0, i32* %1
store i32 3, i32* %2
store i8 49, i8* %3
store i8 66, i8* %4
store i32 2, i32* %5
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
store i32 %12, i32* %2
%13 = load i8, i8* %4
%14 = sext i8 %13 to i32
store i32 %14, i32* %5
%15 = load i32, i32* %2
%16 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %5
%21 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"int i is:%d \0A\00"
@.str.1 = [16 x i8] c"char j is: %c \0A\00"
@.str.2 = [30 x i8] c"char myChar is casted as %d \0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 49)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 49)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 49)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 66)
ret i32 0
}