#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*/ printf(char *, unsigned short, long long);
long long STEST909(unsigned short v) {
  long long r = v + 133;
  printf("sub  (test15f - C909): Call by value short :(%3d=5) returning long "
         "long :(%3lld=138)\n",
         v, r);
  v = v - 3;
  printf("sub  (test15f - C909): Call by value short :(%3d=2) returning long "
         "long :(%3lld=138)\n",
         v, r);
  return r;
}


x86 assembly (clang, -O0):
<STEST909>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
add    $0x85,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x2(%rbp),%ax
mov    -0x10(%rbp),%rdx
lea    0xec3(%rip),%rdi
movzwl %ax,%esi
call   1030 <printf@plt>
movzwl -0x2(%rbp),%eax
sub    $0x3,%eax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%ax
mov    -0x10(%rbp),%rdx
lea    0xef7(%rip),%rdi
movzwl %ax,%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<STEST909>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %edi,%r14d
add    $0x85,%r14
lea    0xed9(%rip),%rdi
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <printf@plt>
add    $0xfffffffd,%ebx
movzwl %bx,%esi
lea    0xf18(%rip),%rdi
mov    %r14,%rdx
call   1030 <printf@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [86 x i8] c"sub (test15f - C909): Call by value short :(%3d=5) returning long long :(%3lld=138)\0A\00"
@.str.1 = [86 x i8] c"sub (test15f - C909): Call by value short :(%3d=2) returning long long :(%3lld=138)\0A\00"
define i64 @STEST909(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i64
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = zext i16 %4 to i32
%6 = add nsw i32 %5, 133
%7 = sext i32 %6 to i64
store i64 %7, i64* %3
%8 = load i16, i16* %2
%9 = load i64, i64* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0), i16 zeroext %8, i64 %9)
%11 = load i16, i16* %2
%12 = zext i16 %11 to i32
%13 = sub nsw i32 %12, 3
%14 = trunc i32 %13 to i16
store i16 %14, i16* %2
%15 = load i16, i16* %2
%16 = load i64, i64* %3
%17 = call i32 @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.1, i64 0, i64 0), i16 zeroext %15, i64 %16)
%18 = load i64, i64* %3
ret i64 %18
}

LLVM IR (-O2):
@.str = [86 x i8] c"sub (test15f - C909): Call by value short :(%3d=5) returning long long :(%3lld=138)\0A\00"
@.str.1 = [86 x i8] c"sub (test15f - C909): Call by value short :(%3d=2) returning long long :(%3lld=138)\0A\00"
define i64 @STEST909(i16 zeroext %0) {
%2 = zext i16 %0 to i64
%3 = add nuw nsw i64 %2, 133
%4 = tail call i32 @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0), i16 zeroext %0, i64 %3)
%5 = add i16 %0, -3
%6 = tail call i32 @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.1, i64 0, i64 0), i16 zeroext %5, i64 %3)
ret i64 %3
}