#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 getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(int);
int main(int argc, const char *argv[]) {
  int c1, c2;
  c1 = getchar();
  c2 = getchar();
  printf("Output by putchar:\n");
  putchar(c1);
  putchar(c2);
  printf("\n");
  printf("Output by printf:\n");
  printf("%c%c\n", c1, c2);
  printf("Output ascii:\n");
  printf("%d %d\n", c1, c2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x18(%rbp)
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%edi
call   1030 <putchar@plt>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <getchar@plt>
mov    %eax,%ebp
lea    0xeb1(%rip),%rdi
call   1040 <puts@plt>
mov    %ebx,%edi
call   1030 <putchar@plt>
mov    %ebp,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xea0(%rip),%rdi
call   1040 <puts@plt>
lea    0xe74(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe94(%rip),%rdi
call   1040 <puts@plt>
lea    0xe5c(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Output by putchar:\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [19 x i8] c"Output by printf:\0A\00"
@.str.3 = [6 x i8] c"%c%c\0A\00"
@.str.4 = [15 x i8] c"Output ascii:\0A\00"
@.str.5 = [7 x i8] c"%d %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (...) @getchar()
store i32 %8, i32* %6
%9 = call i32 (...) @getchar()
store i32 %9, i32* %7
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* %6
%12 = call i32 @putchar(i32 %11)
%13 = load i32, i32* %7
%14 = call i32 @putchar(i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %17, i32 %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %21, i32 %22)
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [6 x i8] c"%c%c\0A\00"
@.str.5 = [7 x i8] c"%d %d\0A\00"
@str = [19 x i8] c"Output by putchar:\00"
@str.6 = [18 x i8] c"Output by printf:\00"
@str.7 = [14 x i8] c"Output ascii:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @getchar()
%4 = tail call i32 (...) @getchar()
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @putchar(i32 %3)
%7 = tail call i32 @putchar(i32 %4)
%8 = tail call i32 @putchar(i32 10)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.6, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %3, i32 %4)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.7, i64 0, i64 0))
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %3, i32 %4)
ret i32 0
}