#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 getbits(int, int, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int, int, int, int);
char *show_type(int type, int size, int offset) {
  char *output;
  output = (char *)malloc(50);
  sprintf(output, "e%d c%d t%d ex%d sz%d offset %d", getbits(type, 15, 4),
          getbits(type, 11, 4), getbits(type, 7, 4), getbits(type, 3, 4), size,
          offset);
  return output;
}


x86 assembly (clang, -O0):
<show_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    $0x32,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x4(%rbp),%edi
mov    $0xf,%esi
mov    $0x4,%edx
call   1030 <getbits@plt>
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%edi
mov    $0xb,%esi
mov    $0x4,%edx
call   1030 <getbits@plt>
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x7,%esi
mov    $0x4,%edx
call   1030 <getbits@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x3,%esi
mov    $0x4,%edx
call   1030 <getbits@plt>
mov    -0x30(%rbp),%rdi
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    %eax,%r9d
mov    -0x8(%rbp),%r10d
mov    -0xc(%rbp),%eax
lea    0xe39(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1050 <sprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_type>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rsi,(%rsp)
mov    %edi,%ebp
mov    $0x32,%edi
call   1040 <malloc@plt>
mov    %rax,%r13
mov    %ebp,%edi
mov    $0xf,%esi
mov    $0x4,%edx
call   1030 <getbits@plt>
mov    %eax,%r12d
mov    %ebp,%edi
mov    $0xb,%esi
mov    $0x4,%edx
call   1030 <getbits@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    $0x7,%esi
mov    $0x4,%edx
call   1030 <getbits@plt>
mov    %eax,%r14d
mov    %ebp,%edi
mov    $0x3,%esi
mov    $0x4,%edx
call   1030 <getbits@plt>
lea    0xe5c(%rip),%rsi
mov    %r13,%rdi
mov    %r12d,%edx
mov    %ebx,%ecx
mov    %r14d,%r8d
mov    %eax,%r9d
push   %r15
push   0x8(%rsp)
call   1050 <sprintf@plt>
add    $0x10,%rsp
mov    %r13,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"e%d c%d t%d ex%d sz%d offset %d\00"
define i8* @show_type(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = call i64 @malloc(i32 50)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = load i32, i32* %4
%12 = call i32 @getbits(i32 %11, i32 15, i32 4)
%13 = load i32, i32* %4
%14 = call i32 @getbits(i32 %13, i32 11, i32 4)
%15 = load i32, i32* %4
%16 = call i32 @getbits(i32 %15, i32 7, i32 4)
%17 = load i32, i32* %4
%18 = call i32 @getbits(i32 %17, i32 3, i32 4)
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %14, i32 %16, i32 %18, i32 %19, i32 %20)
%22 = load i8*, i8** %7
ret i8* %22
}

LLVM IR (-O2):
@.str = [32 x i8] c"e%d c%d t%d ex%d sz%d offset %d\00"
define i8* @show_type(i32 %0, i32 %1, i32 %2) {
%4 = tail call i64 @malloc(i32 50)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @getbits(i32 %0, i32 15, i32 4)
%7 = tail call i32 @getbits(i32 %0, i32 11, i32 4)
%8 = tail call i32 @getbits(i32 %0, i32 7, i32 4)
%9 = tail call i32 @getbits(i32 %0, i32 3, i32 4)
%10 = tail call i32 @sprintf(i8* dereferenceable(1) %5, i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7, i32 %8, i32 %9, i32 %1, i32 %2)
ret i8* %5
}