xunge/DecIR huggingface dataset:
/* Type definitions */
struct mainwindow {
  int dummy;
};

/* Variables and functions */
int catchup_all(struct mainwindow *);
int handle_catchup_all(struct mainwindow *mw) { return catchup_all(mw); }


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

x86 assembly (clang, -O2):
<handle_catchup_all>:
jmp    1030 <catchup_all@plt>

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

LLVM IR (-O2):
%struct.mainwindow = type { i32 }
define i32 @handle_catchup_all(%struct.mainwindow* %0) {
%2 = tail call i32 @catchup_all(%struct.mainwindow* %0)
ret i32 %2
}
/* Variables and functions */
double fabs(double const);
short sign(const double x) {
  if (fabs(x) < 0.00000000000000001)
    return 0;
  else if (x > 0)
    return 1;
  else
    return -1;
}


x86 assembly (clang, -O0):
<sign>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
movaps 0xefb(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xedf(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1136 <sign+0x36>
movw   $0x0,-0x2(%rbp)
jmp    1159 <sign+0x59>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1153 <sign+0x53>
movw   $0x1,-0x2(%rbp)
jmp    1159 <sign+0x59>
movw   $0xffff,-0x2(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sign>:
movapd 0xef8(%rip),%xmm1
andpd  %xmm0,%xmm1
xorpd  %xmm2,%xmm2
xor    %eax,%eax
ucomisd %xmm2,%xmm0
seta   %al
xor    %ecx,%ecx
movsd  0xeed(%rip),%xmm0
ucomisd %xmm1,%xmm0
lea    -0x1(%rax,%rax,1),%eax
cmova  %ecx,%eax
ret

LLVM IR (-O0):
define signext i16 @sign(double %0) {
%2 = alloca i16
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = call double @llvm.fabs.f64(double %4)
%6 = fcmp olt double %5, 1.000000e-17
br i1 %6, label %7, label %8
7: ; preds = %1
store i16 0, i16* %2
br label %13
8: ; preds = %1
%9 = load double, double* %3
%10 = fcmp ogt double %9, 0.000000e+00
br i1 %10, label %11, label %12
11: ; preds = %8
store i16 1, i16* %2
br label %13
12: ; preds = %8
store i16 -1, i16* %2
br label %13
13: ; preds = %12, %11, %7
%14 = load i16, i16* %2
ret i16 %14
}

LLVM IR (-O2):
define signext i16 @sign(double %0) {
%2 = tail call double @llvm.fabs.f64(double %0)
%3 = fcmp olt double %2, 1.000000e-17
%4 = fcmp ogt double %0, 0.000000e+00
%5 = select i1 %4, i16 1, i16 -1
%6 = select i1 %3, i16 0, i16 %5
ret i16 %6
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void __attribute__((noreturn)) noreturn_func(void) { abort(); }


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

x86 assembly (clang, -O2):
<noreturn_func>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @noreturn_func() {
%1 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define void @noreturn_func() {
%1 = tail call i32 (...) @abort()
unreachable
}
void CPLGetLibVersion(unsigned int *pVerMaj, unsigned int *pVerMin,
                      unsigned int *pBuild) {
  if (pVerMaj)
    *pVerMaj = 2;
  if (pVerMin)
    *pVerMin = 0;
  if (pBuild)
    *pBuild = 0;
}


x86 assembly (clang, -O0):
<CPLGetLibVersion>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1125 <CPLGetLibVersion+0x25>
mov    -0x8(%rbp),%rax
movl   $0x2,(%rax)
cmpq   $0x0,-0x10(%rbp)
je     113a <CPLGetLibVersion+0x3a>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     114f <CPLGetLibVersion+0x4f>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<CPLGetLibVersion>:
test   %rdi,%rdi
je     110b <CPLGetLibVersion+0xb>
movl   $0x2,(%rdi)
test   %rsi,%rsi
je     1116 <CPLGetLibVersion+0x16>
movl   $0x0,(%rsi)
test   %rdx,%rdx
je     1121 <CPLGetLibVersion+0x21>
movl   $0x0,(%rdx)
ret

LLVM IR (-O0):
define void @CPLGetLibVersion(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %4
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = load i32*, i32** %4
store i32 2, i32* %10
br label %11
11: ; preds = %9, %3
%12 = load i32*, i32** %5
%13 = icmp ne i32* %12, null
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = load i32*, i32** %5
store i32 0, i32* %15
br label %16
16: ; preds = %14, %11
%17 = load i32*, i32** %6
%18 = icmp ne i32* %17, null
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = load i32*, i32** %6
store i32 0, i32* %20
br label %21
21: ; preds = %19, %16
ret void
}

LLVM IR (-O2):
define void @CPLGetLibVersion(i32* writeonly %0, i32* writeonly %1, i32* writeonly %2) {
%4 = icmp eq i32* %0, null
br i1 %4, label %6, label %5
5: ; preds = %3
store i32 2, i32* %0
br label %6
6: ; preds = %5, %3
%7 = icmp eq i32* %1, null
br i1 %7, label %9, label %8
8: ; preds = %6
store i32 0, i32* %1
br label %9
9: ; preds = %8, %6
%10 = icmp eq i32* %2, null
br i1 %10, label %12, label %11
11: ; preds = %9
store i32 0, i32* %2
br label %12
12: ; preds = %11, %9
ret void
}
/* Variables and functions */
int /*<<< orphan*/ HariMain();
void HariStartup(void) {
  HariMain();
  return;
}


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

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

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

LLVM IR (-O2):
define void @HariStartup() {
%1 = tail call i32 (...) @HariMain()
ret void
}
int test_imm_DAuint64_lowword_reg(unsigned long long val) {
  return ((val) & (0xDA << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_DAuint64_lowword_reg>:
test   $0xda,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_DAuint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 218
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int fesetround(int round) {
  unsigned short int cw;
  if ((round & ~0xc00) != 0)
    return 1;
  __asm__("fnstcw %0" : "=m"(*&cw));
  cw &= ~0xc00;
  cw |= round;
  __asm__("fldcw %0" : : "m"(*&cw));
  return 0;
}


x86 assembly (clang, -O0):
<fesetround>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xfffff3ff,%eax
cmp    $0x0,%eax
je     1124 <fesetround+0x24>
movl   $0x1,-0x4(%rbp)
jmp    114b <fesetround+0x4b>
fnstcw -0xa(%rbp)
movzwl -0xa(%rbp),%eax
and    $0xfffff3ff,%eax
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%ecx
movzwl -0xa(%rbp),%eax
or     %ecx,%eax
mov    %ax,-0xa(%rbp)
fldcw  -0xa(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fesetround>:
mov    $0x1,%eax
test   $0xfffff3ff,%edi
je     110e <fesetround+0xe>
ret
fnstcw -0x2(%rsp)
movzwl -0x2(%rsp),%eax
and    $0xfffff3ff,%eax
or     %edi,%eax
mov    %ax,-0x2(%rsp)
fldcw  -0x2(%rsp)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @fesetround(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i16
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = and i32 %5, -3073
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 1, i32* %2
br label %19
9: ; preds = %1
%10 = load i16, i16* %4
%11 = zext i16 %10 to i32
%12 = and i32 %11, -3073
%13 = trunc i32 %12 to i16
store i16 %13, i16* %4
%14 = load i32, i32* %3
%15 = load i16, i16* %4
%16 = zext i16 %15 to i32
%17 = or i32 %16, %14
%18 = trunc i32 %17 to i16
store i16 %18, i16* %4
store i32 0, i32* %2
br label %19
19: ; preds = %9, %8
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @fesetround(i32 %0) {
%2 = alloca i16
%3 = bitcast i16* %2 to i8*
%4 = and i32 %0, -3073
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i16, i16* %2
%8 = and i16 %7, -3073
%9 = trunc i32 %0 to i16
%10 = or i16 %8, %9
store i16 %10, i16* %2
br label %11
11: ; preds = %1, %6
%12 = phi i32 [ 0, %6 ], [ 1, %1 ]
ret i32 %12
}
int test_imm_30uint16_mem(unsigned short *val) {
  return ((*val) & (-0x30 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_30uint16_mem>:
movzwl (%rdi),%eax
test   $0xffd0,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_30uint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, -48
%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_30uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -48
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int f1(int a, int b) { return b & -(a == 10); }


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmpl   $0xa,-0x4(%rbp)
sete   %cl
and    $0x1,%cl
movzbl %cl,%edx
xor    %ecx,%ecx
sub    %edx,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
xor    %eax,%eax
cmp    $0xa,%edi
cmove  %esi,%eax
ret

LLVM IR (-O0):
define i32 @f1(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 10
%8 = zext i1 %7 to i32
%9 = sub nsw i32 0, %8
%10 = and i32 %5, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @f1(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 10
%4 = select i1 %3, i32 %1, i32 0
ret i32 %4
}
yyerror(msg) char *msg;
{
  extern long yypos;
  printf("line %ld: %s\n", yypos, msg);
  exit(1);
}


x86 assembly (clang, -O0):
<yyerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%rsi
mov    -0x8(%rbp),%rdx
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<yyerror>:
push   %rax
mov    %rdi,%rdx
mov    0x2ebd(%rip),%rax
mov    (%rax),%rsi
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"line %ld: %s\0A\00"
@yypos = external global i64
define i32 @yyerror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i64, i64* @yypos
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %3, i8* %4)
unreachable
}

LLVM IR (-O2):
@.str = [14 x i8] c"line %ld: %s\0A\00"
@yypos = external global i64
define i32 @yyerror(i8* %0) {
%2 = load i64, i64* @yypos
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %2, i8* %0)
tail call void @exit(i32 1)
unreachable
}
int test_2(int a, int b, int c, int d) { return c + (a != b) + d; }


x86 assembly (clang, -O0):
<test_2>:
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
mov    -0x4(%rbp),%ecx
cmp    -0x8(%rbp),%ecx
setne  %cl
and    $0x1,%cl
movzbl %cl,%ecx
add    %ecx,%eax
add    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_2>:
xor    %eax,%eax
cmp    %esi,%edi
setne  %al
add    %edx,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_2(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 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = icmp ne i32 %10, %11
%13 = zext i1 %12 to i32
%14 = add nsw i32 %9, %13
%15 = load i32, i32* %8
%16 = add nsw i32 %14, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @test_2(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp ne i32 %0, %1
%6 = zext i1 %5 to i32
%7 = add nsw i32 %6, %2
%8 = add nsw i32 %7, %3
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ _Mem_Free(void *, int /*<<< orphan*/, int /*<<< orphan*/,
                             char const *, int);
void Irc_MemFree(void *data, const char *filename, int fileline) {
  _Mem_Free(data, 0, 0, filename, fileline);
}


x86 assembly (clang, -O0):
<Irc_MemFree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
xor    %edx,%edx
mov    %edx,%esi
call   1030 <_Mem_Free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Irc_MemFree>:
mov    %edx,%r8d
mov    %rsi,%rcx
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <_Mem_Free@plt>

LLVM IR (-O0):
define void @Irc_MemFree(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @_Mem_Free(i8* %7, i32 0, i32 0, i8* %8, i32 %9)
ret void
}

LLVM IR (-O2):
define void @Irc_MemFree(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @_Mem_Free(i8* %0, i32 0, i32 0, i8* %1, i32 %2)
ret void
}
/* Type definitions */
struct proxy_connection {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct proxy_connection *);
void free_proxy_connection(struct proxy_connection *conn) {
  if (conn)
    free(conn);
}


x86 assembly (clang, -O0):
<free_proxy_connection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <free_proxy_connection+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_proxy_connection>:
test   %rdi,%rdi
je     111a <free_proxy_connection+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
%struct.proxy_connection = type { i32 }
define void @free_proxy_connection(%struct.proxy_connection* %0) {
%2 = alloca %struct.proxy_connection*
store %struct.proxy_connection* %0, %struct.proxy_connection** %2
%3 = load %struct.proxy_connection*, %struct.proxy_connection** %2
%4 = icmp ne %struct.proxy_connection* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load %struct.proxy_connection*, %struct.proxy_connection** %2
%7 = call i32 @free(%struct.proxy_connection* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
%struct.proxy_connection = type { i32 }
define void @free_proxy_connection(%struct.proxy_connection* %0) {
%2 = icmp eq %struct.proxy_connection* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(%struct.proxy_connection* %0)
br label %5
5: ; preds = %3, %1
ret void
}
void _M2_stairs_finish(__attribute__((unused)) int argc,
                       __attribute__((unused)) char *argv[]) {}


x86 assembly (clang, -O0):
<_M2_stairs_finish>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @_M2_stairs_finish(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
ret void
}

LLVM IR (-O2):
define void @_M2_stairs_finish(i32 %0, i8** nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo(int);
void main(void) { foo(12345); }


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

x86 assembly (clang, -O2):
<main>:
mov    $0x3039,%edi
jmp    1030 <foo@plt>

LLVM IR (-O0):
define void @main() {
%1 = call i32 @foo(i32 12345)
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @foo(i32 12345)
ret void
}
imm0imm1(r0, r1, x0, x1, p0, p1) signed char r0, r1;
signed char *p0, *p1;
{
  if (22 <= 33)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<imm0imm1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    %edx,-0x8(%rbp)
mov    %ecx,-0xc(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<imm0imm1>:
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @imm0imm1(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4, i8* %5) {
%7 = alloca i8
%8 = alloca i8
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = trunc i32 %0 to i8
%14 = trunc i32 %1 to i8
store i8 %13, i8* %7
store i8 %14, i8* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i8* %5, i8** %12
ret i32 1
}

LLVM IR (-O2):
define i32 @imm0imm1(i32 %0, i32 %1, i32 %2, i32 %3, i8* nocapture readnone %4, i8* nocapture readnone %5) {
ret i32 1
}
/* Variables and functions */
int calc_boundary_padding(int, int);
int calc_plane_size(int wTiles, int hTiles) {
  return (((64 * 32) * wTiles * hTiles) +
          calc_boundary_padding(wTiles, hTiles));
}


x86 assembly (clang, -O0):
<calc_plane_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0xb,%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <calc_boundary_padding@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_plane_size>:
push   %rbx
mov    %edi,%ebx
imul   %esi,%ebx
shl    $0xb,%ebx
call   1030 <calc_boundary_padding@plt>
add    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @calc_plane_size(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 2048, %5
%7 = load i32, i32* %4
%8 = mul nsw i32 %6, %7
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 @calc_boundary_padding(i32 %9, i32 %10)
%12 = add nsw i32 %8, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @calc_plane_size(i32 %0, i32 %1) {
%3 = shl nsw i32 %0, 11
%4 = mul nsw i32 %3, %1
%5 = tail call i32 @calc_boundary_padding(i32 %0, i32 %1)
%6 = add nsw i32 %5, %4
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int write_i2c_reg(int, int, int /*<<< orphan*/);
int piups_set_v5vconv(int file_i2c, uint16_t v5vconv) {
  return write_i2c_reg(file_i2c, 0x58, v5vconv);
}


x86 assembly (clang, -O0):
<piups_set_v5vconv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    $0x58,%esi
call   1030 <write_i2c_reg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<piups_set_v5vconv>:
mov    %esi,%edx
mov    $0x58,%esi
jmp    1030 <write_i2c_reg@plt>

LLVM IR (-O0):
define i32 @piups_set_v5vconv(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 = load i32, i32* %4
%7 = call i32 @write_i2c_reg(i32 %5, i32 88, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @piups_set_v5vconv(i32 %0, i32 %1) {
%3 = tail call i32 @write_i2c_reg(i32 %0, i32 88, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ SOCK_DGRAM;
int do_open_client_socket(char *, int, int /*<<< orphan*/);
int open_udp_client_socket(char *host, int port) {
  return do_open_client_socket(host, port, SOCK_DGRAM);
}


x86 assembly (clang, -O0):
<open_udp_client_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    0x2ebb(%rip),%rax
mov    (%rax),%edx
call   1030 <do_open_client_socket@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_udp_client_socket>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edx
jmp    1030 <do_open_client_socket@plt>

LLVM IR (-O0):
@SOCK_DGRAM = global i32 0
define i32 @open_udp_client_socket(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = load i32, i32* @SOCK_DGRAM
%8 = call i32 @do_open_client_socket(i8* %5, i32 %6, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
@SOCK_DGRAM = global i32 0
define i32 @open_udp_client_socket(i8* %0, i32 %1) {
%3 = load i32, i32* @SOCK_DGRAM
%4 = tail call i32 @do_open_client_socket(i8* %0, i32 %1, i32 %3)
ret i32 %4
}
/* Variables and functions */
scalar_t__ gethostname(char *const, int);
char *malloc(unsigned long);
char *system_get_hostname(void) {
  char *const hostname = malloc((1ul << 11));
  if (gethostname(hostname, 1024))
    hostname[0] = '\0';
  return hostname;
}


x86 assembly (clang, -O0):
<system_get_hostname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x800,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x400,%esi
call   1040 <gethostname@plt>
cmp    $0x0,%rax
je     1155 <system_get_hostname+0x35>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<system_get_hostname>:
push   %rbx
mov    $0x800,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x400,%esi
call   1040 <gethostname@plt>
test   %rax,%rax
je     1143 <system_get_hostname+0x23>
movb   $0x0,(%rbx)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @system_get_hostname() {
%1 = alloca i8*
%2 = call i8* @malloc(i64 2048)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i64 @gethostname(i8* %3, i32 1024)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = load i8*, i8** %1
%8 = getelementptr inbounds i8, i8* %7, i64 0
store i8 0, i8* %8
br label %9
9: ; preds = %6, %0
%10 = load i8*, i8** %1
ret i8* %10
}

LLVM IR (-O2):
define i8* @system_get_hostname() {
%1 = tail call dereferenceable_or_null(2048) i8* @malloc(i64 2048)
%2 = tail call i64 @gethostname(i8* %1, i32 1024)
%3 = icmp eq i64 %2, 0
br i1 %3, label %5, label %4
4: ; preds = %0
store i8 0, i8* %1
br label %5
5: ; preds = %4, %0
ret i8* %1
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ y;
};
typedef TYPE_1__ XCrossingEvent;

/* Variables and functions */
int get_XCrossingEvent_y(void *_p) { return (int)((XCrossingEvent *)_p)->y; }


x86 assembly (clang, -O0):
<get_XCrossingEvent_y>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_XCrossingEvent_y>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i32 @get_XCrossingEvent_y(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @get_XCrossingEvent_y(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
int test_imm_C2int16_mem(short *val) {
  return ((*val) & (0xC2 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_C2int16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, 194
%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_C2int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 194
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void limpar_tela() { system("clear"); }


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

x86 assembly (clang, -O2):
<limpar_tela>:
lea    0xee9(%rip),%rdi
jmp    1030 <system@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
define void @limpar_tela() {
%1 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
define void @limpar_tela() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int c1(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[], char *envp[]) {
  int o0;
  o0 = c1(argc);
  printf("Result is %d\n", o0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <c1@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1040 <c1@plt>
lea    0xed3(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Result is %d\0A\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%9 = load i32, i32* %5
%10 = call i32 @c1(i32 %9)
store i32 %10, i32* %8
%11 = load i32, i32* %8
%12 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Result is %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = tail call i32 @c1(i32 %0)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ BNCIO(int);
int BNCDot() {
  int ii, stat = 99;
  char com1, data;
  BNCIO(16);
  return (stat);
}


x86 assembly (clang, -O0):
<BNCDot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x63,-0x8(%rbp)
mov    $0x10,%edi
call   1030 <BNCIO@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BNCDot>:
push   %rax
mov    $0x10,%edi
call   1030 <BNCIO@plt>
mov    $0x63,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @BNCDot() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = alloca i8
store i32 99, i32* %2
%5 = call i32 @BNCIO(i32 16)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
define i32 @BNCDot() {
%1 = tail call i32 @BNCIO(i32 16)
ret i32 99
}
/* Variables and functions */
int __semi_call(int, int *);
int semi_flen(int fd) { return __semi_call(0x0C, &fd); }


x86 assembly (clang, -O0):
<semi_flen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0xc,%edi
lea    -0x4(%rbp),%rsi
call   1030 <__semi_call@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<semi_flen>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0xc,%edi
call   1030 <__semi_call@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @semi_flen(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @__semi_call(i32 12, i32* %2)
ret i32 %3
}

LLVM IR (-O2):
define i32 @semi_flen(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @__semi_call(i32 12, i32* %2)
ret i32 %3
}
int calc_size_unsync(const unsigned char *four_bytes) {
  return (four_bytes[3]) + (four_bytes[2] << 7) + (four_bytes[1] << 14) +
         (four_bytes[0] << 21);
}


x86 assembly (clang, -O0):
<calc_size_unsync>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x3(%rax),%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x7,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0xe,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
shl    $0x15,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_size_unsync>:
movzbl 0x3(%rdi),%eax
movzbl 0x2(%rdi),%ecx
shl    $0x7,%ecx
add    %eax,%ecx
movzbl 0x1(%rdi),%edx
shl    $0xe,%edx
add    %ecx,%edx
movzbl (%rdi),%eax
shl    $0x15,%eax
add    %edx,%eax
ret

LLVM IR (-O0):
define i32 @calc_size_unsync(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 3
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 2
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = shl i32 %10, 7
%12 = add nsw i32 %6, %11
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = shl i32 %16, 14
%18 = add nsw i32 %12, %17
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = shl i32 %22, 21
%24 = add nsw i32 %18, %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @calc_size_unsync(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 3
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 7
%9 = add nuw nsw i32 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 1
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl nuw nsw i32 %12, 14
%14 = add nuw nsw i32 %9, %13
%15 = load i8, i8* %0
%16 = zext i8 %15 to i32
%17 = shl nuw nsw i32 %16, 21
%18 = add nuw nsw i32 %14, %17
ret i32 %18
}
double gammafunc(double tkair, double pressmbar, double cpJKkg,
                 double lambdav) {
  double g;
  g = cpJKkg * pressmbar / (0.622 * lambdav);
  return (g);
}


x86 assembly (clang, -O0):
<gammafunc>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<gammafunc>:
movapd %xmm1,%xmm0
mulsd  %xmm2,%xmm0
mulsd  0xef0(%rip),%xmm3
divsd  %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @gammafunc(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%10 = load double, double* %7
%11 = load double, double* %6
%12 = fmul double %10, %11
%13 = load double, double* %8
%14 = fmul double 6.220000e-01, %13
%15 = fdiv double %12, %14
store double %15, double* %9
%16 = load double, double* %9
ret double %16
}

LLVM IR (-O2):
define double @gammafunc(double %0, double %1, double %2, double %3) {
%5 = fmul double %1, %2
%6 = fmul double %3, 6.220000e-01
%7 = fdiv double %5, %6
ret double %7
}
/* Variables and functions */
int /*<<< orphan*/ DoDiff(char const *, char const *);
int main(void) {
  const char *filename1 = "D:\\My Sources\\Desktop\\EE209 structure "
                          "programing\\HW\\HW2\\google.txt";
  const char *filename2 = "D:\\My Sources\\Desktop\\EE209 structure "
                          "programing\\HW\\HW2\\microsoft.txt";
  DoDiff(filename1, filename2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xf12(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <DoDiff@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xf24(%rip),%rsi
call   1030 <DoDiff@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [67 x i8] c"D:\\My Sources\\Desktop\\EE209 structure programing\\HW\\HW2\\google.txt\00"
@.str.1 = [70 x i8] c"D:\\My Sources\\Desktop\\EE209 structure programing\\HW\\HW2\\microsoft.txt\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.1, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %2
%5 = load i8*, i8** %3
%6 = call i32 @DoDiff(i8* %4, i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [67 x i8] c"D:\\My Sources\\Desktop\\EE209 structure programing\\HW\\HW2\\google.txt\00"
@.str.1 = [70 x i8] c"D:\\My Sources\\Desktop\\EE209 structure programing\\HW\\HW2\\microsoft.txt\00"
define i32 @main() {
%1 = tail call i32 @DoDiff(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t fmix(uint32_t h) {
  h ^= h >> 16;
  h *= 0x85ebca6b;
  h ^= h >> 13;
  h *= 0xc2b2ae35;
  h ^= h >> 16;
  return h;
}


x86 assembly (clang, -O0):
<fmix>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
imul   $0x85ebca6b,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0xd,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
imul   $0xc2b2ae35,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmix>:
mov    %edi,%eax
sar    $0x10,%eax
xor    %edi,%eax
imul   $0x85ebca6b,%eax,%eax
mov    %eax,%ecx
sar    $0xd,%ecx
xor    %eax,%ecx
imul   $0xc2b2ae35,%ecx,%ecx
mov    %ecx,%eax
sar    $0x10,%eax
xor    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @fmix(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 16
%5 = load i32, i32* %2
%6 = xor i32 %5, %4
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = mul i32 %7, -2048144789
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = ashr i32 %9, 13
%11 = load i32, i32* %2
%12 = xor i32 %11, %10
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = mul i32 %13, -1028477387
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = ashr i32 %15, 16
%17 = load i32, i32* %2
%18 = xor i32 %17, %16
store i32 %18, i32* %2
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @fmix(i32 %0) {
%2 = ashr i32 %0, 16
%3 = xor i32 %2, %0
%4 = mul i32 %3, -2048144789
%5 = ashr i32 %4, 13
%6 = xor i32 %5, %4
%7 = mul i32 %6, -1028477387
%8 = ashr i32 %7, 16
%9 = xor i32 %8, %7
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ f(int);
int main() {
  int a;
  static int b;
  f(a);
  f(b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x4(%rbp),%edi
call   1030 <f@plt>
mov    0x2f06(%rip),%edi
call   1030 <f@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1030 <f@plt>
xor    %edi,%edi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@main.b = internal global i32 0
define i32 @main() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = call i32 @f(i32 %2)
%4 = load i32, i32* @main.b
%5 = call i32 @f(i32 %4)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 undef)
%2 = tail call i32 @f(i32 0)
ret i32 0
}
/* Variables and functions */
int run_vm();
int main(void) { return run_vm(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <run_vm@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @run_vm()
ret i32 %2
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @run_vm()
ret i32 %1
}
/* Type definitions */
struct json_object {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ json_object_new_string(char *);
int /*<<< orphan*/ json_object_object_add(struct json_object *, char *,
                                          int /*<<< orphan*/);
void controller_set_device(struct json_object *request,
                           struct json_object *response) {
  json_object_object_add(response, "result",
                         json_object_new_string("controller_set_device"));
}


x86 assembly (clang, -O0):
<controller_set_device>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xec8(%rip),%rdi
call   1030 <json_object_new_string@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%edx
lea    0xeaf(%rip),%rsi
call   1040 <json_object_object_add@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<controller_set_device>:
push   %rbx
mov    %rsi,%rbx
lea    0xedc(%rip),%rdi
call   1030 <json_object_new_string@plt>
lea    0xec9(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
pop    %rbx
jmp    1040 <json_object_object_add@plt>

LLVM IR (-O0):
%struct.json_object = type { i32 }
@.str = [7 x i8] c"result\00"
@.str.1 = [22 x i8] c"controller_set_device\00"
define void @controller_set_device(%struct.json_object* %0, %struct.json_object* %1) {
%3 = alloca %struct.json_object*
%4 = alloca %struct.json_object*
store %struct.json_object* %0, %struct.json_object** %3
store %struct.json_object* %1, %struct.json_object** %4
%5 = load %struct.json_object*, %struct.json_object** %4
%6 = call i32 @json_object_new_string(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @json_object_object_add(%struct.json_object* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
%struct.json_object = type { i32 }
@.str = [7 x i8] c"result\00"
@.str.1 = [22 x i8] c"controller_set_device\00"
define void @controller_set_device(%struct.json_object* nocapture readnone %0, %struct.json_object* %1) {
%3 = tail call i32 @json_object_new_string(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @json_object_object_add(%struct.json_object* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
/* Variables and functions */
char *BIPRO_GetNamePtr(void *);
char *BIPRO_GetAddrName(void *ptr) { return (BIPRO_GetNamePtr(ptr)); }


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

x86 assembly (clang, -O2):
<BIPRO_GetAddrName>:
jmp    1030 <BIPRO_GetNamePtr@plt>

LLVM IR (-O0):
define i8* @BIPRO_GetAddrName(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @BIPRO_GetNamePtr(i8* %3)
ret i8* %4
}

LLVM IR (-O2):
define i8* @BIPRO_GetAddrName(i8* %0) {
%2 = tail call i8* @BIPRO_GetNamePtr(i8* %0)
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uintmax_t;

/* Variables and functions */
int /*<<< orphan*/ __strtoull_internal(char const *, char **, int,
                                       int /*<<< orphan*/);
uintmax_t strtoumax(const char *__restrict nptr, char **__restrict endptr,
                    int base) {
  return __strtoull_internal(nptr, endptr, base, 0);
}


x86 assembly (clang, -O0):
<strtoumax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
call   1030 <__strtoull_internal@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtoumax>:
xor    %ecx,%ecx
jmp    1030 <__strtoull_internal@plt>

LLVM IR (-O0):
define i32 @strtoumax(i8* noalias %0, i8** noalias %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8**, i8*** %5
%9 = load i32, i32* %6
%10 = call i32 @__strtoull_internal(i8* %7, i8** %8, i32 %9, i32 0)
ret i32 %10
}

LLVM IR (-O2):
define i32 @strtoumax(i8* noalias %0, i8** noalias %1, i32 %2) {
%4 = tail call i32 @__strtoull_internal(i8* %0, i8** %1, i32 %2, i32 0)
ret i32 %4
}
int do_863() { return 863; }


x86 assembly (clang, -O0):
<do_863>:
push   %rbp
mov    %rsp,%rbp
mov    $0x35f,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_863>:
mov    $0x35f,%eax
ret

LLVM IR (-O0):
define i32 @do_863() {
ret i32 863
}

LLVM IR (-O2):
define i32 @do_863() {
ret i32 863
}
int xmlUCSIsKatakana(int code) {
  return (((code >= 0x30A0) && (code <= 0x30FF)));
}


x86 assembly (clang, -O0):
<xmlUCSIsKatakana>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x30a0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1126 <xmlUCSIsKatakana+0x26>
cmpl   $0x30ff,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmlUCSIsKatakana>:
add    $0xffffcf60,%edi
xor    %eax,%eax
cmp    $0x60,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @xmlUCSIsKatakana(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 12448
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 12543
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @xmlUCSIsKatakana(i32 %0) {
%2 = add i32 %0, -12448
%3 = icmp ult i32 %2, 96
%4 = zext i1 %3 to i32
ret i32 %4
}
void element2RESET() {}


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

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

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

LLVM IR (-O2):
define void @element2RESET() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int main() {
  char c = 'a';
  printf("a=%c\n", c);
  printf("a=%d\n", c);
  char i = 97;
  printf("i=%c\n", i);
  printf("i=%d\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x61,-0x5(%rbp)
lea    0xed6(%rip),%rdi
movsbl -0x5(%rbp),%esi
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
movsbl -0x5(%rbp),%esi
call   1030 <printf@plt>
movb   $0x61,-0x6(%rbp)
lea    0xebe(%rip),%rdi
movsbl -0x6(%rbp),%esi
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
movsbl -0x6(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x61,%esi
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
mov    $0x61,%esi
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
mov    $0x61,%esi
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
mov    $0x61,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"a=%c\0A\00"
@.str.1 = [6 x i8] c"a=%d\0A\00"
@.str.2 = [6 x i8] c"i=%c\0A\00"
@.str.3 = [6 x i8] c"i=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
store i32 0, i32* %1
store i8 97, i8* %2
%4 = load i8, i8* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext %4)
%6 = load i8, i8* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 signext %6)
store i8 97, i8* %3
%8 = load i8, i8* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8 signext %8)
%10 = load i8, i8* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8 signext %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"a=%c\0A\00"
@.str.1 = [6 x i8] c"a=%d\0A\00"
@.str.2 = [6 x i8] c"i=%c\0A\00"
@.str.3 = [6 x i8] c"i=%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext 97)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 signext 97)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8 signext 97)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8 signext 97)
ret i32 0
}
char _Locale_mon_thousands_sep(struct _Locale_monetary *lmon
                               __attribute__((__unused__))) {
  return ',';
}


x86 assembly (clang, -O0):
<_Locale_mon_thousands_sep>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0x2c,%al
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_Locale_mon_thousands_sep>:
mov    $0x2c,%al
ret

LLVM IR (-O0):
%struct._Locale_monetary = type opaque
define signext i8 @_Locale_mon_thousands_sep(%struct._Locale_monetary* %0) {
%2 = alloca %struct._Locale_monetary*
store %struct._Locale_monetary* %0, %struct._Locale_monetary** %2
ret i8 44
}

LLVM IR (-O2):
%struct._Locale_monetary = type opaque
define signext i8 @_Locale_mon_thousands_sep(%struct._Locale_monetary* nocapture readnone %0) {
ret i8 44
}
void ScaleFilterReduce() {}


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

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

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

LLVM IR (-O2):
define void @ScaleFilterReduce() {
ret void
}
int my_strlen(const char *str) {
  int n = 0;
  while (*str++)
    n++;
  return n;
}


x86 assembly (clang, -O0):
<my_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     1135 <my_strlen+0x35>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <my_strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strlen>:
cmpb   $0x0,(%rdi)
je     111c <my_strlen+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <my_strlen+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @my_strlen(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %9, %1
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i32 1
store i8* %6, i8** %2
%7 = load i8, i8* %5
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
br label %4
12: ; preds = %4
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @my_strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ f8(int, int);
void g8(void) { f8(41, 42); }


x86 assembly (clang, -O0):
<g8>:
push   %rbp
mov    %rsp,%rbp
mov    $0x29,%edi
mov    $0x2a,%esi
call   1030 <f8@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<g8>:
mov    $0x29,%edi
mov    $0x2a,%esi
jmp    1030 <f8@plt>

LLVM IR (-O0):
define void @g8() {
%1 = call i32 @f8(i32 41, i32 42)
ret void
}

LLVM IR (-O2):
define void @g8() {
%1 = tail call i32 @f8(i32 41, i32 42)
ret void
}