#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 uint32_t;

/* Variables and functions */
int func16(int);
int func16for(int);
int func32(int);
int func32for(int);
int /*<<< orphan*/ printf(char *, int, int);
void main() {
  uint32_t s = 1001;
  printf("32bit\n\treq=\t%x\tres=\t %x\n", s, func32(s));
  printf("32bit-for\n\treq=\t%x\tres=\t %x\n", s, func32for(s));
  printf("16bit\n\treq=\t%x\tres=\t %x\n", s, func16(s));
  printf("16bit-for\n\treq=\t%x\tres=\t %x\n", s, func16for(s));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x3e9,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <func32@plt>
mov    -0x14(%rbp),%esi
mov    %eax,%edx
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1070 <func32for@plt>
mov    -0x10(%rbp),%esi
mov    %eax,%edx
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <func16@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <func16for@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3e9,%edi
call   1040 <func32@plt>
lea    0xe9e(%rip),%rdi
mov    $0x3e9,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x3e9,%edi
call   1070 <func32for@plt>
lea    0xe9a(%rip),%rdi
mov    $0x3e9,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x3e9,%edi
call   1050 <func16@plt>
lea    0xe9a(%rip),%rdi
mov    $0x3e9,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0x3e9,%edi
call   1060 <func16for@plt>
lea    0xe96(%rip),%rdi
mov    $0x3e9,%esi
mov    %eax,%edx
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"32bit\0A\09req=\09%x\09res=\09 %x\0A\00"
@.str.1 = [29 x i8] c"32bit-for\0A\09req=\09%x\09res=\09 %x\0A\00"
@.str.2 = [25 x i8] c"16bit\0A\09req=\09%x\09res=\09 %x\0A\00"
@.str.3 = [29 x i8] c"16bit-for\0A\09req=\09%x\09res=\09 %x\0A\00"
define void @main() {
%1 = alloca i32
store i32 1001, i32* %1
%2 = load i32, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @func32(i32 %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %4)
%6 = load i32, i32* %1
%7 = load i32, i32* %1
%8 = call i32 @func32for(i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %8)
%10 = load i32, i32* %1
%11 = load i32, i32* %1
%12 = call i32 @func16(i32 %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %10, i32 %12)
%14 = load i32, i32* %1
%15 = load i32, i32* %1
%16 = call i32 @func16for(i32 %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 %14, i32 %16)
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"32bit\0A\09req=\09%x\09res=\09 %x\0A\00"
@.str.1 = [29 x i8] c"32bit-for\0A\09req=\09%x\09res=\09 %x\0A\00"
@.str.2 = [25 x i8] c"16bit\0A\09req=\09%x\09res=\09 %x\0A\00"
@.str.3 = [29 x i8] c"16bit-for\0A\09req=\09%x\09res=\09 %x\0A\00"
define void @main() {
%1 = tail call i32 @func32(i32 1001)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 1001, i32 %1)
%3 = tail call i32 @func32for(i32 1001)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 1001, i32 %3)
%5 = tail call i32 @func16(i32 1001)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 1001, i32 %5)
%7 = tail call i32 @func16for(i32 1001)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i32 1001, i32 %7)
ret void
}