#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 atoi(char *);
int /*<<< orphan*/ printf(char *, ...);
int toupper(char);
int main() {
  const char msg[] = "warning";
  char letter = 'y';
  char digits[] = "526";
  printf("Yay, this is a %s\n", msg);
  printf("atoi('%s'): %d\n", digits, atoi(digits));
  printf("toupper('%c') = %c\n", letter, toupper(letter));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0xc(%rbp)
movb   $0x79,-0xd(%rbp)
mov    0xeb4(%rip),%eax
mov    %eax,-0x11(%rbp)
lea    -0xc(%rbp),%rsi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x11(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x11(%rbp),%rdi
call   1050 <atoi@plt>
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsbl -0xd(%rbp),%eax
mov    %eax,-0x18(%rbp)
movsbl -0xd(%rbp),%edi
call   1030 <toupper@plt>
mov    -0x18(%rbp),%esi
mov    %eax,%edx
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x676e696e726177,%rax
mov    %rax,0x8(%rsp)
movl   $0x363235,0x4(%rsp)
lea    0xead(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <atoi@plt>
lea    0xea0(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x79,%edi
call   1030 <toupper@plt>
lea    0xe93(%rip),%rdi
mov    $0x79,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.msg = [8 x i8] c"warning\00"
@__const.main.digits = [4 x i8] c"526\00"
@.str = [19 x i8] c"Yay, this is a %s\0A\00"
@.str.1 = [16 x i8] c"atoi('%s'): %d\0A\00"
@.str.2 = [20 x i8] c"toupper('%c') = %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i8]
%3 = alloca i8
%4 = alloca [4 x i8]
store i32 0, i32* %1
%5 = bitcast [8 x i8]* %2 to i8*
store i8 121, i8* %3
%6 = bitcast [4 x i8]* %4 to i8*
%7 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%11 = call i32 @atoi(i8* %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %9, i32 %11)
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = load i8, i8* %3
%16 = call i32 @toupper(i8 signext %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Yay, this is a %s\0A\00"
@.str.1 = [16 x i8] c"atoi('%s'): %d\0A\00"
@.str.2 = [20 x i8] c"toupper('%c') = %c\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i32
%3 = bitcast i64* %1 to i8*
store i64 29113321704808823, i64* %1
%4 = bitcast i32* %2 to i8*
store i32 3551797, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i64* %1)
%6 = call i32 @atoi(i8* %4)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32 %6)
%8 = call i32 @toupper(i8 signext 121)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 121, i32 %8)
ret i32 0
}