#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*/ uint8_t;

/* Variables and functions */
char *ConvertDataBytes(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ ReadData(char *, int /*<<< orphan*/);
int /*<<< orphan*/ ReadUint8();
int /*<<< orphan*/ printf(char *, ...);
uint8_t GetFood(void) {
  char szEchoData[32];
  uint8_t foodTotal;
  printf("FEED ME!\n");
  foodTotal = ReadUint8();
  ReadData(szEchoData, foodTotal);
  printf("ATE %s\n", ConvertDataBytes(szEchoData, foodTotal, 16));
  return foodTotal;
}


x86 assembly (clang, -O0):
<GetFood>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <ReadUint8@plt>
mov    %eax,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1060 <ReadData@plt>
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    $0x10,%edx
call   1050 <ConvertDataBytes@plt>
mov    %rax,%rsi
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetFood>:
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <ReadUint8@plt>
mov    %eax,%ebx
mov    %rsp,%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1070 <ReadData@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x10,%edx
call   1060 <ConvertDataBytes@plt>
lea    0xe71(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c"FEED ME!\0A\00"
@.str.1 = [8 x i8] c"ATE %s\0A\00"
define i32 @GetFood() {
%1 = alloca [32 x i8]
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @ReadUint8()
store i32 %4, i32* %2
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%6 = load i32, i32* %2
%7 = call i32 @ReadData(i8* %5, i32 %6)
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%9 = load i32, i32* %2
%10 = call i8* @ConvertDataBytes(i8* %8, i32 %9, i32 16)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"ATE %s\0A\00"
@str = [9 x i8] c"FEED ME!\00"
define i32 @GetFood() {
%1 = alloca [32 x i8]
%2 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @ReadUint8()
%5 = call i32 @ReadData(i8* %2, i32 %4)
%6 = call i8* @ConvertDataBytes(i8* %2, i32 %4, i32 16)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %6)
ret i32 %4
}