emitx(val, n) long val;
int n;
{
  switch (n) {
  case 1:
    emit1((int)val);
    break;
  case 2:
    emit1((int)val);
    emit1(((int)val >> 8));
    break;
  case 4:
    emit2((int)(val));
    emit2((int)(val >> 16));
    break;
  default: {
    if (!(0))
      assert2("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/h31nr1ch/SOP/refs/heads/master/"
              "Assembly/as_src/comm7.c",
              324);
  };
  }
}


x86 assembly (clang, -O0):
<emitx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x1,%eax
je     1175 <emitx+0x45>
jmp    1153 <emitx+0x23>
mov    -0x18(%rbp),%eax
sub    $0x2,%eax
je     1187 <emitx+0x57>
jmp    1164 <emitx+0x34>
mov    -0x18(%rbp),%eax
sub    $0x4,%eax
je     11a9 <emitx+0x79>
jmp    11cc <emitx+0x9c>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
mov    $0x0,%al
call   1030 <emit1@plt>
jmp    11df <emitx+0xaf>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
mov    $0x0,%al
call   1030 <emit1@plt>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
sar    $0x8,%edi
mov    $0x0,%al
call   1030 <emit1@plt>
jmp    11df <emitx+0xaf>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
mov    $0x0,%al
call   1040 <emit2@plt>
mov    -0x10(%rbp),%rax
sar    $0x10,%rax
mov    %eax,%edi
mov    $0x0,%al
call   1040 <emit2@plt>
jmp    11df <emitx+0xaf>
lea    0xe2d(%rip),%rdi
mov    $0x144,%esi
mov    $0x0,%al
call   1050 <assert2@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emitx>:
push   %rbx
mov    %rdi,%rbx
cmp    $0x4,%esi
je     1158 <emitx+0x28>
cmp    $0x2,%esi
je     1170 <emitx+0x40>
cmp    $0x1,%esi
je     117c <emitx+0x4c>
lea    0xeb6(%rip),%rdi
mov    $0x144,%esi
xor    %eax,%eax
call   1050 <assert2@plt>
pop    %rbx
ret
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <emit2@plt>
shr    $0x10,%rbx
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <emit2@plt>
pop    %rbx
ret
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <emit1@plt>
sar    $0x8,%ebx
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <emit1@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/h31nr1ch/SOP/refs/heads/master/Assembly/as_src/comm7.c\00"
define i32 @emitx(i64 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i32
store i64 %0, i64* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
switch i32 %6, label %27 [
i32 1, label %7
i32 2, label %11
i32 4, label %19
]
7: ; preds = %2
%8 = load i64, i64* %4
%9 = trunc i64 %8 to i32
%10 = call i32 (i32, ...) bitcast (i32 (...)* @emit1 to i32 (i32, ...)*)(i32 %9)
br label %29
11: ; preds = %2
%12 = load i64, i64* %4
%13 = trunc i64 %12 to i32
%14 = call i32 (i32, ...) bitcast (i32 (...)* @emit1 to i32 (i32, ...)*)(i32 %13)
%15 = load i64, i64* %4
%16 = trunc i64 %15 to i32
%17 = ashr i32 %16, 8
%18 = call i32 (i32, ...) bitcast (i32 (...)* @emit1 to i32 (i32, ...)*)(i32 %17)
br label %29
19: ; preds = %2
%20 = load i64, i64* %4
%21 = trunc i64 %20 to i32
%22 = call i32 (i32, ...) bitcast (i32 (...)* @emit2 to i32 (i32, ...)*)(i32 %21)
%23 = load i64, i64* %4
%24 = ashr i64 %23, 16
%25 = trunc i64 %24 to i32
%26 = call i32 (i32, ...) bitcast (i32 (...)* @emit2 to i32 (i32, ...)*)(i32 %25)
br label %29
27: ; preds = %2
%28 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @assert2 to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0), i32 324)
br label %29
29: ; preds = %27, %19, %11, %7
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
@.str = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/h31nr1ch/SOP/refs/heads/master/Assembly/as_src/comm7.c\00"
define i32 @emitx(i64 %0, i32 %1) {
switch i32 %1, label %17 [
i32 1, label %3
i32 2, label %6
i32 4, label %11
]
3: ; preds = %2
%4 = trunc i64 %0 to i32
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @emit1 to i32 (i32, ...)*)(i32 %4)
br label %19
6: ; preds = %2
%7 = trunc i64 %0 to i32
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @emit1 to i32 (i32, ...)*)(i32 %7)
%9 = ashr i32 %7, 8
%10 = tail call i32 (i32, ...) bitcast (i32 (...)* @emit1 to i32 (i32, ...)*)(i32 %9)
br label %19
11: ; preds = %2
%12 = trunc i64 %0 to i32
%13 = tail call i32 (i32, ...) bitcast (i32 (...)* @emit2 to i32 (i32, ...)*)(i32 %12)
%14 = lshr i64 %0, 16
%15 = trunc i64 %14 to i32
%16 = tail call i32 (i32, ...) bitcast (i32 (...)* @emit2 to i32 (i32, ...)*)(i32 %15)
br label %19
17: ; preds = %2
%18 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @assert2 to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0), i32 324)
br label %19
19: ; preds = %17, %11, %6, %3
ret i32 undef
}