xunge/DecIR huggingface dataset:
/* Variables and functions */
int abs(int);
int abs_max(int a, int b) {
  a = abs(a);
  b = abs(b);
  return (a > b) ? a : b;
}


x86 assembly (clang, -O0):
<abs_max>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    114b <abs_max+0x3b>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1151 <abs_max+0x41>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<abs_max>:
mov    %edi,%ecx
neg    %ecx
cmovs  %edi,%ecx
mov    %esi,%eax
neg    %eax
cmovs  %esi,%eax
cmp    %eax,%ecx
cmova  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @abs_max(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = call i32 @abs(i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %4
%8 = call i32 @abs(i32 %7)
store i32 %8, i32* %4
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = icmp sgt i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load i32, i32* %3
br label %16
14: ; preds = %2
%15 = load i32, i32* %4
br label %16
16: ; preds = %14, %12
%17 = phi i32 [ %13, %12 ], [ %15, %14 ]
ret i32 %17
}

LLVM IR (-O2):
define i32 @abs_max(i32 %0, i32 %1) {
%3 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%4 = tail call i32 @llvm.abs.i32(i32 %1, i1 true)
%5 = icmp ugt i32 %3, %4
%6 = select i1 %5, i32 %3, i32 %4
ret i32 %6
}
/* Type definitions */
typedef int GLint;
typedef int GLenum;

/* Variables and functions */
#define GL_MAP2_COLOR_4 136
#define GL_MAP2_INDEX 135
#define GL_MAP2_NORMAL 134
#define GL_MAP2_TEXTURE_COORD_1 133
#define GL_MAP2_TEXTURE_COORD_2 132
#define GL_MAP2_TEXTURE_COORD_3 131
#define GL_MAP2_TEXTURE_COORD_4 130
#define GL_MAP2_VERTEX_3 129
#define GL_MAP2_VERTEX_4 128
__attribute__((visibility("internal"))) __attribute__((pure)) GLint
__glMap2d_size(GLenum e) {
  switch (e) {
  case GL_MAP2_INDEX:
  case GL_MAP2_TEXTURE_COORD_1:
    return 1;
  case GL_MAP2_TEXTURE_COORD_2:
    return 2;
  case GL_MAP2_NORMAL:
  case GL_MAP2_TEXTURE_COORD_3:
  case GL_MAP2_VERTEX_3:
    return 3;
  case GL_MAP2_COLOR_4:
  case GL_MAP2_TEXTURE_COORD_4:
  case GL_MAP2_VERTEX_4:
    return 4;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<__glMap2d_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x8,%eax
ja     1160 <__glMap2d_size+0x60>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    1167 <__glMap2d_size+0x67>
movl   $0x2,-0x4(%rbp)
jmp    1167 <__glMap2d_size+0x67>
movl   $0x3,-0x4(%rbp)
jmp    1167 <__glMap2d_size+0x67>
movl   $0x4,-0x4(%rbp)
jmp    1167 <__glMap2d_size+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__glMap2d_size>:
add    $0xffffff80,%edi
xor    %eax,%eax
cmp    $0x8,%edi
ja     1117 <__glMap2d_size+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define hidden i32 @__glMap2d_size(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %9 [
i32 135, label %5
i32 133, label %5
i32 132, label %6
i32 134, label %7
i32 131, label %7
i32 129, label %7
i32 136, label %8
i32 130, label %8
i32 128, label %8
]
5: ; preds = %1, %1
store i32 1, i32* %2
br label %10
6: ; preds = %1
store i32 2, i32* %2
br label %10
7: ; preds = %1, %1, %1
store i32 3, i32* %2
br label %10
8: ; preds = %1, %1, %1
store i32 4, i32* %2
br label %10
9: ; preds = %1
store i32 0, i32* %2
br label %10
10: ; preds = %9, %8, %7, %6, %5
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
@switch.table.__glMap2d_size = [9 x i32] [i32 4, i32 3, i32 4, i32 3, i32 2, i32 1, i32 3, i32 1, i32 4]
define hidden i32 @__glMap2d_size(i32 %0) {
%2 = add i32 %0, -128
%3 = icmp ult i32 %2, 9
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [9 x i32], [9 x i32]* @switch.table.__glMap2d_size, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ 0, %1 ]
ret i32 %9
}
/* Type definitions */
struct rb_root {
  int dummy;
};
struct rb_node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ____rb_erase_color(struct rb_node *, struct rb_root *);
void __rb_erase_color(struct rb_node *parent, struct rb_root *root) {
  ____rb_erase_color(parent, root);
}


x86 assembly (clang, -O0):
<__rb_erase_color>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <____rb_erase_color@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__rb_erase_color>:
jmp    1030 <____rb_erase_color@plt>

LLVM IR (-O0):
%struct.rb_node = type { i32 }
%struct.rb_root = type { i32 }
define void @__rb_erase_color(%struct.rb_node* %0, %struct.rb_root* %1) {
%3 = alloca %struct.rb_node*
%4 = alloca %struct.rb_root*
store %struct.rb_node* %0, %struct.rb_node** %3
store %struct.rb_root* %1, %struct.rb_root** %4
%5 = load %struct.rb_node*, %struct.rb_node** %3
%6 = load %struct.rb_root*, %struct.rb_root** %4
%7 = call i32 @____rb_erase_color(%struct.rb_node* %5, %struct.rb_root* %6)
ret void
}

LLVM IR (-O2):
%struct.rb_node = type { i32 }
%struct.rb_root = type { i32 }
define void @__rb_erase_color(%struct.rb_node* %0, %struct.rb_root* %1) {
%3 = tail call i32 @____rb_erase_color(%struct.rb_node* %0, %struct.rb_root* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ popen(char *, char *);
void backlight_on() { popen("echo 1 > /proc/easy_backlight", "w"); }


x86 assembly (clang, -O0):
<backlight_on>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xefc(%rip),%rsi
call   1030 <popen@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<backlight_on>:
lea    0xee9(%rip),%rdi
lea    0xf00(%rip),%rsi
jmp    1030 <popen@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"echo 1 > /proc/easy_backlight\00"
@.str.1 = [2 x i8] c"w\00"
define void @backlight_on() {
%1 = call i32 @popen(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"echo 1 > /proc/easy_backlight\00"
@.str.1 = [2 x i8] c"w\00"
define void @backlight_on() {
%1 = tail call i32 @popen(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
void *calloc(int, size_t);
int /*<<< orphan*/ fatal(char *);
void *ec_malloc(size_t size) {
  void *mem = NULL;
  if (!size)
    goto end;
  mem = calloc(1, size);
  if (!mem)
    fatal("Out of memory");
end:
  return mem;
}


x86 assembly (clang, -O0):
<ec_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1144 <ec_malloc+0x24>
jmp    1172 <ec_malloc+0x52>
mov    -0x8(%rbp),%rsi
mov    $0x1,%edi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116d <ec_malloc+0x4d>
lea    0xe98(%rip),%rdi
call   1040 <fatal@plt>
jmp    1172 <ec_malloc+0x52>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ec_malloc>:
push   %rax
test   %rdi,%rdi
je     1146 <ec_malloc+0x26>
mov    %rdi,%rsi
mov    $0x1,%edi
call   1030 <calloc@plt>
test   %rax,%rax
je     113a <ec_malloc+0x1a>
pop    %rcx
ret
lea    0xebf(%rip),%rdi
call   1040 <fatal@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Out of memory\00"
define i8* @ec_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
store i8* null, i8** %3
%4 = load i64, i64* %2
%5 = icmp ne i64 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %1
br label %15
7: ; preds = %1
%8 = load i64, i64* %2
%9 = call i8* @calloc(i32 1, i64 %8)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = icmp ne i8* %10, null
br i1 %11, label %14, label %12
12: ; preds = %7
%13 = call i32 @fatal(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %7
br label %15
15: ; preds = %14, %6
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
@.str = [14 x i8] c"Out of memory\00"
define i8* @ec_malloc(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = tail call i8* @calloc(i32 1, i64 %0)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @fatal(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %3, %6, %1
%9 = phi i8* [ %4, %3 ], [ null, %6 ], [ null, %1 ]
ret i8* %9
}
/* Type definitions */
typedef int /*<<< orphan*/ u_char;
struct fsm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fsm_Output(struct fsm *, int, int /*<<< orphan*/,
                              int /*<<< orphan*/ *, int /*<<< orphan*/, int);
void CcpSendTerminateAck(struct fsm *fp, u_char id) {
  fsm_Output(fp, 6, id, NULL, 0, 35);
}


x86 assembly (clang, -O0):
<CcpSendTerminateAck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    $0x6,%esi
xor    %eax,%eax
mov    %eax,%ecx
xor    %r8d,%r8d
mov    $0x23,%r9d
call   1030 <fsm_Output@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CcpSendTerminateAck>:
mov    %esi,%edx
mov    $0x6,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    $0x23,%r9d
jmp    1030 <fsm_Output@plt>

LLVM IR (-O0):
%struct.fsm = type { i32 }
define void @CcpSendTerminateAck(%struct.fsm* %0, i32 %1) {
%3 = alloca %struct.fsm*
%4 = alloca i32
store %struct.fsm* %0, %struct.fsm** %3
store i32 %1, i32* %4
%5 = load %struct.fsm*, %struct.fsm** %3
%6 = load i32, i32* %4
%7 = call i32 @fsm_Output(%struct.fsm* %5, i32 6, i32 %6, i32* null, i32 0, i32 35)
ret void
}

LLVM IR (-O2):
%struct.fsm = type { i32 }
define void @CcpSendTerminateAck(%struct.fsm* %0, i32 %1) {
%3 = tail call i32 @fsm_Output(%struct.fsm* %0, i32 6, i32 %1, i32* null, i32 0, i32 35)
ret void
}
/* Type definitions */
struct skt_buf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ skt_buf_cat(struct skt_buf *, void const *, size_t);
int /*<<< orphan*/ skt_buf_truncate(struct skt_buf *, int /*<<< orphan*/);
void skt_buf_set(struct skt_buf *buf, const void *data, size_t size) {
  skt_buf_truncate(buf, 0);
  skt_buf_cat(buf, data, size);
}


x86 assembly (clang, -O0):
<skt_buf_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <skt_buf_truncate@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <skt_buf_cat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skt_buf_set>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %esi,%esi
call   1030 <skt_buf_truncate@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <skt_buf_cat@plt>

LLVM IR (-O0):
%struct.skt_buf = type { i32 }
define void @skt_buf_set(%struct.skt_buf* %0, i8* %1, i64 %2) {
%4 = alloca %struct.skt_buf*
%5 = alloca i8*
%6 = alloca i64
store %struct.skt_buf* %0, %struct.skt_buf** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load %struct.skt_buf*, %struct.skt_buf** %4
%8 = call i32 @skt_buf_truncate(%struct.skt_buf* %7, i32 0)
%9 = load %struct.skt_buf*, %struct.skt_buf** %4
%10 = load i8*, i8** %5
%11 = load i64, i64* %6
%12 = call i32 @skt_buf_cat(%struct.skt_buf* %9, i8* %10, i64 %11)
ret void
}

LLVM IR (-O2):
%struct.skt_buf = type { i32 }
define void @skt_buf_set(%struct.skt_buf* %0, i8* %1, i64 %2) {
%4 = tail call i32 @skt_buf_truncate(%struct.skt_buf* %0, i32 0)
%5 = tail call i32 @skt_buf_cat(%struct.skt_buf* %0, i8* %1, i64 %2)
ret void
}
int test_imm_DEuint8_mem(unsigned char *val) {
  return ((*val) & (-0xDE << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_DEuint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%edx
and    $0xffffff22,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_DEuint8_mem>:
testb  $0x22,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_DEuint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, -222
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_DEuint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 34
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
unsigned char VIM_HIF_GetReg8(int);
int /*<<< orphan*/ VIM_HIF_SetReg8(int, unsigned char);
void VIM_IPP_SetSizeBypassDisable(unsigned char bBypassbit) {
  unsigned char bTemp;
  bTemp = VIM_HIF_GetReg8((0x1c00 + 0x050));
  bTemp &= (~bBypassbit);
  VIM_HIF_SetReg8((0x1c00 + 0x050), bTemp);
}


x86 assembly (clang, -O0):
<VIM_IPP_SetSizeBypassDisable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x1c50,%edi
call   1040 <VIM_HIF_GetReg8@plt>
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%ecx
xor    $0xffffffff,%ecx
movzbl -0x2(%rbp),%eax
and    %ecx,%eax
mov    %al,-0x2(%rbp)
mov    $0x1c50,%edi
movzbl -0x2(%rbp),%esi
call   1030 <VIM_HIF_SetReg8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VIM_IPP_SetSizeBypassDisable>:
push   %rbx
mov    %edi,%ebx
mov    $0x1c50,%edi
call   1040 <VIM_HIF_GetReg8@plt>
not    %bl
and    %al,%bl
movzbl %bl,%esi
mov    $0x1c50,%edi
pop    %rbx
jmp    1030 <VIM_HIF_SetReg8@plt>

LLVM IR (-O0):
define void @VIM_IPP_SetSizeBypassDisable(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
%4 = call zeroext i8 @VIM_HIF_GetReg8(i32 7248)
store i8 %4, i8* %3
%5 = load i8, i8* %2
%6 = zext i8 %5 to i32
%7 = xor i32 %6, -1
%8 = load i8, i8* %3
%9 = zext i8 %8 to i32
%10 = and i32 %9, %7
%11 = trunc i32 %10 to i8
store i8 %11, i8* %3
%12 = load i8, i8* %3
%13 = call i32 @VIM_HIF_SetReg8(i32 7248, i8 zeroext %12)
ret void
}

LLVM IR (-O2):
define void @VIM_IPP_SetSizeBypassDisable(i8 zeroext %0) {
%2 = tail call zeroext i8 @VIM_HIF_GetReg8(i32 7248)
%3 = xor i8 %0, -1
%4 = and i8 %2, %3
%5 = tail call i32 @VIM_HIF_SetReg8(i32 7248, i8 zeroext %4)
ret void
}
void gdk_display_get_window_at_pointer() {}


x86 assembly (clang, -O0):
<gdk_display_get_window_at_pointer>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gdk_display_get_window_at_pointer>:
ret

LLVM IR (-O0):
define void @gdk_display_get_window_at_pointer() {
ret void
}

LLVM IR (-O2):
define void @gdk_display_get_window_at_pointer() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(float *, float const *, int);
void glmCopyMatrix3f(const float source[9], float target[9]) {
  memcpy(target, source, 9 * sizeof(float));
}


x86 assembly (clang, -O0):
<glmCopyMatrix3f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x24,%edx
call   1030 <memcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmCopyMatrix3f>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
mov    $0x24,%edx
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @glmCopyMatrix3f(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %4
%6 = load float*, float** %3
%7 = call i32 @memcpy(float* %5, float* %6, i32 36)
ret void
}

LLVM IR (-O2):
define void @glmCopyMatrix3f(float* %0, float* %1) {
%3 = tail call i32 @memcpy(float* %1, float* %0, i32 36)
ret void
}
int test_029(int a, int b, int c, int d) { return ((c >> 31) & 1) + a + b; }


x86 assembly (clang, -O0):
<test_029>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x1f,%eax
and    $0x1,%eax
add    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_029>:
shr    $0x1f,%edx
lea    (%rdi,%rsi,1),%eax
add    %edx,%eax
ret

LLVM IR (-O0):
define i32 @test_029(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %7
%10 = ashr i32 %9, 31
%11 = and i32 %10, 1
%12 = load i32, i32* %5
%13 = add nsw i32 %11, %12
%14 = load i32, i32* %6
%15 = add nsw i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @test_029(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = lshr i32 %2, 31
%6 = add i32 %1, %0
%7 = add i32 %6, %5
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ get_screen_size();
void display_recheck_size(void) { get_screen_size(); }


x86 assembly (clang, -O0):
<display_recheck_size>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <get_screen_size@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_recheck_size>:
xor    %eax,%eax
jmp    1030 <get_screen_size@plt>

LLVM IR (-O0):
define void @display_recheck_size() {
%1 = call i32 (...) @get_screen_size()
ret void
}

LLVM IR (-O2):
define void @display_recheck_size() {
%1 = tail call i32 (...) @get_screen_size()
ret void
}
void free_double_mat(double **mat, int dim1) {
  int i;
  for (i = 0; i < dim1; i++) {
    free(mat[i]);
  }
  free(mat);
  return;
}


x86 assembly (clang, -O0):
<free_double_mat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <free_double_mat+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <free_double_mat+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_double_mat>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <free_double_mat+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <free_double_mat+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_double_mat(double** %0, i32 %1) {
%3 = alloca double**
%4 = alloca i32
%5 = alloca i32
store double** %0, double*** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load double**, double*** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double*, double** %11, i64 %13
%15 = load double*, double** %14
%16 = bitcast double* %15 to i8*
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = load double**, double*** %3
%22 = bitcast double** %21 to i8*
ret void
}

LLVM IR (-O2):
define void @free_double_mat(double** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds double*, double** %0, i64 %7
%9 = bitcast double** %8 to i8**
%10 = load i8*, i8** %9
tail call void @free(i8* %10)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = bitcast double** %0 to i8*
tail call void @free(i8* %14)
ret void
}
unsigned short get_lfsr(int isdb, int index) {
  return (unsigned short)((1 + 2 * isdb + index) * 12345);
}


x86 assembly (clang, -O0):
<get_lfsr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
add    -0x8(%rbp),%eax
imul   $0x3039,%eax,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_lfsr>:
lea    (%rsi,%rdi,2),%eax
imul   $0x3039,%eax,%eax
add    $0x3039,%eax
ret

LLVM IR (-O0):
define zeroext i16 @get_lfsr(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = mul nsw i32 2, %5
%7 = add nsw i32 1, %6
%8 = load i32, i32* %4
%9 = add nsw i32 %7, %8
%10 = mul nsw i32 %9, 12345
%11 = trunc i32 %10 to i16
ret i16 %11
}

LLVM IR (-O2):
define zeroext i16 @get_lfsr(i32 %0, i32 %1) {
%3 = shl nsw i32 %0, 1
%4 = or i32 %3, 1
%5 = add nsw i32 %4, %1
%6 = trunc i32 %5 to i16
%7 = mul i16 %6, 12345
ret i16 %7
}
unsigned int bufpair(int bigend, unsigned char *p, int n) {
  if (bigend) {
    return (p[n] << 8) | p[n + 1];
  }
  return p[n] | (p[n + 1] << 8);
}


x86 assembly (clang, -O0):
<bufpair>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1142 <bufpair+0x42>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1167 <bufpair+0x67>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bufpair>:
movslq %edx,%rax
movzbl (%rsi,%rax,1),%ecx
test   %edi,%edi
je     1116 <bufpair+0x16>
shl    $0x8,%ecx
movzbl 0x1(%rax,%rsi,1),%eax
or     %ecx,%eax
ret
movzbl 0x1(%rax,%rsi,1),%eax
shl    $0x8,%eax
or     %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @bufpair(i32 %0, i8* nocapture %1, i32 %2) {
%4 = icmp eq i32 %0, 0
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds i8, i8* %1, i64 %5
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
br i1 %4, label %17, label %9
9: ; preds = %3
%10 = shl nuw nsw i32 %8, 8
%11 = add nsw i32 %2, 1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %1, i64 %12
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = or i32 %10, %15
br label %25
17: ; preds = %3
%18 = add nsw i32 %2, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %1, i64 %19
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = shl nuw nsw i32 %22, 8
%24 = or i32 %23, %8
br label %25
25: ; preds = %17, %9
%26 = phi i32 [ %16, %9 ], [ %24, %17 ]
ret i32 %26
}
cbuf2(f, n) int f, n;
{ cbuf(f, n, 2); }


x86 assembly (clang, -O0):
<cbuf2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x2,%edx
mov    $0x0,%al
call   1030 <cbuf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbuf2>:
mov    $0x2,%edx
xor    %eax,%eax
jmp    1030 <cbuf@plt>

LLVM IR (-O0):
define i32 @cbuf2(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %6, i32 %7, i32 2)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @cbuf2(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %0, i32 %1, i32 2)
ret i32 undef
}
/* Type definitions */
struct libdeflate_compressor {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _libdeflate_aligned_free(struct libdeflate_compressor *);
void libdeflate_free_compressor(struct libdeflate_compressor *c) {
  _libdeflate_aligned_free(c);
}


x86 assembly (clang, -O0):
<libdeflate_free_compressor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <_libdeflate_aligned_free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<libdeflate_free_compressor>:
jmp    1030 <_libdeflate_aligned_free@plt>

LLVM IR (-O0):
%struct.libdeflate_compressor = type { i32 }
define void @libdeflate_free_compressor(%struct.libdeflate_compressor* %0) {
%2 = alloca %struct.libdeflate_compressor*
store %struct.libdeflate_compressor* %0, %struct.libdeflate_compressor** %2
%3 = load %struct.libdeflate_compressor*, %struct.libdeflate_compressor** %2
%4 = call i32 @_libdeflate_aligned_free(%struct.libdeflate_compressor* %3)
ret void
}

LLVM IR (-O2):
%struct.libdeflate_compressor = type { i32 }
define void @libdeflate_free_compressor(%struct.libdeflate_compressor* %0) {
%2 = tail call i32 @_libdeflate_aligned_free(%struct.libdeflate_compressor* %0)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
bool rtp_check_padding(const uint8_t *p_rtp) { return !!(p_rtp[0] & 0x20); }


x86 assembly (clang, -O0):
<rtp_check_padding>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0x20,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtp_check_padding>:
mov    (%rdi),%eax
shr    $0x5,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @rtp_check_padding(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = and i32 %5, 32
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @rtp_check_padding(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = lshr i32 %2, 5
%4 = and i32 %3, 1
ret i32 %4
}
struct tree *create_leaf() {
  return 0;
}


x86 assembly (clang, -O0):
<create_leaf>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_leaf>:
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.tree = type opaque
define %struct.tree* @create_leaf() {
ret %struct.tree* null
}

LLVM IR (-O2):
%struct.tree = type opaque
define noalias %struct.tree* @create_leaf() {
ret %struct.tree* null
}
int test_imm_C7int64_midword_reg(long long val) {
  return ((val >> 16) & (0xC7 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_C7int64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x10,%rdx
and    $0xc7,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_C7int64_midword_reg>:
test   $0xc70000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_C7int64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 16
%5 = and i64 %4, 199
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_C7int64_midword_reg(i64 %0) {
%2 = and i64 %0, 13041664
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ malloc(int);
void alloc_is_negative_Bad() { malloc(-2); }


x86 assembly (clang, -O0):
<alloc_is_negative_Bad>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffffffe,%edi
call   1030 <malloc@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_is_negative_Bad>:
mov    $0xfffffffe,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define void @alloc_is_negative_Bad() {
%1 = call i32 @malloc(i32 -2)
ret void
}

LLVM IR (-O2):
define void @alloc_is_negative_Bad() {
%1 = tail call i32 @malloc(i32 -2)
ret void
}
/* Variables and functions */
char *my_mallocc(int, char *);
int /*<<< orphan*/ sprintf(char *, char *, long long);
char *lltoa(long long in) {
  char *r = my_mallocc(40, "string");
  sprintf(r, "%lld", in);
  return r;
}


x86 assembly (clang, -O0):
<lltoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x28,%edi
lea    0xec8(%rip),%rsi
call   1030 <my_mallocc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xeb7(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lltoa>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xed2(%rip),%rsi
mov    $0x28,%edi
call   1030 <my_mallocc@plt>
mov    %rax,%rbx
lea    0xec5(%rip),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
call   1040 <sprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"string\00"
@.str.1 = [5 x i8] c"%lld\00"
define i8* @lltoa(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = call i8* @my_mallocc(i32 40, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = load i64, i64* %2
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %6)
%8 = load i8*, i8** %3
ret i8* %8
}

LLVM IR (-O2):
@.str = [7 x i8] c"string\00"
@.str.1 = [5 x i8] c"%lld\00"
define i8* @lltoa(i64 %0) {
%2 = tail call i8* @my_mallocc(i32 40, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 %0)
ret i8* %2
}
/* Variables and functions */
int istrsenvisx(char *, int /*<<< orphan*/ *, char const *, size_t, int, char *,
                int /*<<< orphan*/ *);
int strvisx(char *mbdst, const char *mbsrc, size_t len, int flags) {
  return istrsenvisx(mbdst, NULL, mbsrc, len, flags, "", NULL);
}


x86 assembly (clang, -O0):
<strvisx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%esi
lea    0xebe(%rip),%r9
movq   $0x0,(%rsp)
call   1030 <istrsenvisx@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strvisx>:
push   %rax
mov    %ecx,%r8d
mov    %rdx,%rcx
mov    %rsi,%rdx
movq   $0x0,(%rsp)
lea    0xed7(%rip),%r9
xor    %esi,%esi
call   1030 <istrsenvisx@plt>
pop    %rcx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @strvisx(i8* %0, i8* %1, i64 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i64, i64* %7
%12 = load i32, i32* %8
%13 = call i32 @istrsenvisx(i8* %9, i32* null, i8* %10, i64 %11, i32 %12, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32* null)
ret i32 %13
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @strvisx(i8* %0, i8* %1, i64 %2, i32 %3) {
%5 = tail call i32 @istrsenvisx(i8* %0, i32* null, i8* %1, i64 %2, i32 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32* null)
ret i32 %5
}
short toWord(const char *bytes) {
  short result;
  result = 0;
  result = 0X00FF & bytes[0];
  result = (bytes[1] << 8) | result;
  return result;
}


x86 assembly (clang, -O0):
<toWord>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movw   $0x0,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
and    $0xff,%eax
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
shl    $0x8,%eax
movswl -0xa(%rbp),%ecx
or     %ecx,%eax
mov    %ax,-0xa(%rbp)
movswl -0xa(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<toWord>:
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
define signext i16 @toWord(i8* %0) {
%2 = alloca i8*
%3 = alloca i16
store i8* %0, i8** %2
store i16 0, i16* %3
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = and i32 255, %7
%9 = trunc i32 %8 to i16
store i16 %9, i16* %3
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = shl i32 %13, 8
%15 = load i16, i16* %3
%16 = sext i16 %15 to i32
%17 = or i32 %14, %16
%18 = trunc i32 %17 to i16
store i16 %18, i16* %3
%19 = load i16, i16* %3
ret i16 %19
}

LLVM IR (-O2):
define signext i16 @toWord(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = load i8, i8* %3
%5 = zext i8 %4 to i16
%6 = shl nuw i16 %5, 8
%7 = zext i8 %2 to i16
%8 = or i16 %6, %7
ret i16 %8
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ ispunct(int);
void t_ispunct_0xc9() {
  Assert_real((ispunct(201) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_ispunct.c",
              1010, ("ispunct should be 0 for 0xc9"));
}


x86 assembly (clang, -O0):
<t_ispunct_0xc9>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc9,%edi
call   1030 <ispunct@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x3f2,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_ispunct_0xc9>:
push   %rax
mov    $0xc9,%edi
call   1030 <ispunct@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x3f2,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_ispunct.c\00"
@.str.1 = [29 x i8] c"ispunct should be 0 for 0xc9\00"
define void @t_ispunct_0xc9() {
%1 = call i64 @ispunct(i32 201)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1010, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_ispunct.c\00"
@.str.1 = [29 x i8] c"ispunct should be 0 for 0xc9\00"
define void @t_ispunct_0xc9() {
%1 = tail call i64 @ispunct(i32 201)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1010, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ light;

/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
void revelation() {
  char light[489];
  fgets(light, sizeof(light) - 1, stdin);
  printf("%s\n", light);
}


x86 assembly (clang, -O0):
<revelation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f0,%rsp
lea    -0x1f0(%rbp),%rdi
mov    0x2eaf(%rip),%rax
mov    (%rax),%edx
mov    $0x1e8,%esi
call   1040 <fgets@plt>
lea    -0x1f0(%rbp),%rsi
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
add    $0x1f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<revelation>:
push   %rbx
sub    $0x1f0,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1e8,%esi
call   1040 <fgets@plt>
lea    0xeb8(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x1f0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @revelation() {
%1 = alloca [489 x i8]
%2 = getelementptr inbounds [489 x i8], [489 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fgets(i8* %2, i32 488, i32 %3)
%5 = getelementptr inbounds [489 x i8], [489 x i8]* %1, i64 0, i64 0
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @revelation() {
%1 = alloca [489 x i8]
%2 = getelementptr inbounds [489 x i8], [489 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i32 @fgets(i8* %2, i32 488, i32 %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret void
}
/* Variables and functions */
const char *get_region_name_MO(int region_code) {
  switch (region_code) {
  case 1:
    return "Ilhas";
  case 2:
    return "Macau";
  default:
    return NULL;
  }
}


x86 assembly (clang, -O0):
<get_region_name_MO>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     112c <get_region_name_MO+0x2c>
jmp    111b <get_region_name_MO+0x1b>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     113c <get_region_name_MO+0x3c>
jmp    114c <get_region_name_MO+0x4c>
lea    0xecd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1154 <get_region_name_MO+0x54>
lea    0xec3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1154 <get_region_name_MO+0x54>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_region_name_MO>:
xor    %ecx,%ecx
cmp    $0x2,%edi
lea    0xefa(%rip),%rax
cmove  %rax,%rcx
cmp    $0x1,%edi
lea    0xee6(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Ilhas\00"
@.str.1 = [6 x i8] c"Macau\00"
define i8* @get_region_name_MO(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 1, label %5
i32 2, label %6
]
5: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
br label %8
6: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %8
7: ; preds = %1
store i8* null, i8** %2
br label %8
8: ; preds = %7, %6, %5
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [6 x i8] c"Ilhas\00"
@.str.1 = [6 x i8] c"Macau\00"
define i8* @get_region_name_MO(i32 %0) {
%2 = icmp eq i32 %0, 2
%3 = select i1 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* null
%4 = icmp eq i32 %0, 1
%5 = select i1 %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %3
ret i8* %5
}
int divide(int n, int d, int *r) {
  int q;
  q = n / d;
  *r = n - q * d;
  return q;
}


x86 assembly (clang, -O0):
<divide>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x14(%rbp),%eax
imul   -0x8(%rbp),%eax
sub    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<divide>:
mov    %rdx,%rcx
mov    %edi,%eax
cltd
idiv   %esi
mov    %edx,(%rcx)
ret

LLVM IR (-O0):
define i32 @divide(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = sdiv i32 %8, %9
store i32 %10, i32* %7
%11 = load i32, i32* %4
%12 = load i32, i32* %7
%13 = load i32, i32* %5
%14 = mul nsw i32 %12, %13
%15 = sub nsw i32 %11, %14
%16 = load i32*, i32** %6
store i32 %15, i32* %16
%17 = load i32, i32* %7
ret i32 %17
}

LLVM IR (-O2):
define i32 @divide(i32 %0, i32 %1, i32* nocapture writeonly %2) {
%4 = sdiv i32 %0, %1
%5 = mul nsw i32 %4, %1
%6 = srem i32 %0, %1
store i32 %6, i32* %2
ret i32 %4
}
void setPixel(int x, int y, int color) {
  int offset = 1 * x + (160 * 1) * y;
  *(char *)(0x2000 + offset) = color;
}


x86 assembly (clang, -O0):
<setPixel>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x0,%eax
imul   $0xa0,-0x8(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%eax
add    $0x2000,%eax
cltq
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<setPixel>:
lea    (%rsi,%rsi,4),%eax
shl    $0x5,%eax
add    %edi,%eax
add    $0x2000,%eax
cltq
mov    %dl,(%rax)
ret

LLVM IR (-O0):
define void @setPixel(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = mul nsw i32 1, %8
%10 = load i32, i32* %5
%11 = mul nsw i32 160, %10
%12 = add nsw i32 %9, %11
store i32 %12, i32* %7
%13 = load i32, i32* %6
%14 = trunc i32 %13 to i8
%15 = load i32, i32* %7
%16 = add nsw i32 8192, %15
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i8*
store i8 %14, i8* %18
ret void
}

LLVM IR (-O2):
define void @setPixel(i32 %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %1, 160
%5 = trunc i32 %2 to i8
%6 = add i32 %0, 8192
%7 = add i32 %6, %4
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i8*
store i8 %5, i8* %9
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AF_PACKET;
int /*<<< orphan*/ ETH_P_ALL;
int /*<<< orphan*/ SOCK_RAW;
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int abrirSocketRaw(void) {
  int packet_socket = 0;
  packet_socket = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
  return packet_socket;
}


x86 assembly (clang, -O0):
<abrirSocketRaw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
call   1030 <htons@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    %eax,%edx
call   1040 <socket@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<abrirSocketRaw>:
push   %rbp
push   %rbx
push   %rax
mov    0x2ea6(%rip),%rax
mov    (%rax),%ebx
mov    0x2eb5(%rip),%rax
mov    (%rax),%ebp
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
call   1030 <htons@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <socket@plt>

LLVM IR (-O0):
@AF_PACKET = global i32 0
@SOCK_RAW = global i32 0
@ETH_P_ALL = global i32 0
define i32 @abrirSocketRaw() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @AF_PACKET
%3 = load i32, i32* @SOCK_RAW
%4 = load i32, i32* @ETH_P_ALL
%5 = call i32 @htons(i32 %4)
%6 = call i32 @socket(i32 %2, i32 %3, i32 %5)
store i32 %6, i32* %1
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
@AF_PACKET = global i32 0
@SOCK_RAW = global i32 0
@ETH_P_ALL = global i32 0
define i32 @abrirSocketRaw() {
%1 = load i32, i32* @AF_PACKET
%2 = load i32, i32* @SOCK_RAW
%3 = load i32, i32* @ETH_P_ALL
%4 = tail call i32 @htons(i32 %3)
%5 = tail call i32 @socket(i32 %1, i32 %2, i32 %4)
ret i32 %5
}
__attribute__((always_)) int fls(int x) {
  return x ? sizeof(x) * 8 - __builtin_clz(x) : 0;
}


x86 assembly (clang, -O0):
<fls>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     112e <fls+0x2e>
mov    -0x4(%rbp),%eax
bsr    %eax,%eax
xor    $0x1f,%eax
movslq %eax,%rcx
mov    $0x20,%eax
sub    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1139 <fls+0x39>
xor    %eax,%eax
mov    %rax,-0x10(%rbp)
jmp    1139 <fls+0x39>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fls>:
test   %edi,%edi
je     110e <fls+0xe>
bsr    %edi,%eax
xor    $0xffffffe0,%eax
add    $0x21,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @fls(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load i32, i32* %2
%7 = call i32 @llvm.ctlz.i32(i32 %6, i1 true)
%8 = sext i32 %7 to i64
%9 = sub i64 32, %8
br label %11
10: ; preds = %1
br label %11
11: ; preds = %10, %5
%12 = phi i64 [ %9, %5 ], [ 0, %10 ]
%13 = trunc i64 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @fls(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @llvm.ctlz.i32(i32 %0, i1 true)
%5 = sub nuw nsw i32 32, %4
br label %6
6: ; preds = %1, %3
%7 = phi i32 [ %5, %3 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ watchdog_start();
void watchdog_init(unsigned long prescaler, unsigned long divider,
                   unsigned long wtdat, unsigned long interrupt,
                   unsigned long reset) {
  (*((volatile unsigned long *)((0x7E004000) + 0x04))) = wtdat;
  (*((volatile unsigned long *)((0x7E004000) + 0x00))) =
      ((prescaler - 1) << 8) | (divider << 3) | (interrupt << 2) | (reset << 0);
  watchdog_start();
}


x86 assembly (clang, -O0):
<watchdog_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x18(%rbp),%rcx
mov    $0x7e004004,%eax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rcx
sub    $0x1,%rcx
shl    $0x8,%rcx
mov    -0x10(%rbp),%rax
shl    $0x3,%rax
or     %rax,%rcx
mov    -0x20(%rbp),%rax
shl    $0x2,%rax
or     %rax,%rcx
mov    -0x28(%rbp),%rax
shl    $0x0,%rax
or     %rax,%rcx
mov    $0x7e004000,%eax
mov    %rcx,(%rax)
mov    $0x0,%al
call   1030 <watchdog_start@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<watchdog_init>:
mov    %rdx,0x7e004004
7e
shl    $0x8,%rdi
add    $0xffffffffffffff00,%rdi
shl    $0x3,%rsi
shl    $0x2,%rcx
or     %rsi,%rcx
or     %rdi,%rcx
or     %r8,%rcx
mov    %rcx,0x7e004000
7e
xor    %eax,%eax
jmp    1030 <watchdog_start@plt>

LLVM IR (-O0):
define void @watchdog_init(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i64 %0, i64* %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i64 %4, i64* %10
%11 = load i64, i64* %8
store volatile i64 %11, i64* inttoptr (i64 2113945604 to i64*)
%12 = load i64, i64* %6
%13 = sub i64 %12, 1
%14 = shl i64 %13, 8
%15 = load i64, i64* %7
%16 = shl i64 %15, 3
%17 = or i64 %14, %16
%18 = load i64, i64* %9
%19 = shl i64 %18, 2
%20 = or i64 %17, %19
%21 = load i64, i64* %10
%22 = shl i64 %21, 0
%23 = or i64 %20, %22
store volatile i64 %23, i64* inttoptr (i64 2113945600 to i64*)
%24 = call i32 (...) @watchdog_start()
ret void
}

LLVM IR (-O2):
define void @watchdog_init(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4) {
store volatile i64 %2, i64* inttoptr (i64 2113945604 to i64*)
%6 = shl i64 %0, 8
%7 = add i64 %6, -256
%8 = shl i64 %1, 3
%9 = or i64 %7, %8
%10 = shl i64 %3, 2
%11 = or i64 %9, %10
%12 = or i64 %11, %4
store volatile i64 %12, i64* inttoptr (i64 2113945600 to i64*)
%13 = tail call i32 (...) @watchdog_start()
ret void
}