#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*/ duff(char *, char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char input[] = "sharatmrarun";
  char output[] = "hello how do u do";
  int count;
  printf("input is %s\n", input);
  duff(input, output, 10);
  printf("Output is %s\n", input);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x11(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xec3(%rip),%al
mov    %al,-0x5(%rbp)
mov    0xedd(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xed7(%rip),%ax
mov    %ax,-0x20(%rbp)
lea    -0x11(%rbp),%rsi
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
lea    -0x11(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    $0xa,%edx
call   1040 <duff@plt>
lea    -0x11(%rbp),%rsi
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movabs $0x6e757261726d74,%rax
mov    %rax,0x5(%rsp)
movabs $0x726d746172616873,%rax
74 6d 72
mov    %rax,(%rsp)
movaps 0xee7(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movw   $0x6f,0x20(%rsp)
lea    0xeb1(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
call   1040 <duff@plt>
lea    0xe9a(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.input = [13 x i8] c"sharatmrarun\00"
@__const.main.output = [18 x i8] c"hello how do u do\00"
@.str = [13 x i8] c"input is %s\0A\00"
@.str.1 = [14 x i8] c"Output is %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [13 x i8]
%3 = alloca [18 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [13 x i8]* %2 to i8*
%6 = bitcast [18 x i8]* %3 to i8*
%7 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%10 = getelementptr inbounds [18 x i8], [18 x i8]* %3, i64 0, i64 0
%11 = call i32 @duff(i8* %9, i8* %10, i32 10)
%12 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %12)
ret i32 0
}

LLVM IR (-O2):
@__const.main.input = [13 x i8] c"sharatmrarun\00"
@__const.main.output = [18 x i8] c"hello how do u do\00"
@.str = [13 x i8] c"input is %s\0A\00"
@.str.1 = [14 x i8] c"Output is %s\0A\00"
define i32 @main() {
%1 = alloca [13 x i8]
%2 = alloca [18 x i8]
%3 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [18 x i8], [18 x i8]* %2, i64 0, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = call i32 @duff(i8* %3, i8* %4, i32 10)
%7 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret i32 0
}