#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 charFunc();
int intFunc();
int /*<<< orphan*/ print_int(int);
int /*<<< orphan*/ print_string(char *);
void main(void) {
  int x;
  char c;
  print_string("should get 65 (since 65 == 'A')\ngot: ");
  print_int(charFunc());
  print_string("\n\n");
  c = charFunc();
  print_string("should get 65 (since 65 == 'A')\ngot: ");
  print_int(c);
  print_string("\n\n");
  print_string("should get 8\ngot: ");
  print_int(intFunc());
  print_string("\n\n");
  x = intFunc();
  print_string("should get 8\ngot: ");
  print_int(x);
  print_string("\n\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1040 <print_string@plt>
mov    $0x0,%al
call   1030 <charFunc@plt>
mov    %eax,%edi
call   1050 <print_int@plt>
lea    0xebd(%rip),%rdi
call   1040 <print_string@plt>
mov    $0x0,%al
call   1030 <charFunc@plt>
mov    %al,-0x5(%rbp)
lea    0xe81(%rip),%rdi
call   1040 <print_string@plt>
movsbl -0x5(%rbp),%edi
call   1050 <print_int@plt>
lea    0xe92(%rip),%rdi
call   1040 <print_string@plt>
lea    0xe89(%rip),%rdi
call   1040 <print_string@plt>
mov    $0x0,%al
call   1060 <intFunc@plt>
mov    %eax,%edi
call   1050 <print_int@plt>
lea    0xe6c(%rip),%rdi
call   1040 <print_string@plt>
mov    $0x0,%al
call   1060 <intFunc@plt>
mov    %eax,-0x4(%rbp)
lea    0xe59(%rip),%rdi
call   1040 <print_string@plt>
mov    -0x4(%rbp),%edi
call   1050 <print_int@plt>
lea    0xe42(%rip),%rdi
call   1040 <print_string@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xeb5(%rip),%r14
mov    %r14,%rdi
call   1040 <print_string@plt>
xor    %eax,%eax
call   1030 <charFunc@plt>
mov    %eax,%edi
call   1050 <print_int@plt>
lea    0xebe(%rip),%rbx
mov    %rbx,%rdi
call   1040 <print_string@plt>
xor    %eax,%eax
call   1030 <charFunc@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1040 <print_string@plt>
movsbl %bpl,%edi
call   1050 <print_int@plt>
mov    %rbx,%rdi
call   1040 <print_string@plt>
lea    0xe90(%rip),%r14
mov    %r14,%rdi
call   1040 <print_string@plt>
xor    %eax,%eax
call   1060 <intFunc@plt>
mov    %eax,%edi
call   1050 <print_int@plt>
mov    %rbx,%rdi
call   1040 <print_string@plt>
xor    %eax,%eax
call   1060 <intFunc@plt>
mov    %eax,%ebp
mov    %r14,%rdi
call   1040 <print_string@plt>
mov    %ebp,%edi
call   1050 <print_int@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <print_string@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"should get 65 (since 65 == 'A')\0Agot: \00"
@.str.1 = [3 x i8] c"\0A\0A\00"
@.str.2 = [19 x i8] c"should get 8\0Agot: \00"
define void @main() {
%1 = alloca i32
%2 = alloca i8
%3 = call i32 @print_string(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @charFunc()
%5 = call i32 @print_int(i32 %4)
%6 = call i32 @print_string(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (...) @charFunc()
%8 = trunc i32 %7 to i8
store i8 %8, i8* %2
%9 = call i32 @print_string(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = call i32 @print_int(i32 %11)
%13 = call i32 @print_string(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @print_string(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 (...) @intFunc()
%16 = call i32 @print_int(i32 %15)
%17 = call i32 @print_string(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 (...) @intFunc()
store i32 %18, i32* %1
%19 = call i32 @print_string(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%20 = load i32, i32* %1
%21 = call i32 @print_int(i32 %20)
%22 = call i32 @print_string(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"should get 65 (since 65 == 'A')\0Agot: \00"
@.str.1 = [3 x i8] c"\0A\0A\00"
@.str.2 = [19 x i8] c"should get 8\0Agot: \00"
define void @main() {
%1 = tail call i32 @print_string(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @charFunc()
%3 = tail call i32 @print_int(i32 %2)
%4 = tail call i32 @print_string(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (...) @charFunc()
%6 = tail call i32 @print_string(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%7 = shl i32 %5, 24
%8 = ashr exact i32 %7, 24
%9 = tail call i32 @print_int(i32 %8)
%10 = tail call i32 @print_string(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i32 @print_string(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%12 = tail call i32 (...) @intFunc()
%13 = tail call i32 @print_int(i32 %12)
%14 = tail call i32 @print_string(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = tail call i32 (...) @intFunc()
%16 = tail call i32 @print_string(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%17 = tail call i32 @print_int(i32 %15)
%18 = tail call i32 @print_string(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}