#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 */
typedef int /*<<< orphan*/ e;
typedef int /*<<< orphan*/ d;
typedef int /*<<< orphan*/ c;

/* Variables and functions */
int printf(char *, ...);
int strlen(char *);
int main() {
  char *c = "abcdef";
  char d[] = "abcdef";
  char e[] = {'a', 'b', 'c', 'd', 'e', 'f'};
  printf("%d %d\n", sizeof(c), strlen(c));
  printf("%d %d\n", sizeof(d), strlen(d));
  printf("%d %d\n", sizeof(e), strlen(e));
  printf("empty=%d\n", printf(""));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0xec7(%rip),%eax
mov    %eax,-0xf(%rbp)
mov    0xec1(%rip),%ax
mov    %ax,-0xb(%rbp)
mov    0xeb9(%rip),%al
mov    %al,-0x9(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x15(%rbp)
mov    0xebc(%rip),%ax
mov    %ax,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%edx
lea    0xe91(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xf(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%edx
lea    0xe73(%rip),%rdi
mov    $0x7,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x15(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%edx
lea    0xe55(%rip),%rdi
mov    $0x6,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    %eax,%esi
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x666564,0xb(%rsp)
movl   $0x64636261,0x8(%rsp)
64
lea    0xec4(%rip),%rdi
movw   $0x6665,0x4(%rsp)
movl   $0x64636261,(%rsp)
call   1030 <strlen@plt>
lea    0xeb1(%rip),%rbx
mov    $0x8,%esi
mov    %rbx,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rdi
call   1030 <strlen@plt>
mov    $0x7,%esi
mov    %rbx,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rdi
call   1030 <strlen@plt>
mov    $0x6,%esi
mov    %rbx,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe6c(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"abcdef\00"
@__const.main.d = [7 x i8] c"abcdef\00"
@__const.main.e = [6 x i8] c"abcdef"
@.str.1 = [7 x i8] c"%d %d\0A\00"
@.str.2 = [10 x i8] c"empty=%d\0A\00"
@.str.3 = [1 x i8] zeroinitializer
define i32 @main() {
%1 = alloca i8*
%2 = alloca [7 x i8]
%3 = alloca [6 x i8]
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %1
%4 = bitcast [7 x i8]* %2 to i8*
%5 = bitcast [6 x i8]* %3 to i8*
%6 = load i8*, i8** %1
%7 = call i32 @strlen(i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i64 8, i32 %7)
%9 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i64 7, i32 %10)
%12 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%13 = call i32 @strlen(i8* %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i64 6, i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %15)
ret i32 0
}

LLVM IR (-O2):
@__const.main.d = [7 x i8] c"abcdef\00"
@__const.main.e = [6 x i8] c"abcdef"
@.str.1 = [7 x i8] c"%d %d\0A\00"
@.str.2 = [10 x i8] c"empty=%d\0A\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = alloca [6 x i8]
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @__const.main.d, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i64 8, i32 %5)
%7 = call i32 @strlen(i8* %3)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i64 7, i32 %7)
%9 = call i32 @strlen(i8* %4)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i64 6, i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 0)
ret i32 0
}