#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*/ dump_imm(int, int, int, int);
void immediate(void) {
  int type, size, mode, sreg;
  for (type = 0; type < 0x7; type++)
    for (size = 0; size < 3; size++)
      for (mode = 0; mode < 8; mode++)
        for (sreg = 0; sreg < 8; sreg++)
          dump_imm(type, size, mode, sreg);
}


x86 assembly (clang, -O0):
<immediate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x7,-0x4(%rbp)
jge    11b4 <immediate+0xa4>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11a1 <immediate+0x91>
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    118e <immediate+0x7e>
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    117b <immediate+0x6b>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1030 <dump_imm@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1152 <immediate+0x42>
jmp    1180 <immediate+0x70>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1141 <immediate+0x31>
jmp    1193 <immediate+0x83>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1130 <immediate+0x20>
jmp    11a6 <immediate+0x96>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <immediate+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<immediate>:
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%edi
xor    %esi,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    %ebp,%edx
mov    $0x1,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    %ebp,%edx
mov    $0x2,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    %ebp,%edx
mov    $0x3,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    %ebp,%edx
mov    $0x4,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    %ebp,%edx
mov    $0x5,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    %ebp,%edx
mov    $0x6,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
xor    %esi,%esi
mov    %ebp,%edx
mov    $0x7,%ecx
call   1030 <dump_imm@plt>
add    $0x1,%ebp
cmp    $0x8,%ebp
jne    1130 <immediate+0x20>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    $0x1,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    %ebp,%edx
mov    $0x1,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    %ebp,%edx
mov    $0x2,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    %ebp,%edx
mov    $0x3,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    %ebp,%edx
mov    $0x4,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    %ebp,%edx
mov    $0x5,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    %ebp,%edx
mov    $0x6,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    %ebp,%edx
mov    $0x7,%ecx
call   1030 <dump_imm@plt>
add    $0x1,%ebp
cmp    $0x8,%ebp
jne    11c0 <immediate+0xb0>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
mov    $0x2,%esi
mov    %ebp,%edx
xor    %ecx,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
mov    $0x2,%esi
mov    %ebp,%edx
mov    $0x1,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
mov    $0x2,%esi
mov    %ebp,%edx
mov    $0x2,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
mov    $0x2,%esi
mov    %ebp,%edx
mov    $0x3,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
mov    $0x2,%esi
mov    %ebp,%edx
mov    $0x4,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
mov    $0x2,%esi
mov    %ebp,%edx
mov    $0x5,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
mov    $0x2,%esi
mov    %ebp,%edx
mov    $0x6,%ecx
call   1030 <dump_imm@plt>
mov    %ebx,%edi
mov    $0x2,%esi
mov    %ebp,%edx
mov    $0x7,%ecx
call   1030 <dump_imm@plt>
add    $0x1,%ebp
cmp    $0x8,%ebp
jne    1270 <immediate+0x160>
add    $0x1,%ebx
cmp    $0x7,%ebx
jne    1120 <immediate+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @immediate() {
br label %1
1: ; preds = %0, %39
%2 = phi i32 [ 0, %0 ], [ %40, %39 ]
br label %3
3: ; preds = %1, %3
%4 = phi i32 [ 0, %1 ], [ %13, %3 ]
%5 = tail call i32 @dump_imm(i32 %2, i32 0, i32 %4, i32 0)
%6 = tail call i32 @dump_imm(i32 %2, i32 0, i32 %4, i32 1)
%7 = tail call i32 @dump_imm(i32 %2, i32 0, i32 %4, i32 2)
%8 = tail call i32 @dump_imm(i32 %2, i32 0, i32 %4, i32 3)
%9 = tail call i32 @dump_imm(i32 %2, i32 0, i32 %4, i32 4)
%10 = tail call i32 @dump_imm(i32 %2, i32 0, i32 %4, i32 5)
%11 = tail call i32 @dump_imm(i32 %2, i32 0, i32 %4, i32 6)
%12 = tail call i32 @dump_imm(i32 %2, i32 0, i32 %4, i32 7)
%13 = add nuw nsw i32 %4, 1
%14 = icmp eq i32 %13, 8
br i1 %14, label %15, label %3
15: ; preds = %3, %15
%16 = phi i32 [ %25, %15 ], [ 0, %3 ]
%17 = tail call i32 @dump_imm(i32 %2, i32 1, i32 %16, i32 0)
%18 = tail call i32 @dump_imm(i32 %2, i32 1, i32 %16, i32 1)
%19 = tail call i32 @dump_imm(i32 %2, i32 1, i32 %16, i32 2)
%20 = tail call i32 @dump_imm(i32 %2, i32 1, i32 %16, i32 3)
%21 = tail call i32 @dump_imm(i32 %2, i32 1, i32 %16, i32 4)
%22 = tail call i32 @dump_imm(i32 %2, i32 1, i32 %16, i32 5)
%23 = tail call i32 @dump_imm(i32 %2, i32 1, i32 %16, i32 6)
%24 = tail call i32 @dump_imm(i32 %2, i32 1, i32 %16, i32 7)
%25 = add nuw nsw i32 %16, 1
%26 = icmp eq i32 %25, 8
br i1 %26, label %27, label %15
27: ; preds = %15, %27
%28 = phi i32 [ %37, %27 ], [ 0, %15 ]
%29 = tail call i32 @dump_imm(i32 %2, i32 2, i32 %28, i32 0)
%30 = tail call i32 @dump_imm(i32 %2, i32 2, i32 %28, i32 1)
%31 = tail call i32 @dump_imm(i32 %2, i32 2, i32 %28, i32 2)
%32 = tail call i32 @dump_imm(i32 %2, i32 2, i32 %28, i32 3)
%33 = tail call i32 @dump_imm(i32 %2, i32 2, i32 %28, i32 4)
%34 = tail call i32 @dump_imm(i32 %2, i32 2, i32 %28, i32 5)
%35 = tail call i32 @dump_imm(i32 %2, i32 2, i32 %28, i32 6)
%36 = tail call i32 @dump_imm(i32 %2, i32 2, i32 %28, i32 7)
%37 = add nuw nsw i32 %28, 1
%38 = icmp eq i32 %37, 8
br i1 %38, label %39, label %27
39: ; preds = %27
%40 = add nuw nsw i32 %2, 1
%41 = icmp eq i32 %40, 7
br i1 %41, label %42, label %1
42: ; preds = %39
ret void
}