#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*/ PATH_MAX;
int /*<<< orphan*/ fnmatch(char *, char *, int /*<<< orphan*/);
int isalpha(unsigned char);
char *malloc(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ realpath(char *, char *);
int main() {
  char *respath = malloc(PATH_MAX);
  unsigned char c = (unsigned char)"c";
  printf("foo\n");
  printf("%d\n", isalpha(c));
  realpath("/some/path", respath);
  fnmatch("foo", "bar", 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
lea    0xe88(%rip),%rax
mov    %al,-0x11(%rbp)
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movzbl -0x11(%rbp),%edi
call   1070 <isalpha@plt>
mov    %eax,%esi
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe5e(%rip),%rdi
call   1050 <realpath@plt>
lea    0xe5d(%rip),%rdi
lea    0xe5a(%rip),%rsi
xor    %edx,%edx
call   1040 <fnmatch@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
lea    0xe99(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xe75(%rip),%rax
movzbl %al,%edi
call   1080 <isalpha@plt>
lea    0xe68(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe5c(%rip),%rdi
mov    %rbx,%rsi
call   1060 <realpath@plt>
lea    0xe58(%rip),%rsi
mov    %r14,%rdi
xor    %edx,%edx
call   1050 <fnmatch@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@PATH_MAX = global i32 0
@.str = [2 x i8] c"c\00"
@.str.1 = [5 x i8] c"foo\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [11 x i8] c"/some/path\00"
@.str.4 = [4 x i8] c"foo\00"
@.str.5 = [4 x i8] c"bar\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8
store i32 0, i32* %1
%4 = load i32, i32* @PATH_MAX
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %2
store i8 ptrtoint ([2 x i8]* @.str to i8), i8* %3
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%7 = load i8, i8* %3
%8 = call i32 @isalpha(i8 zeroext %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = load i8*, i8** %2
%11 = call i32 @realpath(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %10)
%12 = call i32 @fnmatch(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 0)
ret i32 0
}

LLVM IR (-O2):
@PATH_MAX = global i32 0
@.str = [2 x i8] c"c\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [11 x i8] c"/some/path\00"
@.str.5 = [4 x i8] c"bar\00"
@str = [4 x i8] c"foo\00"
define i32 @main() {
%1 = load i32, i32* @PATH_MAX
%2 = tail call i8* @malloc(i32 %1)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @isalpha(i8 zeroext ptrtoint ([2 x i8]* @.str to i8))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%6 = tail call i32 @realpath(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%7 = tail call i32 @fnmatch(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 0)
ret i32 0
}