#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 printf(char *, ...);
int sprintf(char *, char *, char *);
main() {
  printf("Hello world!\n");
  typedef char *cp;
  cp a = "This is string A!";
  char buf[80];
  int count = sprintf(buf, ">>> %s <<<\n", a);
  printf("'%c',%scount=%d\n", '\0', buf, count);
  printf("%d,%d,%g\n", printf("Hello\n"), 0.1, 2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xed8(%rip),%rsi
call   1040 <sprintf@plt>
mov    %eax,-0x64(%rbp)
lea    -0x60(%rbp),%rdx
mov    -0x64(%rbp),%ecx
lea    0xece(%rip),%rdi
xor    %esi,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    %eax,%esi
lea    0xebf(%rip),%rdi
movsd  0xe72(%rip),%xmm0
mov    $0x2,%edx
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
lea    0xf0c(%rip),%rdi
call   1030 <puts@plt>
lea    0xed2(%rip),%rsi
lea    0xeb9(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <sprintf@plt>
lea    0xec5(%rip),%rdi
xor    %esi,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
movsd  0xe74(%rip),%xmm0
mov    %eax,%esi
mov    $0x2,%edx
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hello world!\0A\00"
@.str.1 = [18 x i8] c"This is string A!\00"
@.str.2 = [12 x i8] c">>> %s <<<\0A\00"
@.str.3 = [17 x i8] c"'%c',%scount=%d\0A\00"
@.str.4 = [10 x i8] c"%d,%d,%g\0A\00"
@.str.5 = [7 x i8] c"Hello\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = alloca [80 x i8]
%3 = alloca i32
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8** %1
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%6 = load i8*, i8** %1
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %6)
store i32 %7, i32* %3
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%9 = load i32, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 0, i8* %8, i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %11, double 1.000000e-01, i32 2)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [18 x i8] c"This is string A!\00"
@.str.2 = [12 x i8] c">>> %s <<<\0A\00"
@.str.3 = [17 x i8] c"'%c',%scount=%d\0A\00"
@.str.4 = [10 x i8] c"%d,%d,%g\0A\00"
@.str.5 = [7 x i8] c"Hello\0A\00"
@str = [13 x i8] c"Hello world!\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 0, i8* %3, i32 %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %6, double 1.000000e-01, i32 2)
ret i32 0
}