#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 *, char *);
char *strdup(char *);
int main(int argc, char *argv[]) {
  printf("toto => %s\n", strdup("toto"));
  printf("toto => %s\n", strdup("toto"));
  printf("toto => %s\n", strdup("toto"));
  printf(" => %s\n", strdup(""));
  printf(" => %s\n", strdup(""));
  printf("abcdefghijkl => %s\n", strdup("abcdefghijkl"));
  printf("abcdefghijkl => %s\n", strdup("abcdefghijkl"));
  printf("abcdefghijkl => %s\n", strdup("abcdefghijkl"));
  printf("abcdefghijkl => %s\n", strdup("abcdefghijkl"));
  printf("abcdefghijkl => %s\n", strdup("i"));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xecf(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,%rsi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,%rsi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
lea    0xe99(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,%rsi
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
lea    0xe96(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,%rsi
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
lea    0xe7b(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,%rsi
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
lea    0xe61(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,%rsi
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
lea    0xe46(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,%rsi
lea    0xe23(%rip),%rdi
call   1030 <printf@plt>
lea    0xe2b(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,%rsi
lea    0xe08(%rip),%rdi
call   1030 <printf@plt>
lea    0xe10(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,%rsi
lea    0xded(%rip),%rdi
call   1030 <printf@plt>
lea    0xe02(%rip),%rdi
call   1040 <strdup@plt>
mov    %rax,%rsi
lea    0xdd2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee1(%rip),%r14
mov    %r14,%rdi
call   1040 <strdup@plt>
lea    0xec6(%rip),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <strdup@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <strdup@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
lea    0xeb2(%rip),%r14
mov    %r14,%rdi
call   1040 <strdup@plt>
lea    0xe9c(%rip),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <strdup@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
lea    0xe7f(%rip),%r14
mov    %r14,%rdi
call   1040 <strdup@plt>
lea    0xe5c(%rip),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <strdup@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <strdup@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %r14,%rdi
call   1040 <strdup@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
lea    0xe32(%rip),%rdi
call   1040 <strdup@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"toto => %s\0A\00"
@.str.1 = [5 x i8] c"toto\00"
@.str.2 = [8 x i8] c" => %s\0A\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [20 x i8] c"abcdefghijkl => %s\0A\00"
@.str.5 = [13 x i8] c"abcdefghijkl\00"
@.str.6 = [2 x i8] c"i\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i8* @strdup(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = call i8* @strdup(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = call i8* @strdup(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = call i8* @strdup(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = call i8* @strdup(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %14)
%16 = call i8* @strdup(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %16)
%18 = call i8* @strdup(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %18)
%20 = call i8* @strdup(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%21 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %20)
%22 = call i8* @strdup(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%23 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %22)
%24 = call i8* @strdup(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%25 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"toto => %s\0A\00"
@.str.1 = [5 x i8] c"toto\00"
@.str.2 = [8 x i8] c" => %s\0A\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [20 x i8] c"abcdefghijkl => %s\0A\00"
@.str.5 = [13 x i8] c"abcdefghijkl\00"
@.str.6 = [2 x i8] c"i\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call dereferenceable_or_null(5) i8* @strdup(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = tail call dereferenceable_or_null(5) i8* @strdup(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call dereferenceable_or_null(5) i8* @strdup(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = tail call dereferenceable_or_null(1) i8* @strdup(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%10 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%11 = tail call dereferenceable_or_null(1) i8* @strdup(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%12 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %11)
%13 = tail call dereferenceable_or_null(13) i8* @strdup(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%14 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %13)
%15 = tail call dereferenceable_or_null(13) i8* @strdup(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%16 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %15)
%17 = tail call dereferenceable_or_null(13) i8* @strdup(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%18 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %17)
%19 = tail call dereferenceable_or_null(13) i8* @strdup(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%20 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %19)
%21 = tail call dereferenceable_or_null(2) i8* @strdup(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%22 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %21)
ret i32 0
}