#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*/ displayString(char *);
int /*<<< orphan*/ displayStringUsingPointer(char *);
int /*<<< orphan*/ printf(char *, ...);
void messWithStringFunctions() {
  char foo[] = "Hello World!";
  displayString(foo);
  displayStringUsingPointer(foo);
  {
    int foo = 3;
    printf("foo is %d\n", foo);
  }
  printf("foo is %s\n", foo);
}


x86 assembly (clang, -O0):
<messWithStringFunctions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0xd(%rbp)
mov    0xebf(%rip),%eax
mov    %eax,-0x5(%rbp)
mov    0xeba(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0xd(%rbp),%rdi
call   1050 <displayString@plt>
lea    -0xd(%rbp),%rdi
call   1040 <displayStringUsingPointer@plt>
movl   $0x3,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xd(%rbp),%rsi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<messWithStringFunctions>:
push   %rbx
sub    $0x10,%rsp
movabs $0x21646c726f5720,%rax
mov    %rax,0x5(%rsp)
movabs $0x6f57206f6c6c6548,%rax
20 57 6f
mov    %rax,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <displayString@plt>
mov    %rbx,%rdi
call   1040 <displayStringUsingPointer@plt>
lea    0xea1(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe99(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.messWithStringFunctions.foo = [13 x i8] c"Hello World!\00"
@.str = [11 x i8] c"foo is %d\0A\00"
@.str.1 = [11 x i8] c"foo is %s\0A\00"
define void @messWithStringFunctions() {
%1 = alloca [13 x i8]
%2 = alloca i32
%3 = bitcast [13 x i8]* %1 to i8*
%4 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%5 = call i32 @displayString(i8* %4)
%6 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%7 = call i32 @displayStringUsingPointer(i8* %6)
store i32 3, i32* %2
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %10)
ret void
}

LLVM IR (-O2):
@__const.messWithStringFunctions.foo = [13 x i8] c"Hello World!\00"
@.str = [11 x i8] c"foo is %d\0A\00"
@.str.1 = [11 x i8] c"foo is %s\0A\00"
define void @messWithStringFunctions() {
%1 = alloca [13 x i8]
%2 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%3 = call i32 @displayString(i8* %2)
%4 = call i32 @displayStringUsingPointer(i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 3)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret void
}