#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 main() {
  char ch;
  char str[100];
  printf("Enter any character \n");
  scanf("%c", &ch);
  printf("Entered character is %c \n", ch);
  printf("Enter any string ( upto 100 character ) \n");
  scanf("%s", &str);
  printf("Entered string is %s \n", str);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x1(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x1(%rbp),%esi
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
lea    -0x70(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    -0x70(%rbp),%rsi
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb5(%rip),%rdi
lea    0xf(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movsbl 0xf(%rsp),%esi
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
lea    0xea0(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe8d(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Enter any character \0A\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [26 x i8] c"Entered character is %c \0A\00"
@.str.3 = [42 x i8] c"Enter any string ( upto 100 character ) \0A\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [23 x i8] c"Entered string is %s \0A\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca [100 x i8]
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), [100 x i8]* %2)
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %10)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [26 x i8] c"Entered character is %c \0A\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [23 x i8] c"Entered string is %s \0A\00"
@str = [21 x i8] c"Enter any character \00"
@str.6 = [41 x i8] c"Enter any string ( upto 100 character ) \00"
define i32 @main() {
%1 = alloca i8
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%6 = load i8, i8* %1
%7 = sext i8 %6 to i32
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.6, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), [100 x i8]* %2)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %3)
ret i32 0
}