int main(int argc, char *argv[]) {
  char c;
  printf("Enter a character and hit 'Return' to mirror it (and a '.' to quit). "
         "\n");
  do {
    c = getchar();
    putchar(c);
  } while (c != '.');
  printf("\n");
  char line[100];
  int a;
  float x;
  printf("Enter an integer: ");
  scanf("%i", &a);
  printf("You entered: %i \n", a);
  printf("Enter a short string: ");
  scanf("%s", line);
  printf("You entered: %s \n", &line);
  printf("Enter an integer, hit return, and enter a float: ");
  scanf("%i%f", &a, &x);
  printf("You entered: %i and %f\n", a, x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%edi
mov    $0x0,%al
call   1030 <putchar@plt>
movsbl -0x11(%rbp),%eax
cmp    $0x2e,%eax
jne    1167 <main+0x27>
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeae(%rip),%rdi
lea    -0x84(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x84(%rbp),%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x80(%rbp),%rsi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    0xe94(%rip),%rdi
lea    -0x80(%rbp),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    -0x84(%rbp),%rsi
lea    -0x88(%rbp),%rdx
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x84(%rbp),%esi
movss  -0x88(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
lea    0xe8f(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x78,%rsp
lea    0xf45(%rip),%rdi
call   1040 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1060 <getchar@plt>
movsbl %al,%edi
mov    %eax,%ebx
shl    $0x18,%ebx
xor    %eax,%eax
call   1030 <putchar@plt>
cmp    $0x2e000000,%ebx
jne    1170 <main+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe61(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe66(%rip),%rdi
lea    0x8(%rsp),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x8(%rsp),%esi
lea    0xe4f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe53(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe5c(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
lea    0xe49(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe4a(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe6e(%rip),%rdi
lea    0xc(%rsp),%rdx
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x8(%rsp),%esi
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe4f(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [71 x i8] c"Enter a character and hit 'Return' to mirror it (and a '.' to quit). \0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [19 x i8] c"Enter an integer: \00"
@.str.3 = [3 x i8] c"%i\00"
@.str.4 = [18 x i8] c"You entered: %i \0A\00"
@.str.5 = [23 x i8] c"Enter a short string: \00"
@.str.6 = [3 x i8] c"%s\00"
@.str.7 = [18 x i8] c"You entered: %s \0A\00"
@.str.8 = [50 x i8] c"Enter an integer, hit return, and enter a float: \00"
@.str.9 = [5 x i8] c"%i%f\00"
@.str.10 = [24 x i8] c"You entered: %i and %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca [100 x i8]
%8 = alloca i32
%9 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %17, %2
%12 = call i32 (...) @getchar()
%13 = trunc i32 %12 to i8
store i8 %13, i8* %6
%14 = load i8, i8* %6
%15 = sext i8 %14 to i32
%16 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %15)
br label %17
17: ; preds = %11
%18 = load i8, i8* %6
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 46
br i1 %20, label %11, label %21
21: ; preds = %17
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %8)
%25 = load i32, i32* %8
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %25)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), [100 x i8]* %7)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.8, i64 0, i64 0))
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i32* %8, float* %9)
%33 = load i32, i32* %8
%34 = load float, float* %9
%35 = fpext float %34 to double
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0), i32 %33, double %35)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [19 x i8] c"Enter an integer: \00"
@.str.3 = [3 x i8] c"%i\00"
@.str.4 = [18 x i8] c"You entered: %i \0A\00"
@.str.5 = [23 x i8] c"Enter a short string: \00"
@.str.6 = [3 x i8] c"%s\00"
@.str.7 = [18 x i8] c"You entered: %s \0A\00"
@.str.8 = [50 x i8] c"Enter an integer, hit return, and enter a float: \00"
@.str.9 = [5 x i8] c"%i%f\00"
@.str.10 = [24 x i8] c"You entered: %i and %f\0A\00"
@str = [70 x i8] c"Enter a character and hit 'Return' to mirror it (and a '.' to quit). \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100 x i8]
%4 = alloca i32
%5 = alloca float
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str, i64 0, i64 0))
br label %7
7: ; preds = %7, %2
%8 = tail call i32 (...) @getchar()
%9 = shl i32 %8, 24
%10 = ashr exact i32 %9, 24
%11 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %10)
%12 = icmp eq i32 %9, 771751936
br i1 %12, label %13, label %7
13: ; preds = %7
%14 = tail call i32 bitcast (i32 (...)* @putchar to i32 (i32)*)(i32 10)
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%16 = bitcast i32* %4 to i8*
%17 = bitcast float* %5 to i8*
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %4)
%20 = load i32, i32* %4
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* %15)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), [100 x i8]* %3)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.8, i64 0, i64 0))
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i32* %4, float* %5)
%27 = load i32, i32* %4
%28 = load float, float* %5
%29 = fpext float %28 to double
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0), i32 %27, double %29)
ret i32 0
}