#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ GPIOPinTypeGPIOOutput(int, int);
int /*<<< orphan*/ GPIOPinWrite(int, int, int);
int /*<<< orphan*/ SysCtlPeripheralEnable(int);
int /*<<< orphan*/ iic_write_m(unsigned char);
int /*<<< orphan*/ start();
int /*<<< orphan*/ stop();
void ads_confige(unsigned int channel) {
  SysCtlPeripheralEnable(0x20000008);
  GPIOPinTypeGPIOOutput(0x40007000, 0x00000040);
  GPIOPinTypeGPIOOutput(0x40007000, 0x00000080);
  GPIOPinWrite(0x40007000, 0x00000080, 0xff);
  GPIOPinWrite(0x40007000, 0x00000040, 0xff);
  unsigned char Initdata[4] = {0};
  switch (channel) {
  case 0:
    Initdata[2] = 0xc2;
    break;
  case 1:
    Initdata[2] = 0xd2;
    break;
  case 2:
    Initdata[2] = 0xe2;
    break;
  case 3:
    Initdata[2] = 0xf2;
    break;
  default:
    break;
  }
  Initdata[0] = 0x90;
  Initdata[1] = 0x01;
  Initdata[3] = 0xe3;
  unsigned char i = 0;
  start();
  for (i = 0; i < 4; i++) {
    iic_write_m(Initdata[i]);
  }
  stop();
}


x86 assembly (clang, -O0):
<ads_confige>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x20000008,%edi
call   1040 <SysCtlPeripheralEnable@plt>
mov    $0x40007000,%edi
mov    %edi,-0x24(%rbp)
mov    $0x40,%esi
mov    %esi,-0x20(%rbp)
call   1070 <GPIOPinTypeGPIOOutput@plt>
mov    -0x24(%rbp),%edi
mov    $0x80,%esi
mov    %esi,-0x28(%rbp)
call   1070 <GPIOPinTypeGPIOOutput@plt>
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edi
mov    $0xff,%edx
mov    %edx,-0x1c(%rbp)
call   1080 <GPIOPinWrite@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
call   1080 <GPIOPinWrite@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x3,%rax
ja     120b <ads_confige+0xab>
mov    -0x18(%rbp),%rax
lea    0xe22(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0xc2,-0x6(%rbp)
jmp    1210 <ads_confige+0xb0>
movb   $0xd2,-0x6(%rbp)
jmp    1210 <ads_confige+0xb0>
movb   $0xe2,-0x6(%rbp)
jmp    1210 <ads_confige+0xb0>
movb   $0xf2,-0x6(%rbp)
jmp    1210 <ads_confige+0xb0>
jmp    1210 <ads_confige+0xb0>
movb   $0x90,-0x8(%rbp)
movb   $0x1,-0x7(%rbp)
movb   $0xe3,-0x5(%rbp)
movb   $0x0,-0x9(%rbp)
mov    $0x0,%al
call   1060 <start@plt>
movb   $0x0,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
cmp    $0x4,%eax
jge    1253 <ads_confige+0xf3>
movzbl -0x9(%rbp),%eax
movzbl -0x8(%rbp,%rax,1),%edi
call   1030 <iic_write_m@plt>
mov    -0x9(%rbp),%al
add    $0x1,%al
mov    %al,-0x9(%rbp)
jmp    122b <ads_confige+0xcb>
mov    $0x0,%al
call   1050 <stop@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ads_confige>:
push   %rbx
mov    %edi,%ebx
mov    $0x20000008,%edi
call   1040 <SysCtlPeripheralEnable@plt>
mov    $0x40007000,%edi
mov    $0x40,%esi
call   1070 <GPIOPinTypeGPIOOutput@plt>
mov    $0x40007000,%edi
mov    $0x80,%esi
call   1070 <GPIOPinTypeGPIOOutput@plt>
mov    $0x40007000,%edi
mov    $0x80,%esi
mov    $0xff,%edx
call   1080 <GPIOPinWrite@plt>
mov    $0x40007000,%edi
mov    $0x40,%esi
mov    $0xff,%edx
call   1080 <GPIOPinWrite@plt>
mov    %ebx,%eax
shl    $0x4,%al
add    $0xc2,%al
xor    %ecx,%ecx
cmp    $0x4,%ebx
movzbl %al,%ebx
cmovae %ecx,%ebx
xor    %eax,%eax
call   1060 <start@plt>
mov    $0x90,%edi
call   1030 <iic_write_m@plt>
mov    $0x1,%edi
call   1030 <iic_write_m@plt>
movzbl %bl,%edi
call   1030 <iic_write_m@plt>
mov    $0xe3,%edi
call   1030 <iic_write_m@plt>
xor    %eax,%eax
pop    %rbx
jmp    1050 <stop@plt>

LLVM IR (-O0):
define void @ads_confige(i32 %0) {
%2 = alloca i32
%3 = alloca [4 x i8]
%4 = alloca i8
store i32 %0, i32* %2
%5 = call i32 @SysCtlPeripheralEnable(i32 536870920)
%6 = call i32 @GPIOPinTypeGPIOOutput(i32 1073770496, i32 64)
%7 = call i32 @GPIOPinTypeGPIOOutput(i32 1073770496, i32 128)
%8 = call i32 @GPIOPinWrite(i32 1073770496, i32 128, i32 255)
%9 = call i32 @GPIOPinWrite(i32 1073770496, i32 64, i32 255)
%10 = bitcast [4 x i8]* %3 to i8*
%11 = load i32, i32* %2
switch i32 %11, label %20 [
i32 0, label %12
i32 1, label %14
i32 2, label %16
i32 3, label %18
]
12: ; preds = %1
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
store i8 -62, i8* %13
br label %21
14: ; preds = %1
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
store i8 -46, i8* %15
br label %21
16: ; preds = %1
%17 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
store i8 -30, i8* %17
br label %21
18: ; preds = %1
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
store i8 -14, i8* %19
br label %21
20: ; preds = %1
br label %21
21: ; preds = %20, %18, %16, %14, %12
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
store i8 -112, i8* %22
%23 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
store i8 1, i8* %23
%24 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
store i8 -29, i8* %24
store i8 0, i8* %4
%25 = call i32 (...) @start()
store i8 0, i8* %4
br label %26
26: ; preds = %36, %21
%27 = load i8, i8* %4
%28 = zext i8 %27 to i32
%29 = icmp slt i32 %28, 4
br i1 %29, label %30, label %39
30: ; preds = %26
%31 = load i8, i8* %4
%32 = zext i8 %31 to i64
%33 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = call i32 @iic_write_m(i8 zeroext %34)
br label %36
36: ; preds = %30
%37 = load i8, i8* %4
%38 = add i8 %37, 1
store i8 %38, i8* %4
br label %26
39: ; preds = %26
%40 = call i32 (...) @stop()
ret void
}

LLVM IR (-O2):
define void @ads_confige(i32 %0) {
%2 = tail call i32 @SysCtlPeripheralEnable(i32 536870920)
%3 = tail call i32 @GPIOPinTypeGPIOOutput(i32 1073770496, i32 64)
%4 = tail call i32 @GPIOPinTypeGPIOOutput(i32 1073770496, i32 128)
%5 = tail call i32 @GPIOPinWrite(i32 1073770496, i32 128, i32 255)
%6 = tail call i32 @GPIOPinWrite(i32 1073770496, i32 64, i32 255)
%7 = icmp ult i32 %0, 4
%8 = trunc i32 %0 to i8
%9 = shl i8 %8, 4
%10 = add i8 %9, -62
%11 = select i1 %7, i8 %10, i8 0
%12 = tail call i32 (...) @start()
%13 = tail call i32 @iic_write_m(i8 zeroext -112)
%14 = tail call i32 @iic_write_m(i8 zeroext 1)
%15 = tail call i32 @iic_write_m(i8 zeroext %11)
%16 = tail call i32 @iic_write_m(i8 zeroext -29)
%17 = tail call i32 (...) @stop()
ret void
}