#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*/ num_to_be(int, int, char *);
int /*<<< orphan*/ output_char(char);
void output_nums(char opcode, int a, int b) {
  char buf[4];
  int i;
  output_char(opcode);
  num_to_be(a, 2, buf);
  for (i = 0; i < 2; i++)
    output_char(buf[i]);
  num_to_be(b, 2, buf);
  for (i = 0; i < 2; i++)
    output_char(buf[i]);
}


x86 assembly (clang, -O0):
<output_nums>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <output_char@plt>
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rdx
mov    $0x2,%esi
call   1030 <num_to_be@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    117b <output_nums+0x5b>
movslq -0x14(%rbp),%rax
movsbl -0x10(%rbp,%rax,1),%edi
call   1040 <output_char@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1155 <output_nums+0x35>
mov    -0xc(%rbp),%edi
lea    -0x10(%rbp),%rdx
mov    $0x2,%esi
call   1030 <num_to_be@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    11b9 <output_nums+0x99>
movslq -0x14(%rbp),%rax
movsbl -0x10(%rbp,%rax,1),%edi
call   1040 <output_char@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1193 <output_nums+0x73>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_nums>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%ebx
mov    %esi,%ebp
call   1040 <output_char@plt>
lea    0xc(%rsp),%r14
mov    %ebp,%edi
mov    $0x2,%esi
mov    %r14,%rdx
call   1030 <num_to_be@plt>
movsbl 0xc(%rsp),%edi
call   1040 <output_char@plt>
movsbl 0xd(%rsp),%edi
call   1040 <output_char@plt>
mov    %ebx,%edi
mov    $0x2,%esi
mov    %r14,%rdx
call   1030 <num_to_be@plt>
movsbl 0xc(%rsp),%edi
call   1040 <output_char@plt>
movsbl 0xd(%rsp),%edi
call   1040 <output_char@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @output_nums(i8 signext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca [4 x i8]
%8 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i8, i8* %4
%10 = call i32 @output_char(i8 signext %9)
%11 = load i32, i32* %5
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%13 = call i32 @num_to_be(i32 %11, i32 2, i8* %12)
store i32 0, i32* %8
br label %14
14: ; preds = %23, %3
%15 = load i32, i32* %8
%16 = icmp slt i32 %15, 2
br i1 %16, label %17, label %26
17: ; preds = %14
%18 = load i32, i32* %8
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = call i32 @output_char(i8 signext %21)
br label %23
23: ; preds = %17
%24 = load i32, i32* %8
%25 = add nsw i32 %24, 1
store i32 %25, i32* %8
br label %14
26: ; preds = %14
%27 = load i32, i32* %6
%28 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%29 = call i32 @num_to_be(i32 %27, i32 2, i8* %28)
store i32 0, i32* %8
br label %30
30: ; preds = %39, %26
%31 = load i32, i32* %8
%32 = icmp slt i32 %31, 2
br i1 %32, label %33, label %42
33: ; preds = %30
%34 = load i32, i32* %8
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = call i32 @output_char(i8 signext %37)
br label %39
39: ; preds = %33
%40 = load i32, i32* %8
%41 = add nsw i32 %40, 1
store i32 %41, i32* %8
br label %30
42: ; preds = %30
ret void
}

LLVM IR (-O2):
define void @output_nums(i8 signext %0, i32 %1, i32 %2) {
%4 = alloca [4 x i8]
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%6 = tail call i32 @output_char(i8 signext %0)
%7 = call i32 @num_to_be(i32 %1, i32 2, i8* %5)
%8 = load i8, i8* %5
%9 = call i32 @output_char(i8 signext %8)
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 1
%11 = load i8, i8* %10
%12 = call i32 @output_char(i8 signext %11)
%13 = call i32 @num_to_be(i32 %2, i32 2, i8* %5)
%14 = load i8, i8* %5
%15 = call i32 @output_char(i8 signext %14)
%16 = load i8, i8* %10
%17 = call i32 @output_char(i8 signext %16)
ret void
}